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

From: Arnaldo Carvalho de Melo
Date: Fri Feb 16 2018 - 08:18:23 EST


Em Thu, Feb 15, 2018 at 10:39:21AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Jan 29, 2018 at 10:25:23AM +0100, ufo19890607 escreveu:
> > From: yuzhoujian <yuzhoujian@xxxxxxxxxxxxxxx>
> >
> > Introduce a new option to print counts after N milliseconds
>
> This doesn't just print counts after N ms, it _stops_ the workload after
> that time _and_ prints the counts, right?
>
> Can you please send a followup patch fixing the description and
> documentation?
>
> I've applied this already, but clarifying what this option does is in
> demand.

So, this fails to build on centos:5 and centos:6 and similar systems
where the use of 'time' for a variable name breaks the build:

CC /tmp/build/perf/builtin-stat.o
cc1: warnings being treated as errors
builtin-stat.c: In function '__run_perf_stat':
builtin-stat.c:576: warning: declaration of 'time' shadows a global declaration
/usr/include/time.h:187: warning: shadowed declaration is here
builtin-stat.c: In function 'cmd_stat':
builtin-stat.c:2710: warning: declaration of 'time' shadows a global declaration
/usr/include/time.h:187: warning: shadowed declaration is here
mv: cannot stat `/tmp/build/perf/.builtin-stat.o.tmp': No such file or directory
make[3]: *** [/tmp/build/perf/builtin-stat.o] Error 1
make[3]: *** Waiting for unfinished jobs....
MKDIR /tmp/build/perf/util/
CC /tmp/build/perf/util/evsel_fprintf.o
make[2]: *** [/tmp/build/perf/perf-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....

So since I had to rename that I replaced it with 'timeout', so that it
gets clear that when you specify this option you are setting a timeout
period that if hit will stop the 'perf stat' session and then print the
specified counters.

Please let us know if you have any strong objection to this,

- Arnaldo