Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp606762ybg; Wed, 3 Jun 2020 08:58:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyIG55hD23EyGoeYmJCcUyKInFQW6IEuUSB2dxCto4ZqwsPoB0tM0l6/DWzPcfQ5uxHsyZ X-Received: by 2002:a50:d78f:: with SMTP id w15mr68891edi.245.1591199932941; Wed, 03 Jun 2020 08:58:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591199932; cv=none; d=google.com; s=arc-20160816; b=q0Orkd+9yfAOb2IrMv/phK0ywlzlzmlRonSQnbGVKFds6FV2NiC6QayG9RMXbUoWRN mnedxO1ecLhUg12U23PJM9Mx+zzTEMJaiPxHMIOMk6WkzgoG6k9lOmgsVxMrMcNofnLt zpTCe2egGtK/Xx1Zl0oWeYy76058fTuazWOAnCb3zzM1J8rbulRY3Nib8cpfiWtnCdLY 2yteVZH/FdwKJhvVkq5046wX3KDjNyHOg9JYXveEPwVAfkfGOP4Cz2FHIesN9Hl9FPp2 Tgpi5NtdhhYJQ93cA8JHO0dWF0FPLu2eTq9U3aJQDveszx24kx7NvIWvRyuv4H7bnU1p gIiA== 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=MzHOngv+qFI3of43UTi3boFVxoqJB8qWZHjVw9fzKIs=; b=GsttDw+gNV5UczNkdqD2bmZTidVFampVSaqSlNgd8u79Kvm0c1Du6Sf/1qJn+PFdGY N2mEQb/kLT5ciybhFGVk3ZagbIEC7+82uCWxEDaA+5Wc/GKNh+gY6fDFoKH9t+R8pfbw 8VNsaqglEkxQX3T0IqB3TKkoRjs2/Y7t+fpQQKwIrTj2F9EkqSAPXQoVGB0RyD/5FhtA GuMDNr+hBrO1YY++P8RUxJ8HwPOV2TuBE1qsl6Gq8LVi8iOYRzH9K2YAXFfhZkE6NP6b vRfUhJdnaaItBxaNCX1Ntoyu7MM7lKuSmn+slbF/my1KZ8lwWhalQVYLcYCwchyq1SIK QEUQ== 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 j14si1349058edy.342.2020.06.03.08.58.29; Wed, 03 Jun 2020 08:58:52 -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 S1726050AbgFCP4k (ORCPT + 99 others); Wed, 3 Jun 2020 11:56:40 -0400 Received: from mga04.intel.com ([192.55.52.120]:58845 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725867AbgFCP4k (ORCPT ); Wed, 3 Jun 2020 11:56:40 -0400 IronPort-SDR: UfQejUbjCvt1ZvMODsXrS6fZS4/svByVpiGuCLWNpP430oGLMgFHJquGIgTs5K0feLWYG2kctH m24TyiW8Tg0A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2020 08:56:29 -0700 IronPort-SDR: 8nyHVEHEhPCEtgQPQqfg8oVe24ogQXk9XebIX6fkDlGex5oknlRQQJlkCD6hAviflrC4zxST9K HP18agHbJwLg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,468,1583222400"; d="scan'208";a="416603990" Received: from linux.intel.com ([10.54.29.200]) by orsmga004.jf.intel.com with ESMTP; 03 Jun 2020 08:56:28 -0700 Received: from [10.249.225.188] (abudanko-mobl.ccr.corp.intel.com [10.249.225.188]) by linux.intel.com (Postfix) with ESMTP id 11C685800E3; Wed, 3 Jun 2020 08:56:25 -0700 (PDT) Subject: [PATCH v7 05/13] 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: <5de4b954-24f0-1e8d-5a0d-7b12783b8218@linux.intel.com> Organization: Intel Corp. Message-ID: <8af5b574-0932-596d-25ca-8ac23dce9b23@linux.intel.com> Date: Wed, 3 Jun 2020 18:56:25 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <5de4b954-24f0-1e8d-5a0d-7b12783b8218@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 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 31f7ccf9537b..62bad2df13ba 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -823,10 +823,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; stop = process_timeout(timeout, interval, ×); } } -- 2.24.1