Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp343423ybt; Wed, 8 Jul 2020 01:07:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjL/Vjl028xlvbRuml4/dnq1lXtge0uorDSj1LrM/BzX/9aztgnBRHMmEiCXTBladZGq2Q X-Received: by 2002:a17:907:11db:: with SMTP id va27mr53024849ejb.175.1594195620777; Wed, 08 Jul 2020 01:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594195620; cv=none; d=google.com; s=arc-20160816; b=pJSED2ObYpYl4CDaH6QUGmvgNUgV3jP1WwleGL8BvLcBuc3JG9svspwUeWhBZ7rQXU RprsdqFDZ2OGjwGsCTgtzEhcko0rx2fbU+Edza8R9cROFJVwFNgy/1/gvSOHt+1VNWiE YfLEVz1pJkkOs/HMi1yiyQnuXGiZprOQeUf2VXMpZFuTtHUjjuA2OMbo+4gHbrmCX1pL O5YDfl5Vdlig2nsubSkqB9O+Yu/ZKznlOJ4xpp0QCGqxLS5J901Z+LJzeB3LjySa5USP DlvId/dHFkEqBcm+SI6HyMCTxXSYvzL0iOrhFLLTPTy98D3o7NRwxTxbBO1UwztGPjuB oshQ== 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=gCbibv0vKQtM0SKLh/TD8wifx/Vv3S9NbXjvGIdT2BE=; b=LcsADrMOqvCyb4RefYlOq2Zth6l/RK0HDXBcJ8nxebQDfs8aT5M4/BYwlU9cIrr/MS WvWMpEHuqSCkPWe+eCXo4O4wAqJUaLu034ZD4mPEnKErgyYCvgzqbFyn0U/Bt2cbLrlV U063fdPh4Yi63ykawRYDA2imsZ/Jdy9wjs/dVQ5SNojUI0ePBJDy2euZ9LW9w0EjQ4XO hVcNbQjun8oIi+RYqlZdgtF1kiKnl4X4gPL7O02yabsu1XBqLgIHQ8bO1K+7H6Oixkiq jUangxkPHY5THGSzISmN23nLUUxSk5fAnZXkeS9ulV8VNmWpgubehfc+egLT9jcRbsR8 Ge+g== 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 b15si16998464edx.0.2020.07.08.01.06.37; Wed, 08 Jul 2020 01:07:00 -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 S1727839AbgGHHvY (ORCPT + 99 others); Wed, 8 Jul 2020 03:51:24 -0400 Received: from mga18.intel.com ([134.134.136.126]:51780 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbgGHHvY (ORCPT ); Wed, 8 Jul 2020 03:51:24 -0400 IronPort-SDR: N7/eE2yzpKPYQbq18JQ7sn2PAGcYIGjdNxo6eTnjA5tDahLvG/gDUgqnF6PG4k/yY2aiq+wECc YgGQ4ChwuuBg== X-IronPort-AV: E=McAfee;i="6000,8403,9675"; a="135218224" X-IronPort-AV: E=Sophos;i="5.75,327,1589266800"; d="scan'208";a="135218224" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2020 00:51:23 -0700 IronPort-SDR: AgP+MIjK5Ori9WSH1WG1rToNes90VH3gFBrsjMVZWJApQ/eJpMSAcCD5+rQOjUrtaM9FU9XUHi TmZNuU8J9UzA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,327,1589266800"; d="scan'208";a="358030557" Received: from linux.intel.com ([10.54.29.200]) by orsmga001.jf.intel.com with ESMTP; 08 Jul 2020 00:51:23 -0700 Received: from [10.249.226.44] (abudanko-mobl.ccr.corp.intel.com [10.249.226.44]) by linux.intel.com (Postfix) with ESMTP id A21925807C9; Wed, 8 Jul 2020 00:51:21 -0700 (PDT) Subject: [PATCH v10 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: <4af50c95-36f6-7a61-5a22-2949970fe7a5@linux.intel.com> Organization: Intel Corp. Message-ID: <4f967823-bbcb-720b-7a70-dd9509587b58@linux.intel.com> Date: Wed, 8 Jul 2020 10:51:20 +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: <4af50c95-36f6-7a61-5a22-2949970fe7a5@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 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