2009-04-20 07:52:29 -06:00
|
|
|
perf-stat(1)
|
2008-04-15 14:39:31 -06:00
|
|
|
============
|
2009-04-20 07:52:29 -06:00
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
|
|
|
perf-stat - Run a command and gather performance counter statistics
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
|
|
|
[verse]
|
2009-06-22 14:52:39 -06:00
|
|
|
'perf stat' [-e <EVENT> | --event=EVENT] [-S] [-a] <command>
|
|
|
|
'perf stat' [-e <EVENT> | --event=EVENT] [-S] [-a] -- <command> [<options>]
|
2009-04-20 07:52:29 -06:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
This command runs a command and gathers performance counter statistics
|
|
|
|
from it.
|
|
|
|
|
|
|
|
|
|
|
|
OPTIONS
|
|
|
|
-------
|
|
|
|
<command>...::
|
|
|
|
Any command you can specify in a shell.
|
|
|
|
|
2009-06-04 08:33:00 -06:00
|
|
|
|
2009-04-20 07:52:29 -06:00
|
|
|
-e::
|
|
|
|
--event=::
|
2009-06-06 06:56:33 -06:00
|
|
|
Select the PMU event. Selection can be a symbolic event name
|
|
|
|
(use 'perf list' to list all events) or a raw PMU
|
|
|
|
event (eventsel+umask) in the form of rNNN where NNN is a
|
|
|
|
hexadecimal event descriptor.
|
2009-04-20 07:52:29 -06:00
|
|
|
|
2009-06-04 08:33:00 -06:00
|
|
|
-i::
|
2010-05-12 02:40:01 -06:00
|
|
|
--no-inherit::
|
|
|
|
child tasks do not inherit counters
|
2009-06-04 08:33:00 -06:00
|
|
|
-p::
|
|
|
|
--pid=<pid>::
|
|
|
|
stat events on existing pid
|
|
|
|
|
2009-04-20 07:52:29 -06:00
|
|
|
-a::
|
|
|
|
system-wide collection
|
|
|
|
|
2009-08-07 02:18:39 -06:00
|
|
|
-c::
|
2009-04-20 07:52:29 -06:00
|
|
|
scale counter values
|
|
|
|
|
perf stat: add perf stat -B to pretty print large numbers
It is hard to read very large numbers so provide an option to perf stat
to separate thousands using a separator. The patch leverages the locale
support of stdio. You need to set your LC_NUMERIC appropriately, for
instance LC_NUMERIC=en_US.UTF8. You need to pass -B to activate this
feature. This way existing scripts parsing the output do not need to be
changed. Here is an example.
$ perf stat noploop 2
noploop for 2 seconds
Performance counter stats for 'noploop 2':
1998.347031 task-clock-msecs # 0.998 CPUs
61 context-switches # 0.000 M/sec
0 CPU-migrations # 0.000 M/sec
118 page-faults # 0.000 M/sec
4,138,410,900 cycles # 2070.917 M/sec (scaled from 70.01%)
2,062,650,268 instructions # 0.498 IPC (scaled from 70.01%)
2,057,653,466 branches # 1029.678 M/sec (scaled from 70.01%)
40,267 branch-misses # 0.002 % (scaled from 30.04%)
2,055,961,348 cache-references # 1028.831 M/sec (scaled from 30.03%)
53,725 cache-misses # 0.027 M/sec (scaled from 30.02%)
2.001393933 seconds time elapsed
$ perf stat -B noploop 2
noploop for 2 seconds
Performance counter stats for 'noploop 2':
1998.297883 task-clock-msecs # 0.998 CPUs
59 context-switches # 0.000 M/sec
0 CPU-migrations # 0.000 M/sec
119 page-faults # 0.000 M/sec
4,131,380,160 cycles # 2067.450 M/sec (scaled from 70.01%)
2,059,096,507 instructions # 0.498 IPC (scaled from 70.01%)
2,054,681,303 branches # 1028.216 M/sec (scaled from 70.01%)
25,650 branch-misses # 0.001 % (scaled from 30.05%)
2,056,283,014 cache-references # 1029.017 M/sec (scaled from 30.03%)
47,097 cache-misses # 0.024 M/sec (scaled from 30.02%)
2.001391016 seconds time elapsed
Cc: David S. Miller <davem@davemloft.net>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <4bf28fe8.914ed80a.01ca.fffff5f5@mx.google.com>
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-05-18 07:00:01 -06:00
|
|
|
-B::
|
|
|
|
print large numbers with thousands' separators according to locale
|
|
|
|
|
2009-04-20 07:52:29 -06:00
|
|
|
EXAMPLES
|
|
|
|
--------
|
|
|
|
|
2009-06-04 08:33:00 -06:00
|
|
|
$ perf stat -- make -j
|
2009-04-20 07:52:29 -06:00
|
|
|
|
2009-06-04 08:33:00 -06:00
|
|
|
Performance counter stats for 'make -j':
|
2009-04-20 07:52:29 -06:00
|
|
|
|
2009-06-04 08:33:00 -06:00
|
|
|
8117.370256 task clock ticks # 11.281 CPU utilization factor
|
|
|
|
678 context switches # 0.000 M/sec
|
|
|
|
133 CPU migrations # 0.000 M/sec
|
|
|
|
235724 pagefaults # 0.029 M/sec
|
|
|
|
24821162526 CPU cycles # 3057.784 M/sec
|
|
|
|
18687303457 instructions # 2302.138 M/sec
|
|
|
|
172158895 cache references # 21.209 M/sec
|
|
|
|
27075259 cache misses # 3.335 M/sec
|
2009-04-20 07:52:29 -06:00
|
|
|
|
2009-06-04 08:33:00 -06:00
|
|
|
Wall-clock time elapsed: 719.554352 msecs
|
2009-04-20 07:52:29 -06:00
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
2009-06-06 06:56:33 -06:00
|
|
|
linkperf:perf-top[1], linkperf:perf-list[1]
|