Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp583737ybg; Mon, 1 Jun 2020 09:00:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9SIbb6Yqm3iEk23AR/Sxr1lZdy1V4egTjvz6do6xu6Urs2C9FEqjmy417+5H1YPxnnoDg X-Received: by 2002:a05:6402:4c6:: with SMTP id n6mr21630162edw.264.1591027219629; Mon, 01 Jun 2020 09:00:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591027219; cv=none; d=google.com; s=arc-20160816; b=VtBL9fgs1g2RCulp9AMtktTCpQLHI7sQZaGvIswLrMveU2XeEPOWY3zAvBxt7pxwXY XcTbaVZopTmyPVCeeSbKj6V+GSWi5vhLSNG3vWLRaQt7CcS1L0nAotR9Z7A9r2TWm/WN GekvIlJI7Co37Rp0tfrzlyEjEjO1XIPSOLHg1V2lOZ6WSl1zGb+/KUYAxILgmfzKVhIT NqbcbCgKt7hIzA/+qK+gLTBVqqHGj/f5gDXzBSSHjvu4nWLFKCHfpY+YIHKIz5ccC2Xg znk/dE94C+xxjATVHs9Q3xWzCoKEV7TNrz7MJPKElcDobBJ9QFW18rFda1uMO7pkkNYm rjaw== 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=TrVvQ8qNYzeZXjt/cwYJ7Vtp495Oo9ILbqM6+w+WZaU=; b=kWJP3WrzeqWGtwcQsldPIwsuitmYgQbRLR9AFNxrC7ONmtVslIn+jOvdT7VqVizMLX jOc4fOJMdHx2Z2tHeuP0Pih0HnDLOWXWJHKR4P/jwNZr/ZgN9avdZ5pNlgXG4OhioWt6 had2fI4JHoVsa8tMX5Jyn5SOPzahzm15bHER+ZDEEPOr68dS1slqrytdXAjWdNJ04ml9 hWLhbDfi5tzmkbcj+z7IpM12N8uzyY2a2lR7JHf5u+5xV90A5ba9Tzmjn6qFvGJVpza/ RaLokVEHY3bHN6cDuAZspqoUVJJM1yEqhccH2opWsyAmPbmSFK8wK6HC/UAw6Z1r5IKn D8tQ== 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 o25si11094655ejh.304.2020.06.01.08.59.54; Mon, 01 Jun 2020 09:00:19 -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 S1727957AbgFAPz4 (ORCPT + 99 others); Mon, 1 Jun 2020 11:55:56 -0400 Received: from mga17.intel.com ([192.55.52.151]:44473 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbgFAPz4 (ORCPT ); Mon, 1 Jun 2020 11:55:56 -0400 IronPort-SDR: MboGF0yEzghC2d3jhHPVZbbWyeLpuiYC1PE+WUrlZR3giYHlkjtpwTO0LDjzALiaTIZXiGWrvO hZzXddSevM0w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 08:55:55 -0700 IronPort-SDR: KBmtiMQJMdoKs9MQT6x68BRpGJ2cBFQeouJ5paLsWodLIS98ksc5pCitg3s3VfkDkmSDBz2gSF Bwqde9gbi8hg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,461,1583222400"; d="scan'208";a="257298516" Received: from linux.intel.com ([10.54.29.200]) by orsmga007.jf.intel.com with ESMTP; 01 Jun 2020 08:55: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 34A83580646; Mon, 1 Jun 2020 08:55:53 -0700 (PDT) Subject: [PATCH v5 06/13] perf stat: factor out body of event handling loop for launch case 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: <57e17133-4fa7-821a-4637-4634d8686283@linux.intel.com> Date: Mon, 1 Jun 2020 18:55:52 +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 Factor out body of event handling loop for launch use case reusing process_timeout() and process_interval() functions. Signed-off-by: Alexey Budankov --- tools/perf/builtin-stat.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 4d03b18231d4..dc7506be8bbd 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -745,13 +745,9 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx) enable_counters(); if (interval || timeout) { - while (!waitpid(child_pid, &status, WNOHANG)) { + while (!stop && !waitpid(child_pid, &status, WNOHANG)) { nanosleep(&ts, NULL); - if (timeout) - break; - process_interval(); - if (interval_count && !(--times)) - break; + stop = process_timeout(timeout, interval, ×); } } if (child_pid != -1) { -- 2.24.1