Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1770797ybh; Fri, 17 Jul 2020 00:05:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdSt0QXrbgCPvlNn6kl98PKHcxkF13eK53QdkS/EUE7OpKZZ7B51nx4cKcmfUm6b96D5uS X-Received: by 2002:a05:6402:6c4:: with SMTP id n4mr8254461edy.353.1594969526742; Fri, 17 Jul 2020 00:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594969526; cv=none; d=google.com; s=arc-20160816; b=eoU8vK37qToCmp/D0XGGIZwXDG05ssnYS0fyFVtG4m+qVyKFmkslHWwOyb8Wi3diCv hztByf5UV1FZ8u096Oczt+S4ipv7rrDH9eJyLk7iCtcS+EZgaMGvTpaXZEa9qOF4yH7B +HyT8woGX6DEekAsQAv73/ptRMCPpMEzf9k/jYffuvVQcFASq8k+d8ZVcP2GITL79are sQFD3HzG9Nhi9X/9hgZ+QQVRtNXtVhNZcvVY31KCHRMyl7hIC9CTZH2frB1eCVAgqcrA jzScWa+HRCsyYJ4x+zDVa/YzlBBpXMwNpT/zCwqLErBKI9AR0bb/mkbCus8ADj7L6dV8 D/Dw== 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=LRlFvVyUNAtS4pZZmG0QFI+BW4dMbPfuBYnrVEKwyBU=; b=TyAKh+fu5/LOD4+Ax+dm0VMjNRlVpugxGQGnh3SV0aNkBalC36a1mGj50guvcY4o/F J3gEM1YjwZ3QhpJTUHMsNPwalr8IKqujDEIt3d3GZdRRuoTYER/JW+YlPTzMBqs5tpAu fU0NdG0yoRnl/nPutEdKmCBSwDD91IJHtMpIOOjSHw9FEr17NTh0fY7mL0fZXFbSFmMB 35yX+6BanOxGAahsAhMjWw/iUCwtV+EHr2MvFDWmp6P7txy5Bva/9wTUkUupApEV0Lx+ 3Hh4aNO55ODSGbSaXUNfByOHSHwH88+TYOdTRkeKmZQddOow/vXlXRFb2yE1ynU62gpS 2QCg== 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 bz23si4488072ejc.195.2020.07.17.00.05.03; Fri, 17 Jul 2020 00:05:26 -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 S1727787AbgGQHCq (ORCPT + 99 others); Fri, 17 Jul 2020 03:02:46 -0400 Received: from mga05.intel.com ([192.55.52.43]:9460 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726113AbgGQHCq (ORCPT ); Fri, 17 Jul 2020 03:02:46 -0400 IronPort-SDR: ho5bWwgb+5+REQY4xpFE47g1AnaAR6Nfx3LHyALYO+E+0oWiZdXLa1H3iGYC5J9E4dpJvmrT1C u5LMQMvIq/DQ== X-IronPort-AV: E=McAfee;i="6000,8403,9684"; a="234399228" X-IronPort-AV: E=Sophos;i="5.75,362,1589266800"; d="scan'208";a="234399228" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2020 00:02:45 -0700 IronPort-SDR: o4eiNJ+8BwxhvIWm/4tbbRzPQAHnW2wvR9abE3WUtu64KmVy7jPgHcgqi9oG+Kazdee6On6xmU Nc+pk4gbORNg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,362,1589266800"; d="scan'208";a="326764672" Received: from linux.intel.com ([10.54.29.200]) by orsmga007.jf.intel.com with ESMTP; 17 Jul 2020 00:02:45 -0700 Received: from [10.249.224.34] (abudanko-mobl.ccr.corp.intel.com [10.249.224.34]) by linux.intel.com (Postfix) with ESMTP id 136FD580100; Fri, 17 Jul 2020 00:02:42 -0700 (PDT) Subject: [PATCH v12 07/15] 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: <8d91c3a0-3db4-0a7a-ae13-299adb444bd6@linux.intel.com> Organization: Intel Corp. Message-ID: <79037528-578c-af64-f06c-a644b7f5ba6a@linux.intel.com> Date: Fri, 17 Jul 2020 10:02:42 +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: <8d91c3a0-3db4-0a7a-ae13-299adb444bd6@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 external asynchronous 'done' signal. Signed-off-by: Alexey Budankov Acked-by: Jiri Olsa Acked-by: Namhyung Kim --- 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