Received: by 10.223.176.5 with SMTP id f5csp2548597wra; Sun, 28 Jan 2018 23:32:30 -0800 (PST) X-Google-Smtp-Source: AH8x224oASrwmQPQgC7+aA5ieGbA0t+vVZsbRurKoZkWnEmL1GAJ8gzYSfdcWwrr/i5GZ1k1F2Cr X-Received: by 2002:a17:902:2702:: with SMTP id c2-v6mr19106606plb.342.1517211150639; Sun, 28 Jan 2018 23:32:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517211150; cv=none; d=google.com; s=arc-20160816; b=LavKKMidX4KdLwasQEdm/OHtWz2y+uxqhRTXKCyPlLudqrPjmzErhsBneDsVmI9YcZ /Cu518tXgqU5CkWWgaSNhUfQcb+7P8vXGC/QhhL4J5036MB0XuKcyWU2Pe+Bu78L0Uu0 0a+Uv52l60oHIK1Om0ba6bNftc+5w8v7M5EddLEk8yODb6MAeXoSSvrPbvmn/LbKlMk3 gtCj80ZRd3fz2XU7b8IqYgsINtytwRpJ61GLwPC35Kve0B2YPm35F4AImsPabfnJi0/K sAwILAbvYkxPLmjOPcobzhfm5EEPnzXdhjtSnRhSZEDwouEV0x3Ymc4hY09UqymWtig2 QYWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=IvVA+w1Eb8cAKwv7LeecaLQP5GtwXq6PLuh3rgkUcUQ=; b=1HRMGM87bLZsiVdf+8e1ovoBupMwqic+YCKsn8mBOCQ8RbnsFVNfl92P4s+yu3S2DY TUudgOT/hOgiujKSJtK1p0rOU6eVha+MmybtjY5S2WGM5HrjLQtQlaWYGZccG4BYWji/ dFm+6HEYebnuLs1qVHXsvk1xvo3NMbmYdjdzLExZuBNL/d/JQNdvIlNkxZNRpRsyUKnl r91qQHLxvUNesZ8JHzuO6YO4NYZdfdW+lV4mB2bZXB4yoApTW2s2fLGxLkxqtUFgbFFV qqS8RPin/wSLsdBdDSbf9NX8iZbaEuqGC16mN2WnCdfPE2gwZTp4EbLLZ1KOJYqvSix4 BnHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l12si2931285pgf.344.2018.01.28.23.32.15; Sun, 28 Jan 2018 23:32:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751546AbeA2H3y (ORCPT + 99 others); Mon, 29 Jan 2018 02:29:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57908 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751423AbeA2H3x (ORCPT ); Mon, 29 Jan 2018 02:29:53 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E47D356DC; Mon, 29 Jan 2018 07:29:53 +0000 (UTC) Received: from krava (unknown [10.43.17.162]) by smtp.corp.redhat.com (Postfix) with SMTP id 0D06D5C26D; Mon, 29 Jan 2018 07:29:49 +0000 (UTC) Date: Mon, 29 Jan 2018 08:29:49 +0100 From: Jiri Olsa To: ufo19890607 Cc: peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, dsahern@gmail.com, namhyung@kernel.org, milian.wolff@kdab.com, arnaldo.melo@gmail.com, yuzhoujian@didichuxing.com, adrian.hunter@intel.com, wangnan0@huawei.com, Kan.liang@intel.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com Subject: Re: [PATCH v3 1/2] perf stat: Add support to print counts for fixed times Message-ID: <20180129072949.GB8162@krava> References: <1516957617-23985-1-git-send-email-ufo19890607@gmail.com> <1516957617-23985-2-git-send-email-ufo19890607@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1516957617-23985-2-git-send-email-ufo19890607@gmail.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 29 Jan 2018 07:29:53 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 26, 2018 at 10:06:56AM +0100, ufo19890607 wrote: SNIP > @@ -1891,6 +1902,8 @@ static const struct option stat_options[] = { > "command to run after to the measured command"), > OPT_UINTEGER('I', "interval-print", &stat_config.interval, > "print counts at regular interval in ms (>= 10)"), > + OPT_INTEGER(0, "interval-count", &stat_config.times, > + "print counts for fixed number of times"), > OPT_SET_UINT(0, "per-socket", &stat_config.aggr_mode, > "aggregate counts per processor socket", AGGR_SOCKET), > OPT_SET_UINT(0, "per-core", &stat_config.aggr_mode, > @@ -2689,6 +2702,7 @@ int cmd_stat(int argc, const char **argv) > const char *mode; > FILE *output = stderr; > unsigned int interval; > + int times; > const char * const stat_subcommands[] = { "record", "report" }; > > setlocale(LC_ALL, ""); > @@ -2719,6 +2733,7 @@ int cmd_stat(int argc, const char **argv) > return __cmd_report(argc, argv); > > interval = stat_config.interval; > + times = stat_config.times; > > /* > * For record command the -o is already taken care of. > @@ -2870,6 +2885,15 @@ int cmd_stat(int argc, const char **argv) > "The overhead percentage could be high in some cases. " > "Please proceed with caution.\n"); > } > + if (times && interval) > + interval_count = true; > + else if (times && !interval) { you can use stat_config.times in here, no need for 'times' copy jirka > + pr_err("interval-count option should be used together with " > + "interval-print.\n"); > + parse_options_usage(stat_usage, stat_options, "interval-count", 0); > + parse_options_usage(stat_usage, stat_options, "I", 1); > + goto out; > + } > > if (perf_evlist__alloc_stats(evsel_list, interval)) > goto out; > diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h > index dbc6f7134f61..b2f8a347d358 100644 > --- a/tools/perf/util/stat.h > +++ b/tools/perf/util/stat.h > @@ -90,6 +90,7 @@ struct perf_stat_config { > bool scale; > FILE *output; > unsigned int interval; > + int times; > struct runtime_stat *stats; > int stats_num; > }; > -- > 2.14.1 >