Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp323045ybt; Wed, 17 Jun 2020 01:42:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWq5KcmxwaLdBUzRSDFDuORWLggA2IRrN3/Ko9g5Ngo8MHWWX8Lj+28sUZxe1vLY1ECfmJ X-Received: by 2002:aa7:c450:: with SMTP id n16mr6390162edr.6.1592383344863; Wed, 17 Jun 2020 01:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592383344; cv=none; d=google.com; s=arc-20160816; b=MtfwzzP0p0FX5I0UQ3s5aHfg39TmtePeHYYVOkhukcfnRPANiGRJ8o77W+KFwERH83 /gEW0Aw+k3M7fVBMRSXqbXbryRFvgkcMAsrGmB/BNDAKfHzCeWWPDXU7NKlQuLI8iK/W Kj+UeNNauhibPeO+wT5AeSdPbxGQedshNTGqbnwh8snMtQjKB8uCUVx2KYI8QlhR+FBd XzJExf6b6WTDtovlfidxqmuOUR/jjRtJWSgvSirYxW/Ld4TnOVpVOniC7DXle4WkPS5V sanTYFaV/zo+oIFr0WeBg4p7jBt+yJiEw8xRFsXlsAmvP1oy5jA3dJdvekT2O6msBFjP blDg== 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=JOfXYAMk0hSsA5u9+ql+LuURxHhf+gybvhpeHkaW2KFs643nmK43cHxxwVjUb0Dh26 la+XEI7ZCge/tQzkepz4WQnONBF+N/mzi4aCNo42O34Mr55Ybx6LvvTk94x0J8Vd3Ce3 JiYPL8hHrIMiaUiemCRO5sMAye8NqnIqt6Xwx7Keni0JcV5q4UlJJYTUH6rkBTLsGKcn iLAtKHAqVUTtzKZOL7ceIaGfQrZz/jrTOrO9DtaVH08PHK1PaLkaDW/reBIe2rnp3PoJ GhyXCp8KG0/jrvvMLiD95M928tGY02iwCGe6HoGw+O0u31dRO2A/2JODf+bXmFhjtr0w I0/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 t10si12027600edq.305.2020.06.17.01.42.02; Wed, 17 Jun 2020 01:42:24 -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 S1726920AbgFQIiZ (ORCPT + 99 others); Wed, 17 Jun 2020 04:38:25 -0400 Received: from mga12.intel.com ([192.55.52.136]:40870 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725964AbgFQIiZ (ORCPT ); Wed, 17 Jun 2020 04:38:25 -0400 IronPort-SDR: 5DaxtBAa9QBwtD12v+6JVwCmc8qgB4KMvejiY11M3XDJQV1H6WBN766kUbT6/STJLNJd1Gdtw2 EQEfzwZ7fFiA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2020 01:38:24 -0700 IronPort-SDR: 8amOh+3DEq9xGRjv9O9S0/x7SUFY94jbNqYOxXV3EJS4pR0n4U0GH9eJLp/COzVsuh/0i7uhwP 0YrsLt4Iopog== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,522,1583222400"; d="scan'208";a="299218015" Received: from linux.intel.com ([10.54.29.200]) by fmsmga004.fm.intel.com with ESMTP; 17 Jun 2020 01:38:24 -0700 Received: from [10.249.225.191] (abudanko-mobl.ccr.corp.intel.com [10.249.225.191]) by linux.intel.com (Postfix) with ESMTP id 60F0358026B; Wed, 17 Jun 2020 01:38:22 -0700 (PDT) Subject: [PATCH v8 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: <0781a077-aa82-5b4a-273e-c17372a72b93@linux.intel.com> Organization: Intel Corp. Message-ID: <62dc7c05-7195-9001-fbb0-425c6287ad21@linux.intel.com> Date: Wed, 17 Jun 2020 11:38:21 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <0781a077-aa82-5b4a-273e-c17372a72b93@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