perf-record.txt 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. perf-record(1)
  2. ==============
  3. NAME
  4. ----
  5. perf-record - Run a command and record its profile into perf.data
  6. SYNOPSIS
  7. --------
  8. [verse]
  9. 'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] <command>
  10. 'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] -- <command> [<options>]
  11. DESCRIPTION
  12. -----------
  13. This command runs a command and gathers a performance counter profile
  14. from it, into perf.data - without displaying anything.
  15. This file can then be inspected later on, using 'perf report'.
  16. OPTIONS
  17. -------
  18. <command>...::
  19. Any command you can specify in a shell.
  20. -e::
  21. --event=::
  22. Select the PMU event. Selection can be:
  23. - a symbolic event name (use 'perf list' to list all events)
  24. - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a
  25. hexadecimal event descriptor.
  26. - a hardware breakpoint event in the form of '\mem:addr[:access]'
  27. where addr is the address in memory you want to break in.
  28. Access is the memory access type (read, write, execute) it can
  29. be passed as follows: '\mem:addr[:[r][w][x]]'.
  30. If you want to profile read-write accesses in 0x1000, just set
  31. 'mem:0x1000:rw'.
  32. --filter=<filter>::
  33. Event filter.
  34. -a::
  35. --all-cpus::
  36. System-wide collection from all CPUs.
  37. -l::
  38. Scale counter values.
  39. -p::
  40. --pid=::
  41. Record events on existing process ID (comma separated list).
  42. -t::
  43. --tid=::
  44. Record events on existing thread ID (comma separated list).
  45. -u::
  46. --uid=::
  47. Record events in threads owned by uid. Name or number.
  48. -r::
  49. --realtime=::
  50. Collect data with this RT SCHED_FIFO priority.
  51. -D::
  52. --no-delay::
  53. Collect data without buffering.
  54. -c::
  55. --count=::
  56. Event period to sample.
  57. -o::
  58. --output=::
  59. Output file name.
  60. -i::
  61. --no-inherit::
  62. Child tasks do not inherit counters.
  63. -F::
  64. --freq=::
  65. Profile at this frequency.
  66. -m::
  67. --mmap-pages=::
  68. Number of mmap data pages. Must be a power of two.
  69. -g::
  70. --call-graph::
  71. Do call-graph (stack chain/backtrace) recording.
  72. -q::
  73. --quiet::
  74. Don't print any message, useful for scripting.
  75. -v::
  76. --verbose::
  77. Be more verbose (show counter open errors, etc).
  78. -s::
  79. --stat::
  80. Per thread counts.
  81. -d::
  82. --data::
  83. Sample addresses.
  84. -T::
  85. --timestamp::
  86. Sample timestamps. Use it with 'perf report -D' to see the timestamps,
  87. for instance.
  88. -n::
  89. --no-samples::
  90. Don't sample.
  91. -R::
  92. --raw-samples::
  93. Collect raw sample records from all opened counters (default for tracepoint counters).
  94. -C::
  95. --cpu::
  96. Collect samples only on the list of CPUs provided. Multiple CPUs can be provided as a
  97. comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2.
  98. In per-thread mode with inheritance mode on (default), samples are captured only when
  99. the thread executes on the designated CPUs. Default is to monitor all CPUs.
  100. -N::
  101. --no-buildid-cache::
  102. Do not update the builid cache. This saves some overhead in situations
  103. where the information in the perf.data file (which includes buildids)
  104. is sufficient.
  105. -G name,...::
  106. --cgroup name,...::
  107. monitor only in the container (cgroup) called "name". This option is available only
  108. in per-cpu mode. The cgroup filesystem must be mounted. All threads belonging to
  109. container "name" are monitored when they run on the monitored CPUs. Multiple cgroups
  110. can be provided. Each cgroup is applied to the corresponding event, i.e., first cgroup
  111. to first event, second cgroup to second event and so on. It is possible to provide
  112. an empty cgroup (monitor all the time) using, e.g., -G foo,,bar. Cgroups must have
  113. corresponding events, i.e., they always refer to events defined earlier on the command
  114. line.
  115. -b::
  116. --branch-any::
  117. Enable taken branch stack sampling. Any type of taken branch may be sampled.
  118. This is a shortcut for --branch-filter any. See --branch-filter for more infos.
  119. -j::
  120. --branch-filter::
  121. Enable taken branch stack sampling. Each sample captures a series of consecutive
  122. taken branches. The number of branches captured with each sample depends on the
  123. underlying hardware, the type of branches of interest, and the executed code.
  124. It is possible to select the types of branches captured by enabling filters. The
  125. following filters are defined:
  126. - any: any type of branches
  127. - any_call: any function call or system call
  128. - any_ret: any function return or system call return
  129. - ind_call: any indirect branch
  130. - u: only when the branch target is at the user level
  131. - k: only when the branch target is in the kernel
  132. - hv: only when the target is at the hypervisor level
  133. +
  134. The option requires at least one branch type among any, any_call, any_ret, ind_call.
  135. The privilege levels may be omitted, in which case, the privilege levels of the associated
  136. event are applied to the branch filter. Both kernel (k) and hypervisor (hv) privilege
  137. levels are subject to permissions. When sampling on multiple events, branch stack sampling
  138. is enabled for all the sampling events. The sampled branch type is the same for all events.
  139. The various filters must be specified as a comma separated list: --branch-filter any_ret,u,k
  140. Note that this feature may not be available on all processors.
  141. -W::
  142. --weight::
  143. Enable weightened sampling. An additional weight is recorded per sample and can be
  144. displayed with the weight and local_weight sort keys. This currently works for TSX
  145. abort events and some memory events in precise mode on modern Intel CPUs.
  146. SEE ALSO
  147. --------
  148. linkperf:perf-stat[1], linkperf:perf-list[1]