2009-04-20 21:52:29 +08:00
|
|
|
perf-stat(1)
|
2008-04-16 04:39:31 +08:00
|
|
|
============
|
2009-04-20 21:52:29 +08:00
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
|
|
|
perf-stat - Run a command and gather performance counter statistics
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
|
|
|
[verse]
|
2010-12-01 09:57:19 +08:00
|
|
|
'perf stat' [-e <EVENT> | --event=EVENT] [-a] <command>
|
|
|
|
'perf stat' [-e <EVENT> | --event=EVENT] [-a] -- <command> [<options>]
|
2009-04-20 21:52:29 +08: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 22:33:00 +08:00
|
|
|
|
2009-04-20 21:52:29 +08:00
|
|
|
-e::
|
|
|
|
--event=::
|
2009-06-06 20:56:33 +08: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 21:52:29 +08:00
|
|
|
|
2009-06-04 22:33:00 +08:00
|
|
|
-i::
|
2010-05-12 16:40:01 +08:00
|
|
|
--no-inherit::
|
|
|
|
child tasks do not inherit counters
|
2009-06-04 22:33:00 +08:00
|
|
|
-p::
|
|
|
|
--pid=<pid>::
|
2010-12-01 09:57:19 +08:00
|
|
|
stat events on existing process id
|
|
|
|
|
|
|
|
-t::
|
|
|
|
--tid=<tid>::
|
|
|
|
stat events on existing thread id
|
|
|
|
|
2009-06-04 22:33:00 +08:00
|
|
|
|
2009-04-20 21:52:29 +08:00
|
|
|
-a::
|
2010-12-01 09:57:19 +08:00
|
|
|
--all-cpus::
|
|
|
|
system-wide collection from all CPUs
|
2009-04-20 21:52:29 +08:00
|
|
|
|
2009-08-07 16:18:39 +08:00
|
|
|
-c::
|
2010-12-01 09:57:19 +08:00
|
|
|
--scale::
|
|
|
|
scale/normalize counter values
|
|
|
|
|
|
|
|
-r::
|
|
|
|
--repeat=<n>::
|
|
|
|
repeat command and print average + stddev (max: 100)
|
2009-04-20 21:52:29 +08:00
|
|
|
|
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 21:00:01 +08:00
|
|
|
-B::
|
2010-12-01 09:57:19 +08:00
|
|
|
--big-num::
|
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 21:00:01 +08:00
|
|
|
print large numbers with thousands' separators according to locale
|
|
|
|
|
2010-05-28 18:00:01 +08:00
|
|
|
-C::
|
|
|
|
--cpu=::
|
2010-12-01 09:57:19 +08:00
|
|
|
Count only on the list of CPUs provided. Multiple CPUs can be provided as a
|
|
|
|
comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2.
|
2010-05-28 18:00:01 +08:00
|
|
|
In per-thread mode, this option is ignored. The -a option is still necessary
|
|
|
|
to activate system-wide monitoring. Default is to count on all CPUs.
|
|
|
|
|
2010-11-16 17:05:01 +08:00
|
|
|
-A::
|
|
|
|
--no-aggr::
|
|
|
|
Do not aggregate counts across all monitored CPUs in system-wide mode (-a).
|
|
|
|
This option is only valid in system-wide mode.
|
|
|
|
|
2010-12-01 09:57:19 +08:00
|
|
|
-n::
|
|
|
|
--null::
|
|
|
|
null run - don't start any counters
|
|
|
|
|
|
|
|
-v::
|
|
|
|
--verbose::
|
|
|
|
be more verbose (show counter open errors, etc)
|
|
|
|
|
2009-04-20 21:52:29 +08:00
|
|
|
EXAMPLES
|
|
|
|
--------
|
|
|
|
|
2009-06-04 22:33:00 +08:00
|
|
|
$ perf stat -- make -j
|
2009-04-20 21:52:29 +08:00
|
|
|
|
2009-06-04 22:33:00 +08:00
|
|
|
Performance counter stats for 'make -j':
|
2009-04-20 21:52:29 +08:00
|
|
|
|
2009-06-04 22:33:00 +08: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 21:52:29 +08:00
|
|
|
|
2009-06-04 22:33:00 +08:00
|
|
|
Wall-clock time elapsed: 719.554352 msecs
|
2009-04-20 21:52:29 +08:00
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
2009-06-06 20:56:33 +08:00
|
|
|
linkperf:perf-top[1], linkperf:perf-list[1]
|