linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* perf stat: Add support to print counts for fixed times
@ 2018-01-24  2:43 ufo19890607
  2018-01-24  7:48 ` Jiri Olsa
  0 siblings, 1 reply; 2+ messages in thread
From: ufo19890607 @ 2018-01-24  2:43 UTC (permalink / raw)
  To: peterz, mingo, alexander.shishkin, jolsa, dsahern, namhyung,
	milian.wolff, arnaldo.melo, yuzhoujian, adrian.hunter, wangnan0
  Cc: linux-perf-users, linux-kernel, acme

From: yuzhoujian <yuzhoujian@didichuxing.com>

Hi Jirka
And how can you control the output for perf stat, if I don't want to use the 
"sleep" workload, like some user programs. I want to check the "cycles"
for this program when it just begin to run.

root@node10:/home$ gcc -g -o malloc malloc.c
root@node10:/home$ ./perf stat -e cycles -I 1000 --times-print 3 ./malloc &
[1] 32586
#           time             counts unit events
     1.000094153      2,914,162,979      cycles                                                      
     2.000323667      3,062,832,799      cycles                                                      
     3.000443807      3,063,146,609      cycles

Best wishes

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: perf stat: Add support to print counts for fixed times
  2018-01-24  2:43 perf stat: Add support to print counts for fixed times ufo19890607
@ 2018-01-24  7:48 ` Jiri Olsa
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Olsa @ 2018-01-24  7:48 UTC (permalink / raw)
  To: ufo19890607
  Cc: peterz, mingo, alexander.shishkin, jolsa, dsahern, namhyung,
	milian.wolff, arnaldo.melo, yuzhoujian, adrian.hunter, wangnan0,
	linux-perf-users, linux-kernel, acme

On Wed, Jan 24, 2018 at 03:43:19AM +0100, ufo19890607 wrote:
> From: yuzhoujian <yuzhoujian@didichuxing.com>
> 
> Hi Jirka
> And how can you control the output for perf stat, if I don't want to use the 
> "sleep" workload, like some user programs. I want to check the "cycles"
> for this program when it just begin to run.
> 
> root@node10:/home$ gcc -g -o malloc malloc.c
> root@node10:/home$ ./perf stat -e cycles -I 1000 --times-print 3 ./malloc &
> [1] 32586
> #           time             counts unit events
>      1.000094153      2,914,162,979      cycles                                                      
>      2.000323667      3,062,832,799      cycles                                                      
>      3.000443807      3,063,146,609      cycles

yea, we can't do that now.. we have the exat oposit option in record,
because sometimes you want to skip the initialization phase of the
workload.. any special reason why you want to see just the begining?

we can add this, but maybe change the option name a bit

your code now allows this even if it's not in interval mode

	[jolsa@krava perf]$ sudo ./perf stat -e cycles -a --times-print 3

	 Performance counter stats for 'system wide':

	     1,469,288,467      cycles                                                      

	       3.000502814 seconds time elapsed


I think we should either keep it interval specific:

  perf stat -e cycles -I 1000 --interval-count=3

or make the option general and time based:

  perf stat -e cycles --time=3000


or maybe both ;-)

thanks,
jirka

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-24  7:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-24  2:43 perf stat: Add support to print counts for fixed times ufo19890607
2018-01-24  7:48 ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).