Re: [PATCH v2 2/2] perf stat: Add support to print counts after a period of time

From: Jiri Olsa
Date: Fri Jan 26 2018 - 02:51:17 EST


On Fri, Jan 26, 2018 at 09:59:02AM +0800, çèé wrote:
> 2018-01-25 20:27 GMT+08:00 Jiri Olsa <jolsa@xxxxxxxxxx>:
>
> > 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