perf-record.txt 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. -A::
  55. --append::
  56. Append to the output file to do incremental profiling.
  57. -f::
  58. --force::
  59. Overwrite existing data file. (deprecated)
  60. -c::
  61. --count=::
  62. Event period to sample.
  63. -o::
  64. --output=::
  65. Output file name.
  66. -i::
  67. --no-inherit::
  68. Child tasks do not inherit counters.
  69. -F::
  70. --freq=::
  71. Profile at this frequency.
  72. -m::
  73. --mmap-pages=::
  74. Number of mmap data pages. Must be a power of two.
  75. -g::
  76. --call-graph::
  77. Do call-graph (stack chain/backtrace) recording.
  78. -q::
  79. --quiet::
  80. Don't print any message, useful for scripting.
  81. -v::
  82. --verbose::
  83. Be more verbose (show counter open errors, etc).
  84. -s::
  85. --stat::
  86. Per thread counts.
  87. -d::
  88. --data::
  89. Sample addresses.
  90. -T::
  91. --timestamp::
  92. Sample timestamps. Use it with 'perf report -D' to see the timestamps,
  93. for instance.
  94. -n::
  95. --no-samples::
  96. Don't sample.
  97. -R::
  98. --raw-samples::
  99. Collect raw sample records from all opened counters (default for tracepoint counters).
  100. -C::
  101. --cpu::
  102. Collect samples only on the list of CPUs provided. Multiple CPUs can be provided as a
  103. comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2.
  104. In per-thread mode with inheritance mode on (default), samples are captured only when
  105. the thread executes on the designated CPUs. Default is to monitor all CPUs.
  106. -N::
  107. --no-buildid-cache::
  108. Do not update the builid cache. This saves some overhead in situations
  109. where the information in the perf.data file (which includes buildids)
  110. is sufficient.
  111. -G name,...::
  112. --cgroup name,...::
  113. monitor only in the container (cgroup) called "name". This option is available only
  114. in per-cpu mode. The cgroup filesystem must be mounted. All threads belonging to
  115. container "name" are monitored when they run on the monitored CPUs. Multiple cgroups
  116. can be provided. Each cgroup is applied to the corresponding event, i.e., first cgroup
  117. to first event, second cgroup to second event and so on. It is possible to provide
  118. an empty cgroup (monitor all the time) using, e.g., -G foo,,bar. Cgroups must have
  119. corresponding events, i.e., they always refer to events defined earlier on the command
  120. line.
  121. -b::
  122. --branch-any::
  123. Enable taken branch stack sampling. Any type of taken branch may be sampled.
  124. This is a shortcut for --branch-filter any. See --branch-filter for more infos.
  125. -j::
  126. --branch-filter::
  127. Enable taken branch stack sampling. Each sample captures a series of consecutive
  128. taken branches. The number of branches captured with each sample depends on the
  129. underlying hardware, the type of branches of interest, and the executed code.
  130. It is possible to select the types of branches captured by enabling filters. The
  131. following filters are defined:
  132. - any: any type of branches
  133. - any_call: any function call or system call
  134. - any_ret: any function return or system call return
  135. - any_ind: any indirect branch
  136. - u: only when the branch target is at the user level
  137. - k: only when the branch target is in the kernel
  138. - hv: only when the target is at the hypervisor level
  139. +
  140. The option requires at least one branch type among any, any_call, any_ret, ind_call.
  141. The privilege levels may be ommitted, in which case, the privilege levels of the associated
  142. event are applied to the branch filter. Both kernel (k) and hypervisor (hv) privilege
  143. levels are subject to permissions. When sampling on multiple events, branch stack sampling
  144. is enabled for all the sampling events. The sampled branch type is the same for all events.
  145. The various filters must be specified as a comma separated list: --branch-filter any_ret,u,k
  146. Note that this feature may not be available on all processors.
  147. SEE ALSO
  148. --------
  149. linkperf:perf-stat[1], linkperf:perf-list[1]