Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2112254ybt; Fri, 3 Jul 2020 00:48:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgIP4JBVxECN1cdKnHTJzHOFjyCIM87Fym2au1LBzBehdesnka26Mpsb5FC2204ZnMLqPH X-Received: by 2002:a17:906:148a:: with SMTP id x10mr32997486ejc.497.1593762526297; Fri, 03 Jul 2020 00:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593762526; cv=none; d=google.com; s=arc-20160816; b=cCrZp+UgAP0RBMeD9CiMmsei4MTEzS2yM/tuZyIyuD+MxG5rWPs4v46eYJ/LiNUsVm oaySKMkSvp5KHQfxf4gaNilCcNk07bR/Rh4sCeZNwlS6+8W060XAgBUuOkwjE6LyxXPd 6dpnzNLfWGOm35+neQNAy3rUjBPgl23FMAYJaxB5iVl2OUUiT7hUYATJgxQC4hzpHmcA +QuN2L8FpggjWpAtLuJTJiO0X8ex3kf3/Go8JgdNM7fRwZN5N669V53nCDCq5f0h2HZz T7D0S1zHyYK0+C0YJ8C8ASNPEHtQ7wDpFQ/DwOHpwm0jHNLcBQmasdtw7pKiFbFp6cis jqUw== 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=l+Zw2GK0K7LjhWNGeyVPiiEBeZ4vSfeSBGgEDjqz5L8=; b=HM1bjio946yTXRqxPpndkWB8ydVPBgNhxTUb0UNrOTZdaCD1ZMX8Wxry6lN1M3JGIH bmxkcv+YRErIozd1ZEreQ7nsS3Ev54utli0LLI86edzXB7+vcKU55fP+HcUjBIVLNpxD qyHlzmKbfh77d6fCVdLwLMtol3UCwUvana8zh+StG2zr6B3vt2UrvKlvIuMAe1r9OBvW EA5Y4SgOdrnqiDXADsyZtSYkNHc8ijEl13KCfLnWLSVfH+c4YXDbzBC+g87KP9V+krLD aFIB2oyw2gtGnchFMaVfrpL2aFDbF84xijpGyJt72pquNW6aGqKBQEMrfibzEaL6Ifn8 Sg0A== 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 v4si7075457ejx.555.2020.07.03.00.48.23; Fri, 03 Jul 2020 00:48:46 -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 S1726338AbgGCHpN (ORCPT + 99 others); Fri, 3 Jul 2020 03:45:13 -0400 Received: from mga07.intel.com ([134.134.136.100]:32336 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbgGCHpN (ORCPT ); Fri, 3 Jul 2020 03:45:13 -0400 IronPort-SDR: wtwix1w3nZy4Jp70l0D3JCMJUvjyJMam69lP4zOj4ZcJSZZnYp5NZtbbVnOlDlwXwoJ2VVe/B5 bsG2gNjMVAaA== X-IronPort-AV: E=McAfee;i="6000,8403,9670"; a="212128706" X-IronPort-AV: E=Sophos;i="5.75,307,1589266800"; d="scan'208";a="212128706" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2020 00:45:12 -0700 IronPort-SDR: Q2GBoXzrTIDO/wjbfCKBuOmkBHZrRwfvT5AFFq8DKoGsQOKL01TG6DOiR5E1RMidE1fVTt/3mA oIkj6BXuHcgw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,307,1589266800"; d="scan'208";a="356705985" Received: from linux.intel.com ([10.54.29.200]) by orsmga001.jf.intel.com with ESMTP; 03 Jul 2020 00:45:12 -0700 Received: from [10.249.231.67] (abudanko-mobl.ccr.corp.intel.com [10.249.231.67]) by linux.intel.com (Postfix) with ESMTP id 515BB580784; Fri, 3 Jul 2020 00:45:10 -0700 (PDT) Subject: [PATCH v9 07/15] perf stat: move target check to loop control statement From: Alexey Budankov To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: Organization: Intel Corp. Message-ID: <28dc4fba-34fb-e398-7cad-825e57cce81d@linux.intel.com> Date: Fri, 3 Jul 2020 10:45: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: 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 with 'stop' indicator based on command line values and 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 c74e8f94375c..3baf00482666 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -816,10 +816,8 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx) psignal(WTERMSIG(status), argv[0]); } else { enable_counters(); - while (!done && !stop) { + while (!done && !stop && is_target_alive(&target, evsel_list->core.threads)) { nanosleep(&ts, NULL); - if (!is_target_alive(&target, evsel_list->core.threads)) - break; if (timeout) break; stop = handle_interval(interval, ×); -- 2.24.1