Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp582277ybg; Mon, 1 Jun 2020 08:57:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxh5AEuP5whex/AnBQ6mCyc3UTHFcQ8yh4wo+IKeP9VC7b9YGDTVrxChwvMT/Mq6SYqO4HV X-Received: by 2002:a17:906:7c5a:: with SMTP id g26mr19385652ejp.200.1591027065685; Mon, 01 Jun 2020 08:57:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591027065; cv=none; d=google.com; s=arc-20160816; b=c+uqFPpAj3NOacpEbAKhjiMKQ+FlxYQaU1xrsfyJgQlXkpZt0S1SjvmL28hF8TOso9 9nWGmaS+6bU2x1H7pmhg713gxkqKH7Q0j5UTNVXDdy5n8RjVkxCAS5qf9UwgDK95FD6B pJocjujoPVLhQGaledC+P/g6FIiiC5AATzPzkJfZ+mC9+YcfcDl3M27wjQ02aV0V75OB qUJ8XkerOq1INiubt2l8lh3DcwevagFaeIt04BU+oP2hAYZQc6rux7EPWcuqACqlEEoi sVGtTSazKjlI1JfEn0R21gHGhWnnrU6smWYnlB8aXC3xQbx9OGRqfnIN8+tuhUml+I00 Z4iQ== 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=6lzIpP91s9K0iHxR1XnsZRraxNWe7ZgBa/IHfhND+qY=; b=UBIKAo3lRTIjDuKjorHUMj4g2M3B+iPmBk7R2Ggnz85+4ejNh0x0ndlcBAKMe6pr4/ 2ORzRLluAiOlr2nshkItoBmcjEyCw0eUSoFTbbyY2j3MAvtmJ7lrsH4TwvheYHuV2dfi C2t9YJX96t8QCOGQ8VS2rspAzZESSEnyRrT9itIUI3eVQuGZZna8+l8vs79nHqbQh1Nb 99I5SZm12PP4E0q0qM/g0Oq7XU3sZwT6rZB0MkJ5zu1yw151J7r/+roSwqYbSc45PoAt Hi6ybkmvtukH7AW+PM3Bj293qYoN9OThDnbroT+EcK+ATaQWduw3/mEmCE+oqbR6o8GU M1Eg== 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 l23si4059652ejc.94.2020.06.01.08.57.23; Mon, 01 Jun 2020 08:57:45 -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 S1728071AbgFAPzJ (ORCPT + 99 others); Mon, 1 Jun 2020 11:55:09 -0400 Received: from mga07.intel.com ([134.134.136.100]:47441 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728031AbgFAPzJ (ORCPT ); Mon, 1 Jun 2020 11:55:09 -0400 IronPort-SDR: y6SFl9Qb1R5pJBXvxThzu9EoOkAXbEXLqFkBMAwR49cRXN0T8FvWRcOJatE6688wjx62p9y6Ga Oh6tsBF95EIw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 08:55:07 -0700 IronPort-SDR: DuPWjWOHHv0VqSrq9GBDcwshYNb6Yj6K6/7sHAyoahjz7DALLafkOC59UrO5LcQRJnw2Th/Nzm zJiWr8hmfEDg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,461,1583222400"; d="scan'208";a="444335286" Received: from linux.intel.com ([10.54.29.200]) by orsmga005.jf.intel.com with ESMTP; 01 Jun 2020 08:55:07 -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 54086580378; Mon, 1 Jun 2020 08:55:05 -0700 (PDT) Subject: [PATCH v5 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: <08f23d8b-5406-d9be-2cda-cda187cbbdfd@linux.intel.com> Date: Mon, 1 Jun 2020 18:55:04 +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 834a3d791ee5..4d03b18231d4 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