Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp741308ybg; Mon, 1 Jun 2020 13:11:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5vG3lm0xvcxPi6oroAeFqriV1db5zFOTFKo8egrVc+cS40iPkhUIKyU7m0tRr7lacUs3b X-Received: by 2002:a17:906:799:: with SMTP id l25mr9965635ejc.234.1591042281039; Mon, 01 Jun 2020 13:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591042281; cv=none; d=google.com; s=arc-20160816; b=JeZW5+vI+G8URzVQJed4FKc9Myd22TATXd8MFy+9mYomouJLO2Sr+9vtcD4F6hnkxZ Fpd0cfBa6g0yXxLaMiMl4zEksDoz4MCJwFTimpFymLyWN9zYnsa+yhmTdqbUsc/pfuh3 O2K/JnyQbwHfRrVH2tpu32PldXBU2jfN70FS+ahLU4aEXZFHvY70YnKQ1oGAOsowpaFF S344X+Fsmhnj34MLA6ctKXmH/YYSIKHkVZKmTUOg9X2uxVJlM8k1N9N5g5KKo0Wmdu4a hL4x0yTsIh+4ZnzGo8LGL+TBQ40QAjlZd/XRQ687hu9/bGX2LgTyb1H1t0gGg+lbCUPA zamA== 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=3O3Ep9nkIaj+5w8onJ6JiEpDM5lrygOzrioUupqxleE=; b=g+/YjXKVkN6+Mzp90lQ31vHOx8gRrLkCjx4PIEReLizi0BzHvWTbDVdCiwOeaBKwor HPyH0tU94FWk8Emqp+AHA3S05wQMzPH2XAGpXeKfmVL8mURFWhwz86kDNt8qfBYDfAcp vyABiocGmnsAFZISXSwUw/GduAK9+dMJxrs+Pz0w1sgoPkTNzDT2ex+ihtWwYf4QRIlc V2GXpDEb5LhFsPgXiRTqV0joKywHSmq5K0rI6TK4b3ESrAu3N/YXq4xNAjZmJ01PMFUj rSsMDBP8I8pIumS5ih++frhLlSEEwMHXml0VT9ABTowQQGeaIN3vpHUdhicJhHSrvOG7 yUWQ== 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 h7si259360edt.259.2020.06.01.13.10.57; Mon, 01 Jun 2020 13:11:21 -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 S1728426AbgFAUIz (ORCPT + 99 others); Mon, 1 Jun 2020 16:08:55 -0400 Received: from mga17.intel.com ([192.55.52.151]:5246 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbgFAUIz (ORCPT ); Mon, 1 Jun 2020 16:08:55 -0400 IronPort-SDR: 8cMemMCfA58Q2v+N3T5PuFUi8FVS1XHYBQqY/auitrdJDfWTzeVC/+vVWXgqngue3A65wnyGB+ 9WjhxmtBl6yQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 13:08:55 -0700 IronPort-SDR: d4TCG8FsxTpu0JBEy1/ZHg5onm0SxUaNEtW74DLHpEGy1/Fv4LUuCMVYbWncIGjDh8sytswCJt UhL3ifeMuMlg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,462,1583222400"; d="scan'208";a="470405449" Received: from linux.intel.com ([10.54.29.200]) by fmsmga006.fm.intel.com with ESMTP; 01 Jun 2020 13:08:55 -0700 Received: from [10.249.230.65] (abudanko-mobl.ccr.corp.intel.com [10.249.230.65]) by linux.intel.com (Postfix) with ESMTP id 2390058010E; Mon, 1 Jun 2020 13:08:52 -0700 (PDT) Subject: [PATCH v6 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: Organization: Intel Corp. Message-ID: Date: Mon, 1 Jun 2020 23:08:51 +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: 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 6dd28c714f4a..9c090eaae1e1 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -770,10 +770,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