perf-stat.txt 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. perf-stat(1)
  2. ============
  3. NAME
  4. ----
  5. perf-stat - Run a command and gather performance counter statistics
  6. SYNOPSIS
  7. --------
  8. [verse]
  9. 'perf stat' [-e <EVENT> | --event=EVENT] [-a] <command>
  10. 'perf stat' [-e <EVENT> | --event=EVENT] [-a] -- <command> [<options>]
  11. DESCRIPTION
  12. -----------
  13. This command runs a command and gathers performance counter statistics
  14. from it.
  15. OPTIONS
  16. -------
  17. <command>...::
  18. Any command you can specify in a shell.
  19. -e::
  20. --event=::
  21. Select the PMU event. Selection can be a symbolic event name
  22. (use 'perf list' to list all events) or a raw PMU
  23. event (eventsel+umask) in the form of rNNN where NNN is a
  24. hexadecimal event descriptor.
  25. -i::
  26. --no-inherit::
  27. child tasks do not inherit counters
  28. -p::
  29. --pid=<pid>::
  30. stat events on existing process id (comma separated list)
  31. -t::
  32. --tid=<tid>::
  33. stat events on existing thread id (comma separated list)
  34. -a::
  35. --all-cpus::
  36. system-wide collection from all CPUs
  37. -c::
  38. --scale::
  39. scale/normalize counter values
  40. -r::
  41. --repeat=<n>::
  42. repeat command and print average + stddev (max: 100)
  43. -B::
  44. --big-num::
  45. print large numbers with thousands' separators according to locale
  46. -C::
  47. --cpu=::
  48. Count only on the list of CPUs provided. Multiple CPUs can be provided as a
  49. comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2.
  50. In per-thread mode, this option is ignored. The -a option is still necessary
  51. to activate system-wide monitoring. Default is to count on all CPUs.
  52. -A::
  53. --no-aggr::
  54. Do not aggregate counts across all monitored CPUs in system-wide mode (-a).
  55. This option is only valid in system-wide mode.
  56. -n::
  57. --null::
  58. null run - don't start any counters
  59. -v::
  60. --verbose::
  61. be more verbose (show counter open errors, etc)
  62. -x SEP::
  63. --field-separator SEP::
  64. print counts using a CSV-style output to make it easy to import directly into
  65. spreadsheets. Columns are separated by the string specified in SEP.
  66. -G name::
  67. --cgroup name::
  68. monitor only in the container (cgroup) called "name". This option is available only
  69. in per-cpu mode. The cgroup filesystem must be mounted. All threads belonging to
  70. container "name" are monitored when they run on the monitored CPUs. Multiple cgroups
  71. can be provided. Each cgroup is applied to the corresponding event, i.e., first cgroup
  72. to first event, second cgroup to second event and so on. It is possible to provide
  73. an empty cgroup (monitor all the time) using, e.g., -G foo,,bar. Cgroups must have
  74. corresponding events, i.e., they always refer to events defined earlier on the command
  75. line.
  76. -o file::
  77. --output file::
  78. Print the output into the designated file.
  79. --append::
  80. Append to the output file designated with the -o option. Ignored if -o is not specified.
  81. --log-fd::
  82. Log output to fd, instead of stderr. Complementary to --output, and mutually exclusive
  83. with it. --append may be used here. Examples:
  84. 3>results perf stat --log-fd 3 -- $cmd
  85. 3>>results perf stat --log-fd 3 --append -- $cmd
  86. EXAMPLES
  87. --------
  88. $ perf stat -- make -j
  89. Performance counter stats for 'make -j':
  90. 8117.370256 task clock ticks # 11.281 CPU utilization factor
  91. 678 context switches # 0.000 M/sec
  92. 133 CPU migrations # 0.000 M/sec
  93. 235724 pagefaults # 0.029 M/sec
  94. 24821162526 CPU cycles # 3057.784 M/sec
  95. 18687303457 instructions # 2302.138 M/sec
  96. 172158895 cache references # 21.209 M/sec
  97. 27075259 cache misses # 3.335 M/sec
  98. Wall-clock time elapsed: 719.554352 msecs
  99. SEE ALSO
  100. --------
  101. linkperf:perf-top[1], linkperf:perf-list[1]