Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1600025ybh; Tue, 14 Jul 2020 02:07:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs4PnBkrMMZee0c8elOm8kf7V967SGcka/Z0wvV6BRSvTyy+09HpugniNsunRhXrWSNRXP X-Received: by 2002:a17:906:9387:: with SMTP id l7mr3478251ejx.274.1594717662219; Tue, 14 Jul 2020 02:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594717662; cv=none; d=google.com; s=arc-20160816; b=bhV3BSIiaFUhD/xM8S/tR+ibvvFJC/ejURFviGCZgGs2rBE0S6c/faiSwY0N3JQDEE EweN1uItcycgYt7RDj4u3YXjDJBtBDk7Pd6eyl0TMVIeFY6TUo/gwT+EtzKOJAKFsTvv J/kLMO5sIBF553+4mTu79jYHEhDMXJ8QTmfjvYIrxD0UWJHlUnjaPpOo6c3a37feYOn+ vHiOjJ8rbAn4WypWg3v+UptbBeMcPG/h+NYyHq71JPyLlNovZWKMuE/L03YngaMWPC0B qVW76iAET+ggLPweT8KG0LZokvQntajYSCrhLysA2TB9LZBrnC7KbMaN/+DVAoFKHImD uA7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:references:cc:to:from:subject:ironport-sdr :ironport-sdr; bh=jhyak8/8D/xzSX+DHIbV2b0Pf88f5sHu6HM+Gp5G928=; b=MjOuQBnW6sq7f74EppUy8QLElRtSe/njlYw3BZyyDrBgKcLb9sF2l1F664eLu6tds+ 6VUA2lnWt3S2eHcQV4H8hdAsyWcuezt/otNWT6Jnw2Q9HkEjGzlzNt0lvK2ozRCLsEPE q3HXeYkIX+oEzO7DjeDwH1BXb4k5bITTkMkSruijer4Fpz0pK5e7uXsDsB+1+8zzCcDz Ql5RmtUI9ZGOspZdlo7F3/vZu1VDTfJZtoHQYvHHofewkl2PhrblWJMPNspuvSrgQ1D6 JT3Q7fC2u1wmSl1VBcIrkVcJlA+QwR+5w5r2slRzcDN3AJRDhKfkhX9YqkVS5l7bPIMu C8Eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si10594258ejk.170.2020.07.14.02.07.19; Tue, 14 Jul 2020 02:07:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726661AbgGNJHQ (ORCPT + 99 others); Tue, 14 Jul 2020 05:07:16 -0400 Received: from mga01.intel.com ([192.55.52.88]:51337 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgGNJHQ (ORCPT ); Tue, 14 Jul 2020 05:07:16 -0400 IronPort-SDR: DxeZ8dCdIfnWk600paHpIdqDSy71XLlXusz+tlENhOeJnDHpo0gFQ11HlEtMbt9po4JY5Nar3m tWadRfaQ1a/w== X-IronPort-AV: E=McAfee;i="6000,8403,9681"; a="166950676" X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="166950676" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2020 02:07:16 -0700 IronPort-SDR: Lu24cxCiV3JXQl1MdPGlPeQZY4mjyMHFzdfpIYp4/H08d8xHzGZMR7XTOyruOOU72F8dF9uCwB THEDEhfbKDgw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="281688261" Received: from linux.intel.com ([10.54.29.200]) by orsmga003.jf.intel.com with ESMTP; 14 Jul 2020 02:07:15 -0700 Received: from [10.249.230.149] (abudanko-mobl.ccr.corp.intel.com [10.249.230.149]) by linux.intel.com (Postfix) with ESMTP id 55490580810; Tue, 14 Jul 2020 02:07:10 -0700 (PDT) Subject: [PATCH v11 07/15] perf stat: move target check to loop control statement From: Alexey Budankov To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <037d737f-0ada-a9f0-9686-f7521ca6fbc3@linux.intel.com> Organization: Intel Corp. Message-ID: <0ee60afd-df71-ebc1-41a9-8e451cdc1269@linux.intel.com> Date: Tue, 14 Jul 2020 12:07:09 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <037d737f-0ada-a9f0-9686-f7521ca6fbc3@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Check for target existence in loop control statement jointly external asynchronous 'done' signal. Signed-off-by: Alexey Budankov --- tools/perf/builtin-stat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 80aea49e4dac..87eebf3f55ae 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -815,10 +815,8 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx) psignal(WTERMSIG(status), argv[0]); } else { enable_counters(); - while (!done) { + while (!done && is_target_alive(&target, evsel_list->core.threads)) { nanosleep(&ts, NULL); - if (!is_target_alive(&target, evsel_list->core.threads)) - break; if (timeout || handle_interval(interval, ×)) break; } -- 2.24.1