From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Olsa Subject: Re: [PATCH v2 2/2] perf stat: Add support to print counts after a period of time Date: Fri, 26 Jan 2018 08:51:04 +0100 Message-ID: <20180126075104.GA4754@krava> References: <1516871404-31920-1-git-send-email-ufo19890607@gmail.com> <1516871404-31920-3-git-send-email-ufo19890607@gmail.com> <20180125122712.GA9096@krava> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42648 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752065AbeAZHvM (ORCPT ); Fri, 26 Jan 2018 02:51:12 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-perf-users-owner@vger.kernel.org List-ID: To: =?utf-8?B?56a56Iif6ZSu?= Cc: Peter Zijlstra , mingo@redhat.com, Alexander Shishkin , Jiri Olsa , David Ahern , Namhyung Kim , Milian Wolff , Arnaldo Carvalho de Melo , Wind Yu , Adrian Hunter , Wang Nan , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com On Fri, Jan 26, 2018 at 09:59:02AM +0800, 禹舟键 wrote: > 2018-01-25 20:27 GMT+08:00 Jiri Olsa : > > > On Thu, Jan 25, 2018 at 10:10:04AM +0100, ufo19890607 wrote: > > > > SNIP > > > > > --metric-only:: > > > Only print computed metrics. Print them in a single line. > > > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c > > > index 406f546ad74c..427f06dc35cc 100644 > > > --- a/tools/perf/builtin-stat.c > > > +++ b/tools/perf/builtin-stat.c > > > @@ -573,6 +573,7 @@ static int __run_perf_stat(int argc, const char > > **argv) > > > { > > > int interval = stat_config.interval; > > > int times = stat_config.times; > > > + int time = stat_config.time; > > > char msg[BUFSIZ]; > > > unsigned long long t0, t1; > > > struct perf_evsel *counter; > > > @@ -586,6 +587,9 @@ static int __run_perf_stat(int argc, const char > > **argv) > > > if (interval) { > > > ts.tv_sec = interval / USEC_PER_MSEC; > > > ts.tv_nsec = (interval % USEC_PER_MSEC) * NSEC_PER_MSEC; > > > + } else if (time) { > > > + ts.tv_sec = time / USEC_PER_MSEC; > > > + ts.tv_nsec = (time % USEC_PER_MSEC) * NSEC_PER_MSEC; > > > > I like the idea.. it won't work with -I option, but let's > > keep it like that until someone needs it ;-) > > > > > Hi Jirka > > What do you mean by this sentence??? that I'm ok with the patch with small fixes I mentioned jirka