mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 17:41:44 +00:00
d7470b6afc
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>
107 lines
2.5 KiB
Plaintext
107 lines
2.5 KiB
Plaintext
perf-stat(1)
|
|
============
|
|
|
|
NAME
|
|
----
|
|
perf-stat - Run a command and gather performance counter statistics
|
|
|
|
SYNOPSIS
|
|
--------
|
|
[verse]
|
|
'perf stat' [-e <EVENT> | --event=EVENT] [-a] <command>
|
|
'perf stat' [-e <EVENT> | --event=EVENT] [-a] -- <command> [<options>]
|
|
|
|
DESCRIPTION
|
|
-----------
|
|
This command runs a command and gathers performance counter statistics
|
|
from it.
|
|
|
|
|
|
OPTIONS
|
|
-------
|
|
<command>...::
|
|
Any command you can specify in a shell.
|
|
|
|
|
|
-e::
|
|
--event=::
|
|
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.
|
|
|
|
-i::
|
|
--no-inherit::
|
|
child tasks do not inherit counters
|
|
-p::
|
|
--pid=<pid>::
|
|
stat events on existing process id
|
|
|
|
-t::
|
|
--tid=<tid>::
|
|
stat events on existing thread id
|
|
|
|
|
|
-a::
|
|
--all-cpus::
|
|
system-wide collection from all CPUs
|
|
|
|
-c::
|
|
--scale::
|
|
scale/normalize counter values
|
|
|
|
-r::
|
|
--repeat=<n>::
|
|
repeat command and print average + stddev (max: 100)
|
|
|
|
-B::
|
|
--big-num::
|
|
print large numbers with thousands' separators according to locale
|
|
|
|
-C::
|
|
--cpu=::
|
|
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.
|
|
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.
|
|
|
|
-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.
|
|
|
|
-n::
|
|
--null::
|
|
null run - don't start any counters
|
|
|
|
-v::
|
|
--verbose::
|
|
be more verbose (show counter open errors, etc)
|
|
|
|
-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.
|
|
|
|
EXAMPLES
|
|
--------
|
|
|
|
$ perf stat -- make -j
|
|
|
|
Performance counter stats for 'make -j':
|
|
|
|
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
|
|
|
|
Wall-clock time elapsed: 719.554352 msecs
|
|
|
|
SEE ALSO
|
|
--------
|
|
linkperf:perf-top[1], linkperf:perf-list[1]
|