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>]
|
perf stat record: Add record command
Add 'perf stat record' command support. It creates simple (header only)
perf.data file ATM.
The record command could be specified anywhere among stat options. All
stat command options are valid for stat record command with '-o' option
exception. If specified for record command it denotes the perf data file
name.
Committer note:
Set sample_type to PERF_SAMPLE_IDENTIFIER, which should be harmless
while avoiding that older tools show confusing messages, for instance,
with sample_type = 0, we get:
$ perf stat record usleep 1
Performance counter stats for 'usleep 1':
0.630237 task-clock (msec) # 0.528 CPUs utilized
1 context-switches # 0.002 M/sec
0 cpu-migrations # 0.000 K/sec
52 page-faults # 0.083 M/sec
978,312 cycles # 1.552 GHz
671,931 stalled-cycles-frontend # 68.68% frontend cycles idle
<not supported> stalled-cycles-backend
646,379 instructions # 0.66 insns per cycle
# 1.04 stalled cycles per insn
131,046 branches # 207.931 M/sec
7,073 branch-misses # 5.40% of all branches
0.001193240 seconds time elapsed
$ oldperf evlist
WARNING: The perf.data file's data size field is 0 which is unexpected.
Was the 'perf record' command properly terminated?
non matching sample_type
$
While with sample_type set to PERF_SAMPLE_IDENTIFIER, after we re-run 'perf
stat record usleep' we get:
$ oldperf evlist
WARNING: The perf.data file's data size field is 0 which is unexpected.
Was the 'perf record' command properly terminated?
task-clock
context-switches
cpu-migrations
page-faults
cycles
stalled-cycles-frontend
stalled-cycles-backend
instructions
branches
branch-misses
$
Which at least shows the names of the events in the perf.data file.
Additionally, such files, when passed to 'perf report' will produce:
$ oldperf report --stdio
WARNING: The perf.data file's data size field is 0 which is unexpected.
Was the 'perf record' command properly terminated?
Warning:
Kernel address maps (/proc/{kallsyms,modules}) were restricted.
Check /proc/sys/kernel/kptr_restrict before running 'perf record'.
As no suitable kallsyms nor vmlinux was found, kernel samples
can't be resolved.
Samples in kernel modules can't be resolved as well.
Error:
The perf.data file has no samples!
# To display the perf.data header info, please use --header/--header-only options.
#
$
Which is confusing and can be solved by just adding the kernel mmap record,
which will also remove that warning about the data size field being equal to
zero, after generating the mmap record:
$ perf stat record usleep 1
Performance counter stats for 'usleep 1':
0.600796 task-clock (msec) # 0.478 CPUs utilized
1 context-switches # 0.002 M/sec
0 cpu-migrations # 0.000 K/sec
54 page-faults # 0.090 M/sec
886,844 cycles # 1.476 GHz
582,169 stalled-cycles-frontend # 65.65% frontend cycles idle
<not supported> stalled-cycles-backend
638,344 instructions # 0.72 insns per cycle
# 0.91 stalled cycles per insn
130,204 branches # 216.719 M/sec
7,500 branch-misses # 5.76% of all branches
0.001255897 seconds time elapsed
$ oldperf evlist
task-clock
context-switches
cpu-migrations
page-faults
cycles
stalled-cycles-frontend
stalled-cycles-backend
instructions
branches
branch-misses
$ oldperf report --stdio
Error:
The perf.data file has no samples!
# To display the perf.data header info, please use --header/--header-only options.
#
[acme@zoo linux]$
No warnings, sensible output about what are the events in the perf.data file and also
a "file has no samples" message, which indeed it doesn't.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Kan Liang <kan.liang@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: htp://lkml.kernel.org/r/1446734469-11352-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-11-05 22:40:46 +08:00
|
|
|
'perf stat' [-e <EVENT> | --event=EVENT] [-a] record [-o file] -- <command> [<options>]
|
2015-11-05 22:40:55 +08:00
|
|
|
'perf stat' report [-i file]
|
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.
|
|
|
|
|
perf stat record: Add record command
Add 'perf stat record' command support. It creates simple (header only)
perf.data file ATM.
The record command could be specified anywhere among stat options. All
stat command options are valid for stat record command with '-o' option
exception. If specified for record command it denotes the perf data file
name.
Committer note:
Set sample_type to PERF_SAMPLE_IDENTIFIER, which should be harmless
while avoiding that older tools show confusing messages, for instance,
with sample_type = 0, we get:
$ perf stat record usleep 1
Performance counter stats for 'usleep 1':
0.630237 task-clock (msec) # 0.528 CPUs utilized
1 context-switches # 0.002 M/sec
0 cpu-migrations # 0.000 K/sec
52 page-faults # 0.083 M/sec
978,312 cycles # 1.552 GHz
671,931 stalled-cycles-frontend # 68.68% frontend cycles idle
<not supported> stalled-cycles-backend
646,379 instructions # 0.66 insns per cycle
# 1.04 stalled cycles per insn
131,046 branches # 207.931 M/sec
7,073 branch-misses # 5.40% of all branches
0.001193240 seconds time elapsed
$ oldperf evlist
WARNING: The perf.data file's data size field is 0 which is unexpected.
Was the 'perf record' command properly terminated?
non matching sample_type
$
While with sample_type set to PERF_SAMPLE_IDENTIFIER, after we re-run 'perf
stat record usleep' we get:
$ oldperf evlist
WARNING: The perf.data file's data size field is 0 which is unexpected.
Was the 'perf record' command properly terminated?
task-clock
context-switches
cpu-migrations
page-faults
cycles
stalled-cycles-frontend
stalled-cycles-backend
instructions
branches
branch-misses
$
Which at least shows the names of the events in the perf.data file.
Additionally, such files, when passed to 'perf report' will produce:
$ oldperf report --stdio
WARNING: The perf.data file's data size field is 0 which is unexpected.
Was the 'perf record' command properly terminated?
Warning:
Kernel address maps (/proc/{kallsyms,modules}) were restricted.
Check /proc/sys/kernel/kptr_restrict before running 'perf record'.
As no suitable kallsyms nor vmlinux was found, kernel samples
can't be resolved.
Samples in kernel modules can't be resolved as well.
Error:
The perf.data file has no samples!
# To display the perf.data header info, please use --header/--header-only options.
#
$
Which is confusing and can be solved by just adding the kernel mmap record,
which will also remove that warning about the data size field being equal to
zero, after generating the mmap record:
$ perf stat record usleep 1
Performance counter stats for 'usleep 1':
0.600796 task-clock (msec) # 0.478 CPUs utilized
1 context-switches # 0.002 M/sec
0 cpu-migrations # 0.000 K/sec
54 page-faults # 0.090 M/sec
886,844 cycles # 1.476 GHz
582,169 stalled-cycles-frontend # 65.65% frontend cycles idle
<not supported> stalled-cycles-backend
638,344 instructions # 0.72 insns per cycle
# 0.91 stalled cycles per insn
130,204 branches # 216.719 M/sec
7,500 branch-misses # 5.76% of all branches
0.001255897 seconds time elapsed
$ oldperf evlist
task-clock
context-switches
cpu-migrations
page-faults
cycles
stalled-cycles-frontend
stalled-cycles-backend
instructions
branches
branch-misses
$ oldperf report --stdio
Error:
The perf.data file has no samples!
# To display the perf.data header info, please use --header/--header-only options.
#
[acme@zoo linux]$
No warnings, sensible output about what are the events in the perf.data file and also
a "file has no samples" message, which indeed it doesn't.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Kan Liang <kan.liang@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: htp://lkml.kernel.org/r/1446734469-11352-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-11-05 22:40:46 +08:00
|
|
|
record::
|
|
|
|
See STAT RECORD.
|
2009-06-04 22:33:00 +08:00
|
|
|
|
2015-11-05 22:40:55 +08:00
|
|
|
report::
|
|
|
|
See STAT REPORT.
|
|
|
|
|
2009-04-20 21:52:29 +08:00
|
|
|
-e::
|
|
|
|
--event=::
|
2015-01-08 09:13:53 +08:00
|
|
|
Select the PMU event. Selection can be:
|
|
|
|
|
|
|
|
- a symbolic event name (use 'perf list' to list all events)
|
|
|
|
|
|
|
|
- a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a
|
|
|
|
hexadecimal event descriptor.
|
|
|
|
|
|
|
|
- a symbolically formed event like 'pmu/param1=0x3,param2/' where
|
|
|
|
param1 and param2 are defined as formats for the PMU in
|
2017-08-24 21:20:22 +08:00
|
|
|
/sys/bus/event_source/devices/<pmu>/format/*
|
2015-01-08 09:13:53 +08:00
|
|
|
|
|
|
|
- a symbolically formed event like 'pmu/config=M,config1=N,config2=K/'
|
|
|
|
where M, N, K are numbers (in decimal, hex, octal format).
|
|
|
|
Acceptable values for each of 'config', 'config1' and 'config2'
|
|
|
|
parameters are defined by corresponding entries in
|
2017-08-24 21:20:22 +08:00
|
|
|
/sys/bus/event_source/devices/<pmu>/format/*
|
2009-04-20 21:52:29 +08:00
|
|
|
|
2018-03-06 22:04:42 +08:00
|
|
|
Note that the last two syntaxes support prefix and glob matching in
|
|
|
|
the PMU name to simplify creation of events accross multiple instances
|
|
|
|
of the same type of PMU in large systems (e.g. memory controller PMUs).
|
|
|
|
Multiple PMU instances are typical for uncore PMUs, so the prefix
|
|
|
|
'uncore_' is also ignored when performing this match.
|
|
|
|
|
|
|
|
|
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>::
|
2012-02-09 00:32:52 +08:00
|
|
|
stat events on existing process id (comma separated list)
|
2010-12-01 09:57:19 +08:00
|
|
|
|
|
|
|
-t::
|
|
|
|
--tid=<tid>::
|
2012-02-09 00:32:52 +08:00
|
|
|
stat events on existing thread id (comma separated list)
|
2010-12-01 09:57:19 +08:00
|
|
|
|
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::
|
perf stat: Add -a as default target
Boris asked for default -a option in case we monitor only uncore events.
While implementing that I thought it might be actually useful to make it
overall default.
Running 'perf stat' will now collect system wide data.
Committer note:
Testing it:
# perf stat
^C
Performance counter stats for 'system wide':
3571.559178 cpu-clock (msec) # 4.000 CPUs utilized
3,346 context-switches # 0.937 K/sec
277 cpu-migrations # 0.078 K/sec
57,271 page-faults # 0.016 M/sec
4,535,633,835 cycles # 1.270 GHz
6,389,736,516 instructions # 1.41 insn per cycle
1,541,293,875 branches # 431.547 M/sec
14,526,396 branch-misses # 0.94% of all branches
0.892950118 seconds time elapsed
#
Requested-and-Acked-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170217170034.GB15389@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2017-02-18 01:00:34 +08:00
|
|
|
system-wide collection from all CPUs (default if no target is specified)
|
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
|
|
|
|
|
2016-03-08 03:44:44 +08:00
|
|
|
-d::
|
|
|
|
--detailed::
|
|
|
|
print more detailed statistics, can be specified up to 3 times
|
|
|
|
|
|
|
|
-d: detailed events, L1 and LLC data cache
|
|
|
|
-d -d: more detailed events, dTLB and iTLB events
|
|
|
|
-d -d -d: very detailed events, adding prefetch events
|
|
|
|
|
2010-12-01 09:57:19 +08:00
|
|
|
-r::
|
|
|
|
--repeat=<n>::
|
2013-03-02 02:02:27 +08:00
|
|
|
repeat command and print average + stddev (max: 100). 0 means forever.
|
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::
|
perf stat: Correct --no-aggr description
Description of --no-aggr in perf-stat man page is outdated. --no-aggr
can also be used while profiling specific set of cpus. For ex,
$ perf stat -e cycles,instructions -C 1-2 --no-aggr -- sleep 1
Performance counter stats for 'CPU(s) 1-2':
CPU1 5,94,92,795 cycles
CPU2 2,69,72,403 cycles
CPU1 2,02,08,327 instructions # 0.34 insn per cycle
CPU2 73,17,123 instructions # 0.12 insn per cycle
1.000989132 seconds time elapsed
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1490013438-5713-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2017-03-20 20:37:18 +08:00
|
|
|
Do not aggregate counts across all monitored CPUs.
|
2010-11-16 17:05:01 +08:00
|
|
|
|
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)
|
|
|
|
|
perf stat: Add csv-style output
This patch adds an option (-x/--field-separator) to print counts using a
CSV-style output. The user can pass a custom separator. This makes it very easy
to import counts directly into your favorite spreadsheet without having to
write scripts.
Example:
$ perf stat --field-separator=, -a -- sleep 1
4009.961740,task-clock-msecs
13,context-switches
2,CPU-migrations
189,page-faults
9596385684,cycles
3493659441,instructions
872897069,branches
41562,branch-misses
22424,cache-references
1289,cache-misses
Works also in non-aggregated mode:
$ perf stat -x , -a -A -- sleep 1
CPU0,1002.526168,task-clock-msecs
CPU1,1002.528365,task-clock-msecs
CPU2,1002.523360,task-clock-msecs
CPU3,1002.519878,task-clock-msecs
CPU0,1,context-switches
CPU1,5,context-switches
CPU2,5,context-switches
CPU3,6,context-switches
CPU0,0,CPU-migrations
CPU1,1,CPU-migrations
CPU2,0,CPU-migrations
CPU3,1,CPU-migrations
CPU0,2,page-faults
CPU1,6,page-faults
CPU2,9,page-faults
CPU3,174,page-faults
CPU0,2399439771,cycles
CPU1,2380369063,cycles
CPU2,2399142710,cycles
CPU3,2373161192,cycles
CPU0,872900618,instructions
CPU1,873030960,instructions
CPU2,872714525,instructions
CPU3,874460580,instructions
CPU0,221556839,branches
CPU1,218134342,branches
CPU2,218161730,branches
CPU3,218284093,branches
CPU0,18556,branch-misses
CPU1,1449,branch-misses
CPU2,3447,branch-misses
CPU3,12714,branch-misses
CPU0,8330,cache-references
CPU1,313844,cache-references
CPU2,47993728,cache-references
CPU3,826481,cache-references
CPU0,272,cache-misses
CPU1,5360,cache-misses
CPU2,1342193,cache-misses
CPU3,13992,cache-misses
This second version adds the ability to name a separator and uses
field-separator as the long option to be consistent with perf report.
Commiter note: Since we enabled --big-num by default in 201e0b0 and -x can't be
used with it, we need to notice if the user explicitely enabled or disabled -B,
add code to disable big_num if the user didn't explicitely set --big_num when
-x is used.
Cc: David S. Miller <davem@davemloft.net>
Cc: Frederik Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: paulus@samba.org
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
LKML-Reference: <4cf68aa7.0fedd80a.5294.1203@mx.google.com>
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-12-02 00:49:05 +08:00
|
|
|
-x SEP::
|
|
|
|
--field-separator SEP::
|
|
|
|
print counts using a CSV-style output to make it easy to import directly into
|
|
|
|
spreadsheets. Columns are separated by the string specified in SEP.
|
|
|
|
|
perf tool: Add cgroup support
This patch adds the ability to filter monitoring based on container groups
(cgroups) for both perf stat and perf record. It is possible to monitor
multiple cgroup in parallel. There is one cgroup per event. The cgroups to
monitor are passed via a new -G option followed by a comma separated list of
cgroup names.
The cgroup filesystem has to be mounted. Given a cgroup name, the perf tool
finds the corresponding directory in the cgroup filesystem and opens it. It
then passes that file descriptor to the kernel.
Example:
$ perf stat -B -a -e cycles:u,cycles:u,cycles:u -G test1,,test2 -- sleep 1
Performance counter stats for 'sleep 1':
2,368,667,414 cycles test1
2,369,661,459 cycles
<not counted> cycles test2
1.001856890 seconds time elapsed
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <4d590290.825bdf0a.7d0a.4890@mx.google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2011-02-14 17:20:01 +08:00
|
|
|
-G name::
|
|
|
|
--cgroup name::
|
|
|
|
monitor only in the container (cgroup) called "name". This option is available only
|
|
|
|
in per-cpu mode. The cgroup filesystem must be mounted. All threads belonging to
|
|
|
|
container "name" are monitored when they run on the monitored CPUs. Multiple cgroups
|
|
|
|
can be provided. Each cgroup is applied to the corresponding event, i.e., first cgroup
|
|
|
|
to first event, second cgroup to second event and so on. It is possible to provide
|
|
|
|
an empty cgroup (monitor all the time) using, e.g., -G foo,,bar. Cgroups must have
|
|
|
|
corresponding events, i.e., they always refer to events defined earlier on the command
|
2018-01-29 23:48:09 +08:00
|
|
|
line. If the user wants to track multiple events for a specific cgroup, the user can
|
|
|
|
use '-e e1 -e e2 -G foo,foo' or just use '-e e1 -e e2 -G foo'.
|
|
|
|
|
|
|
|
If wanting to monitor, say, 'cycles' for a cgroup and also for system wide, this
|
|
|
|
command line can be used: 'perf stat -e cycles -G cgroup_name -a -e cycles'.
|
perf tool: Add cgroup support
This patch adds the ability to filter monitoring based on container groups
(cgroups) for both perf stat and perf record. It is possible to monitor
multiple cgroup in parallel. There is one cgroup per event. The cgroups to
monitor are passed via a new -G option followed by a comma separated list of
cgroup names.
The cgroup filesystem has to be mounted. Given a cgroup name, the perf tool
finds the corresponding directory in the cgroup filesystem and opens it. It
then passes that file descriptor to the kernel.
Example:
$ perf stat -B -a -e cycles:u,cycles:u,cycles:u -G test1,,test2 -- sleep 1
Performance counter stats for 'sleep 1':
2,368,667,414 cycles test1
2,369,661,459 cycles
<not counted> cycles test2
1.001856890 seconds time elapsed
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <4d590290.825bdf0a.7d0a.4890@mx.google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2011-02-14 17:20:01 +08:00
|
|
|
|
2011-08-16 04:22:33 +08:00
|
|
|
-o file::
|
2011-09-08 07:14:00 +08:00
|
|
|
--output file::
|
2011-08-16 04:22:33 +08:00
|
|
|
Print the output into the designated file.
|
|
|
|
|
|
|
|
--append::
|
|
|
|
Append to the output file designated with the -o option. Ignored if -o is not specified.
|
|
|
|
|
2011-09-08 07:14:00 +08:00
|
|
|
--log-fd::
|
|
|
|
|
|
|
|
Log output to fd, instead of stderr. Complementary to --output, and mutually exclusive
|
|
|
|
with it. --append may be used here. Examples:
|
|
|
|
3>results perf stat --log-fd 3 -- $cmd
|
|
|
|
3>>results perf stat --log-fd 3 --append -- $cmd
|
|
|
|
|
2012-10-23 19:40:14 +08:00
|
|
|
--pre::
|
|
|
|
--post::
|
|
|
|
Pre and post measurement hooks, e.g.:
|
|
|
|
|
|
|
|
perf stat --repeat 10 --null --sync --pre 'make -s O=defconfig-build/clean' -- make -s -j64 O=defconfig-build/ bzImage
|
2011-09-08 07:14:00 +08:00
|
|
|
|
perf stat: Add interval printing
This patch adds a new printing mode for perf stat. It allows interval
printing. That means perf stat can now print event deltas at regular
time interval. This is useful to detect phases in programs.
The -I option enables interval printing. It expects an interval duration
in milliseconds. Minimum is 100ms. Once, activated perf stat prints
events deltas since last printout. All modes are supported.
$ perf stat -I 1000 -e cycles noploop 10
noploop for 10 seconds
# time counts events
1.000109853 2,388,560,546 cycles
2.000262846 2,393,332,358 cycles
3.000354131 2,393,176,537 cycles
4.000439503 2,393,203,790 cycles
5.000527075 2,393,167,675 cycles
6.000609052 2,393,203,670 cycles
7.000691082 2,393,175,678 cycles
The output format makes it easy to feed into a plotting program such as
gnuplot when the -I option is used in combination with the -x option:
$ perf stat -x, -I 1000 -e cycles noploop 10
noploop for 10 seconds
1.000084113,2378775498,cycles
2.000245798,2391056897,cycles
3.000354445,2392089414,cycles
4.000459115,2390936603,cycles
5.000565341,2392108173,cycles
Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1359460064-3060-3-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-01-29 19:47:44 +08:00
|
|
|
-I msecs::
|
|
|
|
--interval-print msecs::
|
2018-04-04 02:18:33 +08:00
|
|
|
Print count deltas every N milliseconds (minimum: 1ms)
|
2015-10-02 17:04:34 +08:00
|
|
|
The overhead percentage could be high in some cases, for instance with small, sub 100ms intervals. Use with caution.
|
|
|
|
example: 'perf stat -I 1000 -e cycles -a sleep 5'
|
2011-09-08 07:14:00 +08:00
|
|
|
|
2018-01-29 17:25:22 +08:00
|
|
|
--interval-count times::
|
|
|
|
Print count deltas for fixed number of times.
|
|
|
|
This option should be used together with "-I" option.
|
|
|
|
example: 'perf stat -I 1000 --interval-count 2 -e cycles -a'
|
|
|
|
|
2018-01-29 17:25:23 +08:00
|
|
|
--timeout msecs::
|
|
|
|
Stop the 'perf stat' session and print count deltas after N milliseconds (minimum: 10 ms).
|
|
|
|
This option is not supported with the "-I" option.
|
|
|
|
example: 'perf stat --time 2000 -e cycles -a'
|
|
|
|
|
2016-03-04 07:57:36 +08:00
|
|
|
--metric-only::
|
|
|
|
Only print computed metrics. Print them in a single line.
|
2016-03-04 07:57:37 +08:00
|
|
|
Don't show any raw values. Not supported with --per-thread.
|
2016-03-04 07:57:36 +08:00
|
|
|
|
2013-02-14 20:57:28 +08:00
|
|
|
--per-socket::
|
2013-02-06 22:46:02 +08:00
|
|
|
Aggregate counts per processor socket for system-wide mode measurements. This
|
|
|
|
is a useful mode to detect imbalance between sockets. To enable this mode,
|
2013-02-14 20:57:28 +08:00
|
|
|
use --per-socket in addition to -a. (system-wide). The output includes the
|
2013-02-06 22:46:02 +08:00
|
|
|
socket number and the number of online processors on that socket. This is
|
|
|
|
useful to gauge the amount of aggregation.
|
|
|
|
|
2013-02-14 20:57:29 +08:00
|
|
|
--per-core::
|
|
|
|
Aggregate counts per physical processor for system-wide mode measurements. This
|
|
|
|
is a useful mode to detect imbalance between physical cores. To enable this mode,
|
|
|
|
use --per-core in addition to -a. (system-wide). The output includes the
|
|
|
|
core number and the number of online logical processors on that physical processor.
|
|
|
|
|
perf stat: Introduce --per-thread option
Currently all the -p option PID arguments tasks values get aggregated
and printed as single values.
Adding --per-tasks option to print values per task.
$ perf stat -e cycles,instructions --per-thread -p 30190,30242
^C
Performance counter stats for process id '30190,30242':
cat-30190 0 cycles
yes-30242 3,842,525,421 cycles
cat-30190 0 instructions
yes-30242 10,370,817,010 instructions
1.143155657 seconds time elapsed
Also works under interval mode:
$ perf stat -e cycles,instructions --per-thread -p 30190,30242 -I 1000
# time comm-pid counts unit events
1.000073435 cat-30190 89,058 cycles
1.000073435 yes-30242 3,360,786,902 cycles (100.00%)
1.000073435 cat-30190 14,066 instructions
1.000073435 yes-30242 9,069,937,462 instructions
2.000204830 cat-30190 0 cycles
2.000204830 yes-30242 3,351,667,626 cycles
2.000204830 cat-30190 0 instructions
2.000204830 yes-30242 9,045,796,885 instructions
^C 2.771286639 cat-30190 0 cycles
2.771286639 yes-30242 2,593,884,166 cycles
2.771286639 cat-30190 0 instructions
2.771286639 yes-30242 7,001,171,191 instructions
It works only with -t and -p options, otherwise following error is
printed:
$ perf stat -e cycles --per-thread -I 1000 ls
The --per-thread option is only available when monitoring via -p -t options.
-p, --pid <pid> stat events on existing process id
-t, --tid <tid> stat events on existing thread id
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1435310967-14570-23-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-06-26 17:29:27 +08:00
|
|
|
--per-thread::
|
|
|
|
Aggregate counts per monitored threads, when monitoring threads (-t option)
|
|
|
|
or processes (-p option).
|
|
|
|
|
2013-08-03 08:41:11 +08:00
|
|
|
-D msecs::
|
2014-01-08 06:14:06 +08:00
|
|
|
--delay msecs::
|
2013-08-03 08:41:11 +08:00
|
|
|
After starting the program, wait msecs before measuring. This is useful to
|
|
|
|
filter out the startup phase of the program, which is often very different.
|
|
|
|
|
2013-08-22 07:47:26 +08:00
|
|
|
-T::
|
|
|
|
--transaction::
|
|
|
|
|
|
|
|
Print statistics of transactional execution if supported.
|
|
|
|
|
perf stat record: Add record command
Add 'perf stat record' command support. It creates simple (header only)
perf.data file ATM.
The record command could be specified anywhere among stat options. All
stat command options are valid for stat record command with '-o' option
exception. If specified for record command it denotes the perf data file
name.
Committer note:
Set sample_type to PERF_SAMPLE_IDENTIFIER, which should be harmless
while avoiding that older tools show confusing messages, for instance,
with sample_type = 0, we get:
$ perf stat record usleep 1
Performance counter stats for 'usleep 1':
0.630237 task-clock (msec) # 0.528 CPUs utilized
1 context-switches # 0.002 M/sec
0 cpu-migrations # 0.000 K/sec
52 page-faults # 0.083 M/sec
978,312 cycles # 1.552 GHz
671,931 stalled-cycles-frontend # 68.68% frontend cycles idle
<not supported> stalled-cycles-backend
646,379 instructions # 0.66 insns per cycle
# 1.04 stalled cycles per insn
131,046 branches # 207.931 M/sec
7,073 branch-misses # 5.40% of all branches
0.001193240 seconds time elapsed
$ oldperf evlist
WARNING: The perf.data file's data size field is 0 which is unexpected.
Was the 'perf record' command properly terminated?
non matching sample_type
$
While with sample_type set to PERF_SAMPLE_IDENTIFIER, after we re-run 'perf
stat record usleep' we get:
$ oldperf evlist
WARNING: The perf.data file's data size field is 0 which is unexpected.
Was the 'perf record' command properly terminated?
task-clock
context-switches
cpu-migrations
page-faults
cycles
stalled-cycles-frontend
stalled-cycles-backend
instructions
branches
branch-misses
$
Which at least shows the names of the events in the perf.data file.
Additionally, such files, when passed to 'perf report' will produce:
$ oldperf report --stdio
WARNING: The perf.data file's data size field is 0 which is unexpected.
Was the 'perf record' command properly terminated?
Warning:
Kernel address maps (/proc/{kallsyms,modules}) were restricted.
Check /proc/sys/kernel/kptr_restrict before running 'perf record'.
As no suitable kallsyms nor vmlinux was found, kernel samples
can't be resolved.
Samples in kernel modules can't be resolved as well.
Error:
The perf.data file has no samples!
# To display the perf.data header info, please use --header/--header-only options.
#
$
Which is confusing and can be solved by just adding the kernel mmap record,
which will also remove that warning about the data size field being equal to
zero, after generating the mmap record:
$ perf stat record usleep 1
Performance counter stats for 'usleep 1':
0.600796 task-clock (msec) # 0.478 CPUs utilized
1 context-switches # 0.002 M/sec
0 cpu-migrations # 0.000 K/sec
54 page-faults # 0.090 M/sec
886,844 cycles # 1.476 GHz
582,169 stalled-cycles-frontend # 65.65% frontend cycles idle
<not supported> stalled-cycles-backend
638,344 instructions # 0.72 insns per cycle
# 0.91 stalled cycles per insn
130,204 branches # 216.719 M/sec
7,500 branch-misses # 5.76% of all branches
0.001255897 seconds time elapsed
$ oldperf evlist
task-clock
context-switches
cpu-migrations
page-faults
cycles
stalled-cycles-frontend
stalled-cycles-backend
instructions
branches
branch-misses
$ oldperf report --stdio
Error:
The perf.data file has no samples!
# To display the perf.data header info, please use --header/--header-only options.
#
[acme@zoo linux]$
No warnings, sensible output about what are the events in the perf.data file and also
a "file has no samples" message, which indeed it doesn't.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Kan Liang <kan.liang@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: htp://lkml.kernel.org/r/1446734469-11352-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-11-05 22:40:46 +08:00
|
|
|
STAT RECORD
|
|
|
|
-----------
|
|
|
|
Stores stat data into perf data file.
|
|
|
|
|
|
|
|
-o file::
|
|
|
|
--output file::
|
|
|
|
Output file name.
|
|
|
|
|
2015-11-05 22:40:55 +08:00
|
|
|
STAT REPORT
|
|
|
|
-----------
|
|
|
|
Reads and reports stat data from perf data file.
|
|
|
|
|
|
|
|
-i file::
|
|
|
|
--input file::
|
|
|
|
Input file name.
|
|
|
|
|
2015-11-05 22:41:02 +08:00
|
|
|
--per-socket::
|
|
|
|
Aggregate counts per processor socket for system-wide mode measurements.
|
|
|
|
|
|
|
|
--per-core::
|
|
|
|
Aggregate counts per physical processor for system-wide mode measurements.
|
|
|
|
|
2017-09-01 03:40:31 +08:00
|
|
|
-M::
|
|
|
|
--metrics::
|
|
|
|
Print metrics or metricgroups specified in a comma separated list.
|
|
|
|
For a group all metrics from the group are added.
|
|
|
|
The events from the metrics are automatically measured.
|
|
|
|
See perf list output for the possble metrics and metricgroups.
|
|
|
|
|
2015-11-05 22:41:02 +08:00
|
|
|
-A::
|
|
|
|
--no-aggr::
|
|
|
|
Do not aggregate counts across all monitored CPUs.
|
|
|
|
|
perf stat: Basic support for TopDown in perf stat
Add basic plumbing for TopDown in perf stat
TopDown is intended to replace the frontend cycles idle/ backend cycles
idle metrics in standard perf stat output. These metrics are not
reliable in many workloads, due to out of order effects.
This implements a new --topdown mode in perf stat (similar to
--transaction) that measures the pipe line bottlenecks using
standardized formulas. The measurement can be all done with 5 counters
(one fixed counter)
The result are four metrics:
FrontendBound, BackendBound, BadSpeculation, Retiring
that describe the CPU pipeline behavior on a high level.
The full top down methology has many hierarchical metrics. This
implementation only supports level 1 which can be collected without
multiplexing. A full implementation of top down on top of perf is
available in pmu-tools toplev. (http://github.com/andikleen/pmu-tools)
The current version works on Intel Core CPUs starting with Sandy Bridge,
and Atom CPUs starting with Silvermont. In principle the generic
metrics should be also implementable on other out of order CPUs.
TopDown level 1 uses a set of abstracted metrics which are generic to
out of order CPU cores (although some CPUs may not implement all of
them):
topdown-total-slots Available slots in the pipeline
topdown-slots-issued Slots issued into the pipeline
topdown-slots-retired Slots successfully retired
topdown-fetch-bubbles Pipeline gaps in the frontend
topdown-recovery-bubbles Pipeline gaps during recovery
from misspeculation
These metrics then allow to compute four useful metrics:
FrontendBound, BackendBound, Retiring, BadSpeculation.
Add a new --topdown options to enable events. When --topdown is
specified set up events for all topdown events supported by the kernel.
Add topdown-* as a special case to the event parser, as is needed for
all events containing -.
The actual code to compute the metrics is in follow-on patches.
v2: Use standard sysctl read function.
v3: Move x86 specific code to arch/
v4: Enable --metric-only implicitly for topdown.
v5: Add --single-thread option to not force per core mode
v6: Fix output order of topdown metrics
v7: Allow combining with -d
v8: Remove --single-thread again
v9: Rename functions, adding arch_ and topdown_.
v10: Expand man page and describe TopDown better
Paste intro into commit description.
Print error when malloc fails.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/1464119559-17203-1-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-05-30 23:49:42 +08:00
|
|
|
--topdown::
|
|
|
|
Print top down level 1 metrics if supported by the CPU. This allows to
|
|
|
|
determine bottle necks in the CPU pipeline for CPU bound workloads,
|
|
|
|
by breaking the cycles consumed down into frontend bound, backend bound,
|
|
|
|
bad speculation and retiring.
|
|
|
|
|
|
|
|
Frontend bound means that the CPU cannot fetch and decode instructions fast
|
|
|
|
enough. Backend bound means that computation or memory access is the bottle
|
|
|
|
neck. Bad Speculation means that the CPU wasted cycles due to branch
|
|
|
|
mispredictions and similar issues. Retiring means that the CPU computed without
|
|
|
|
an apparently bottleneck. The bottleneck is only the real bottleneck
|
|
|
|
if the workload is actually bound by the CPU and not by something else.
|
|
|
|
|
|
|
|
For best results it is usually a good idea to use it with interval
|
|
|
|
mode like -I 1000, as the bottleneck of workloads can change often.
|
|
|
|
|
|
|
|
The top down metrics are collected per core instead of per
|
|
|
|
CPU thread. Per core mode is automatically enabled
|
|
|
|
and -a (global monitoring) is needed, requiring root rights or
|
|
|
|
perf.perf_event_paranoid=-1.
|
|
|
|
|
|
|
|
Topdown uses the full Performance Monitoring Unit, and needs
|
|
|
|
disabling of the NMI watchdog (as root):
|
|
|
|
echo 0 > /proc/sys/kernel/nmi_watchdog
|
|
|
|
for best results. Otherwise the bottlenecks may be inconsistent
|
|
|
|
on workload with changing phases.
|
|
|
|
|
|
|
|
This enables --metric-only, unless overriden with --no-metric-only.
|
|
|
|
|
|
|
|
To interpret the results it is usually needed to know on which
|
|
|
|
CPUs the workload runs on. If needed the CPUs can be forced using
|
|
|
|
taskset.
|
perf stat record: Add record command
Add 'perf stat record' command support. It creates simple (header only)
perf.data file ATM.
The record command could be specified anywhere among stat options. All
stat command options are valid for stat record command with '-o' option
exception. If specified for record command it denotes the perf data file
name.
Committer note:
Set sample_type to PERF_SAMPLE_IDENTIFIER, which should be harmless
while avoiding that older tools show confusing messages, for instance,
with sample_type = 0, we get:
$ perf stat record usleep 1
Performance counter stats for 'usleep 1':
0.630237 task-clock (msec) # 0.528 CPUs utilized
1 context-switches # 0.002 M/sec
0 cpu-migrations # 0.000 K/sec
52 page-faults # 0.083 M/sec
978,312 cycles # 1.552 GHz
671,931 stalled-cycles-frontend # 68.68% frontend cycles idle
<not supported> stalled-cycles-backend
646,379 instructions # 0.66 insns per cycle
# 1.04 stalled cycles per insn
131,046 branches # 207.931 M/sec
7,073 branch-misses # 5.40% of all branches
0.001193240 seconds time elapsed
$ oldperf evlist
WARNING: The perf.data file's data size field is 0 which is unexpected.
Was the 'perf record' command properly terminated?
non matching sample_type
$
While with sample_type set to PERF_SAMPLE_IDENTIFIER, after we re-run 'perf
stat record usleep' we get:
$ oldperf evlist
WARNING: The perf.data file's data size field is 0 which is unexpected.
Was the 'perf record' command properly terminated?
task-clock
context-switches
cpu-migrations
page-faults
cycles
stalled-cycles-frontend
stalled-cycles-backend
instructions
branches
branch-misses
$
Which at least shows the names of the events in the perf.data file.
Additionally, such files, when passed to 'perf report' will produce:
$ oldperf report --stdio
WARNING: The perf.data file's data size field is 0 which is unexpected.
Was the 'perf record' command properly terminated?
Warning:
Kernel address maps (/proc/{kallsyms,modules}) were restricted.
Check /proc/sys/kernel/kptr_restrict before running 'perf record'.
As no suitable kallsyms nor vmlinux was found, kernel samples
can't be resolved.
Samples in kernel modules can't be resolved as well.
Error:
The perf.data file has no samples!
# To display the perf.data header info, please use --header/--header-only options.
#
$
Which is confusing and can be solved by just adding the kernel mmap record,
which will also remove that warning about the data size field being equal to
zero, after generating the mmap record:
$ perf stat record usleep 1
Performance counter stats for 'usleep 1':
0.600796 task-clock (msec) # 0.478 CPUs utilized
1 context-switches # 0.002 M/sec
0 cpu-migrations # 0.000 K/sec
54 page-faults # 0.090 M/sec
886,844 cycles # 1.476 GHz
582,169 stalled-cycles-frontend # 65.65% frontend cycles idle
<not supported> stalled-cycles-backend
638,344 instructions # 0.72 insns per cycle
# 0.91 stalled cycles per insn
130,204 branches # 216.719 M/sec
7,500 branch-misses # 5.76% of all branches
0.001255897 seconds time elapsed
$ oldperf evlist
task-clock
context-switches
cpu-migrations
page-faults
cycles
stalled-cycles-frontend
stalled-cycles-backend
instructions
branches
branch-misses
$ oldperf report --stdio
Error:
The perf.data file has no samples!
# To display the perf.data header info, please use --header/--header-only options.
#
[acme@zoo linux]$
No warnings, sensible output about what are the events in the perf.data file and also
a "file has no samples" message, which indeed it doesn't.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Kan Liang <kan.liang@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: htp://lkml.kernel.org/r/1446734469-11352-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-11-05 22:40:46 +08:00
|
|
|
|
perf stat: Collapse identically named events
The uncore PMU has a lot of duplicated PMUs for different subsystems.
When expanding an uncore alias we usually end up with a large
number of identically named aliases, which makes perf stat
output difficult to read.
Automatically sum them up in perf stat, unless --no-merge is specified.
This can be default because only the uncores generally have duplicated
aliases. Other PMUs have unique names.
Before:
% perf stat --no-merge -a -e unc_c_llc_lookup.any sleep 1
Performance counter stats for 'system wide':
694,976 Bytes unc_c_llc_lookup.any
706,304 Bytes unc_c_llc_lookup.any
956,608 Bytes unc_c_llc_lookup.any
782,720 Bytes unc_c_llc_lookup.any
605,696 Bytes unc_c_llc_lookup.any
442,816 Bytes unc_c_llc_lookup.any
659,328 Bytes unc_c_llc_lookup.any
509,312 Bytes unc_c_llc_lookup.any
263,936 Bytes unc_c_llc_lookup.any
592,448 Bytes unc_c_llc_lookup.any
672,448 Bytes unc_c_llc_lookup.any
608,640 Bytes unc_c_llc_lookup.any
641,024 Bytes unc_c_llc_lookup.any
856,896 Bytes unc_c_llc_lookup.any
808,832 Bytes unc_c_llc_lookup.any
684,864 Bytes unc_c_llc_lookup.any
710,464 Bytes unc_c_llc_lookup.any
538,304 Bytes unc_c_llc_lookup.any
1.002577660 seconds time elapsed
After:
% perf stat -a -e unc_c_llc_lookup.any sleep 1
Performance counter stats for 'system wide':
2,685,120 Bytes unc_c_llc_lookup.any
1.002648032 seconds time elapsed
v2: Split collect_aliases. Rename alias flag.
v3: Make sure unsupported/not counted is always printed.
v4: Factor out callback change into separate patch.
v5: Move check for bad results here
Move merged check into collect_data
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20170320201711.14142-3-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2017-03-21 04:17:00 +08:00
|
|
|
--no-merge::
|
|
|
|
Do not merge results from same PMUs.
|
|
|
|
|
2018-03-06 22:04:44 +08:00
|
|
|
When multiple events are created from a single event specification,
|
|
|
|
stat will, by default, aggregate the event counts and show the result
|
|
|
|
in a single row. This option disables that behavior and shows
|
|
|
|
the individual events and counts.
|
|
|
|
|
|
|
|
Multiple events are created from a single event specification when:
|
|
|
|
1. Prefix or glob matching is used for the PMU name.
|
|
|
|
2. Aliases, which are listed immediately after the Kernel PMU events
|
|
|
|
by perf list, are used.
|
2018-03-06 22:04:42 +08:00
|
|
|
|
2017-05-27 03:05:38 +08:00
|
|
|
--smi-cost::
|
|
|
|
Measure SMI cost if msr/aperf/ and msr/smi/ events are supported.
|
|
|
|
|
|
|
|
During the measurement, the /sys/device/cpu/freeze_on_smi will be set to
|
|
|
|
freeze core counters on SMI.
|
|
|
|
The aperf counter will not be effected by the setting.
|
|
|
|
The cost of SMI can be measured by (aperf - unhalted core cycles).
|
|
|
|
|
|
|
|
In practice, the percentages of SMI cycles is very useful for performance
|
|
|
|
oriented analysis. --metric_only will be applied by default.
|
|
|
|
The output is SMI cycles%, equals to (aperf - unhalted core cycles) / aperf
|
|
|
|
|
|
|
|
Users who wants to get the actual value can apply --no-metric-only.
|
|
|
|
|
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
|
|
|
|
2016-03-04 07:57:35 +08:00
|
|
|
CSV FORMAT
|
|
|
|
----------
|
|
|
|
|
|
|
|
With -x, perf stat is able to output a not-quite-CSV format output
|
|
|
|
Commas in the output are not put into "". To make it easy to parse
|
|
|
|
it is recommended to use a different character like -x \;
|
|
|
|
|
|
|
|
The fields are in this order:
|
|
|
|
|
|
|
|
- optional usec time stamp in fractions of second (with -I xxx)
|
|
|
|
- optional CPU, core, or socket identifier
|
|
|
|
- optional number of logical CPUs aggregated
|
|
|
|
- counter value
|
|
|
|
- unit of the counter value or empty
|
|
|
|
- event name
|
|
|
|
- run time of counter
|
|
|
|
- percentage of measurement time the counter was running
|
|
|
|
- optional variance if multiple values are collected with -r
|
|
|
|
- optional metric value
|
|
|
|
- optional unit of metric
|
|
|
|
|
|
|
|
Additional metrics may be printed with all earlier fields being empty.
|
|
|
|
|
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]
|