Path: blob/master/tools/perf/Documentation/perf-stat.txt
10821 views
perf-stat(1)1============23NAME4----5perf-stat - Run a command and gather performance counter statistics67SYNOPSIS8--------9[verse]10'perf stat' [-e <EVENT> | --event=EVENT] [-a] <command>11'perf stat' [-e <EVENT> | --event=EVENT] [-a] -- <command> [<options>]1213DESCRIPTION14-----------15This command runs a command and gathers performance counter statistics16from it.171819OPTIONS20-------21<command>...::22Any command you can specify in a shell.232425-e::26--event=::27Select the PMU event. Selection can be a symbolic event name28(use 'perf list' to list all events) or a raw PMU29event (eventsel+umask) in the form of rNNN where NNN is a30hexadecimal event descriptor.3132-i::33--no-inherit::34child tasks do not inherit counters35-p::36--pid=<pid>::37stat events on existing process id3839-t::40--tid=<tid>::41stat events on existing thread id424344-a::45--all-cpus::46system-wide collection from all CPUs4748-c::49--scale::50scale/normalize counter values5152-r::53--repeat=<n>::54repeat command and print average + stddev (max: 100)5556-B::57--big-num::58print large numbers with thousands' separators according to locale5960-C::61--cpu=::62Count only on the list of CPUs provided. Multiple CPUs can be provided as a63comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2.64In per-thread mode, this option is ignored. The -a option is still necessary65to activate system-wide monitoring. Default is to count on all CPUs.6667-A::68--no-aggr::69Do not aggregate counts across all monitored CPUs in system-wide mode (-a).70This option is only valid in system-wide mode.7172-n::73--null::74null run - don't start any counters7576-v::77--verbose::78be more verbose (show counter open errors, etc)7980-x SEP::81--field-separator SEP::82print counts using a CSV-style output to make it easy to import directly into83spreadsheets. Columns are separated by the string specified in SEP.8485-G name::86--cgroup name::87monitor only in the container (cgroup) called "name". This option is available only88in per-cpu mode. The cgroup filesystem must be mounted. All threads belonging to89container "name" are monitored when they run on the monitored CPUs. Multiple cgroups90can be provided. Each cgroup is applied to the corresponding event, i.e., first cgroup91to first event, second cgroup to second event and so on. It is possible to provide92an empty cgroup (monitor all the time) using, e.g., -G foo,,bar. Cgroups must have93corresponding events, i.e., they always refer to events defined earlier on the command94line.9596EXAMPLES97--------9899$ perf stat -- make -j100101Performance counter stats for 'make -j':1021038117.370256 task clock ticks # 11.281 CPU utilization factor104678 context switches # 0.000 M/sec105133 CPU migrations # 0.000 M/sec106235724 pagefaults # 0.029 M/sec10724821162526 CPU cycles # 3057.784 M/sec10818687303457 instructions # 2302.138 M/sec109172158895 cache references # 21.209 M/sec11027075259 cache misses # 3.335 M/sec111112Wall-clock time elapsed: 719.554352 msecs113114SEE ALSO115--------116linkperf:perf-top[1], linkperf:perf-list[1]117118119