perf-report.txt 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. perf-report(1)
  2. ==============
  3. NAME
  4. ----
  5. perf-report - Read perf.data (created by perf record) and display the profile
  6. SYNOPSIS
  7. --------
  8. [verse]
  9. 'perf report' [-i <file> | --input=file]
  10. DESCRIPTION
  11. -----------
  12. This command displays the performance counter profile information recorded
  13. via perf record.
  14. OPTIONS
  15. -------
  16. -i::
  17. --input=::
  18. Input file name. (default: perf.data unless stdin is a fifo)
  19. -v::
  20. --verbose::
  21. Be more verbose. (show symbol address, etc)
  22. -q::
  23. --quiet::
  24. Do not show any message. (Suppress -v)
  25. -n::
  26. --show-nr-samples::
  27. Show the number of samples for each symbol
  28. --show-cpu-utilization::
  29. Show sample percentage for different cpu modes.
  30. -T::
  31. --threads::
  32. Show per-thread event counters. The input data file should be recorded
  33. with -s option.
  34. -c::
  35. --comms=::
  36. Only consider symbols in these comms. CSV that understands
  37. file://filename entries. This option will affect the percentage of
  38. the overhead column. See --percentage for more info.
  39. --pid=::
  40. Only show events for given process ID (comma separated list).
  41. --tid=::
  42. Only show events for given thread ID (comma separated list).
  43. -d::
  44. --dsos=::
  45. Only consider symbols in these dsos. CSV that understands
  46. file://filename entries. This option will affect the percentage of
  47. the overhead column. See --percentage for more info.
  48. -S::
  49. --symbols=::
  50. Only consider these symbols. CSV that understands
  51. file://filename entries. This option will affect the percentage of
  52. the overhead column. See --percentage for more info.
  53. --symbol-filter=::
  54. Only show symbols that match (partially) with this filter.
  55. -U::
  56. --hide-unresolved::
  57. Only display entries resolved to a symbol.
  58. -s::
  59. --sort=::
  60. Sort histogram entries by given key(s) - multiple keys can be specified
  61. in CSV format. Following sort keys are available:
  62. pid, comm, dso, symbol, parent, cpu, socket, srcline, weight,
  63. local_weight, cgroup_id.
  64. Each key has following meaning:
  65. - comm: command (name) of the task which can be read via /proc/<pid>/comm
  66. - pid: command and tid of the task
  67. - dso: name of library or module executed at the time of sample
  68. - dso_size: size of library or module executed at the time of sample
  69. - symbol: name of function executed at the time of sample
  70. - symbol_size: size of function executed at the time of sample
  71. - parent: name of function matched to the parent regex filter. Unmatched
  72. entries are displayed as "[other]".
  73. - cpu: cpu number the task ran at the time of sample
  74. - socket: processor socket number the task ran at the time of sample
  75. - srcline: filename and line number executed at the time of sample. The
  76. DWARF debugging info must be provided.
  77. - srcfile: file name of the source file of the samples. Requires dwarf
  78. information.
  79. - weight: Event specific weight, e.g. memory latency or transaction
  80. abort cost. This is the global weight.
  81. - local_weight: Local weight version of the weight above.
  82. - cgroup_id: ID derived from cgroup namespace device and inode numbers.
  83. - cgroup: cgroup pathname in the cgroupfs.
  84. - transaction: Transaction abort flags.
  85. - overhead: Overhead percentage of sample
  86. - overhead_sys: Overhead percentage of sample running in system mode
  87. - overhead_us: Overhead percentage of sample running in user mode
  88. - overhead_guest_sys: Overhead percentage of sample running in system mode
  89. on guest machine
  90. - overhead_guest_us: Overhead percentage of sample running in user mode on
  91. guest machine
  92. - sample: Number of sample
  93. - period: Raw number of event count of sample
  94. - time: Separate the samples by time stamp with the resolution specified by
  95. --time-quantum (default 100ms). Specify with overhead and before it.
  96. By default, comm, dso and symbol keys are used.
  97. (i.e. --sort comm,dso,symbol)
  98. If --branch-stack option is used, following sort keys are also
  99. available:
  100. - dso_from: name of library or module branched from
  101. - dso_to: name of library or module branched to
  102. - symbol_from: name of function branched from
  103. - symbol_to: name of function branched to
  104. - srcline_from: source file and line branched from
  105. - srcline_to: source file and line branched to
  106. - mispredict: "N" for predicted branch, "Y" for mispredicted branch
  107. - in_tx: branch in TSX transaction
  108. - abort: TSX transaction abort.
  109. - cycles: Cycles in basic block
  110. And default sort keys are changed to comm, dso_from, symbol_from, dso_to
  111. and symbol_to, see '--branch-stack'.
  112. When the sort key symbol is specified, columns "IPC" and "IPC Coverage"
  113. are enabled automatically. Column "IPC" reports the average IPC per function
  114. and column "IPC coverage" reports the percentage of instructions with
  115. sampled IPC in this function. IPC means Instruction Per Cycle. If it's low,
  116. it indicates there may be a performance bottleneck when the function is
  117. executed, such as a memory access bottleneck. If a function has high overhead
  118. and low IPC, it's worth further analyzing it to optimize its performance.
  119. If the --mem-mode option is used, the following sort keys are also available
  120. (incompatible with --branch-stack):
  121. symbol_daddr, dso_daddr, locked, tlb, mem, snoop, dcacheline.
  122. - symbol_daddr: name of data symbol being executed on at the time of sample
  123. - dso_daddr: name of library or module containing the data being executed
  124. on at the time of the sample
  125. - locked: whether the bus was locked at the time of the sample
  126. - tlb: type of tlb access for the data at the time of the sample
  127. - mem: type of memory access for the data at the time of the sample
  128. - snoop: type of snoop (if any) for the data at the time of the sample
  129. - dcacheline: the cacheline the data address is on at the time of the sample
  130. - phys_daddr: physical address of data being executed on at the time of sample
  131. And the default sort keys are changed to local_weight, mem, sym, dso,
  132. symbol_daddr, dso_daddr, snoop, tlb, locked, see '--mem-mode'.
  133. If the data file has tracepoint event(s), following (dynamic) sort keys
  134. are also available:
  135. trace, trace_fields, [<event>.]<field>[/raw]
  136. - trace: pretty printed trace output in a single column
  137. - trace_fields: fields in tracepoints in separate columns
  138. - <field name>: optional event and field name for a specific field
  139. The last form consists of event and field names. If event name is
  140. omitted, it searches all events for matching field name. The matched
  141. field will be shown only for the event has the field. The event name
  142. supports substring match so user doesn't need to specify full subsystem
  143. and event name everytime. For example, 'sched:sched_switch' event can
  144. be shortened to 'switch' as long as it's not ambiguous. Also event can
  145. be specified by its index (starting from 1) preceded by the '%'.
  146. So '%1' is the first event, '%2' is the second, and so on.
  147. The field name can have '/raw' suffix which disables pretty printing
  148. and shows raw field value like hex numbers. The --raw-trace option
  149. has the same effect for all dynamic sort keys.
  150. The default sort keys are changed to 'trace' if all events in the data
  151. file are tracepoint.
  152. -F::
  153. --fields=::
  154. Specify output field - multiple keys can be specified in CSV format.
  155. Following fields are available:
  156. overhead, overhead_sys, overhead_us, overhead_children, sample and period.
  157. Also it can contain any sort key(s).
  158. By default, every sort keys not specified in -F will be appended
  159. automatically.
  160. If the keys starts with a prefix '+', then it will append the specified
  161. field(s) to the default field order. For example: perf report -F +period,sample.
  162. -p::
  163. --parent=<regex>::
  164. A regex filter to identify parent. The parent is a caller of this
  165. function and searched through the callchain, thus it requires callchain
  166. information recorded. The pattern is in the extended regex format and
  167. defaults to "\^sys_|^do_page_fault", see '--sort parent'.
  168. -x::
  169. --exclude-other::
  170. Only display entries with parent-match.
  171. -w::
  172. --column-widths=<width[,width...]>::
  173. Force each column width to the provided list, for large terminal
  174. readability. 0 means no limit (default behavior).
  175. -t::
  176. --field-separator=::
  177. Use a special separator character and don't pad with spaces, replacing
  178. all occurrences of this separator in symbol names (and other output)
  179. with a '.' character, that thus it's the only non valid separator.
  180. -D::
  181. --dump-raw-trace::
  182. Dump raw trace in ASCII.
  183. -g::
  184. --call-graph=<print_type,threshold[,print_limit],order,sort_key[,branch],value>::
  185. Display call chains using type, min percent threshold, print limit,
  186. call order, sort key, optional branch and value. Note that ordering
  187. is not fixed so any parameter can be given in an arbitrary order.
  188. One exception is the print_limit which should be preceded by threshold.
  189. print_type can be either:
  190. - flat: single column, linear exposure of call chains.
  191. - graph: use a graph tree, displaying absolute overhead rates. (default)
  192. - fractal: like graph, but displays relative rates. Each branch of
  193. the tree is considered as a new profiled object.
  194. - folded: call chains are displayed in a line, separated by semicolons
  195. - none: disable call chain display.
  196. threshold is a percentage value which specifies a minimum percent to be
  197. included in the output call graph. Default is 0.5 (%).
  198. print_limit is only applied when stdio interface is used. It's to limit
  199. number of call graph entries in a single hist entry. Note that it needs
  200. to be given after threshold (but not necessarily consecutive).
  201. Default is 0 (unlimited).
  202. order can be either:
  203. - callee: callee based call graph.
  204. - caller: inverted caller based call graph.
  205. Default is 'caller' when --children is used, otherwise 'callee'.
  206. sort_key can be:
  207. - function: compare on functions (default)
  208. - address: compare on individual code addresses
  209. - srcline: compare on source filename and line number
  210. branch can be:
  211. - branch: include last branch information in callgraph when available.
  212. Usually more convenient to use --branch-history for this.
  213. value can be:
  214. - percent: display overhead percent (default)
  215. - period: display event period
  216. - count: display event count
  217. --children::
  218. Accumulate callchain of children to parent entry so that then can
  219. show up in the output. The output will have a new "Children" column
  220. and will be sorted on the data. It requires callchains are recorded.
  221. See the `overhead calculation' section for more details. Enabled by
  222. default, disable with --no-children.
  223. --max-stack::
  224. Set the stack depth limit when parsing the callchain, anything
  225. beyond the specified depth will be ignored. This is a trade-off
  226. between information loss and faster processing especially for
  227. workloads that can have a very long callchain stack.
  228. Note that when using the --itrace option the synthesized callchain size
  229. will override this value if the synthesized callchain size is bigger.
  230. Default: 127
  231. -G::
  232. --inverted::
  233. alias for inverted caller based call graph.
  234. --ignore-callees=<regex>::
  235. Ignore callees of the function(s) matching the given regex.
  236. This has the effect of collecting the callers of each such
  237. function into one place in the call-graph tree.
  238. --pretty=<key>::
  239. Pretty printing style. key: normal, raw
  240. --stdio:: Use the stdio interface.
  241. --stdio-color::
  242. 'always', 'never' or 'auto', allowing configuring color output
  243. via the command line, in addition to via "color.ui" .perfconfig.
  244. Use '--stdio-color always' to generate color even when redirecting
  245. to a pipe or file. Using just '--stdio-color' is equivalent to
  246. using 'always'.
  247. --tui:: Use the TUI interface, that is integrated with annotate and allows
  248. zooming into DSOs or threads, among other features. Use of --tui
  249. requires a tty, if one is not present, as when piping to other
  250. commands, the stdio interface is used.
  251. --gtk:: Use the GTK2 interface.
  252. -k::
  253. --vmlinux=<file>::
  254. vmlinux pathname
  255. --ignore-vmlinux::
  256. Ignore vmlinux files.
  257. --kallsyms=<file>::
  258. kallsyms pathname
  259. -m::
  260. --modules::
  261. Load module symbols. WARNING: This should only be used with -k and
  262. a LIVE kernel.
  263. -f::
  264. --force::
  265. Don't do ownership validation.
  266. --symfs=<directory>::
  267. Look for files with symbols relative to this directory.
  268. -C::
  269. --cpu:: Only report samples for the list of CPUs provided. Multiple CPUs can
  270. be provided as a comma-separated list with no space: 0,1. Ranges of
  271. CPUs are specified with -: 0-2. Default is to report samples on all
  272. CPUs.
  273. -M::
  274. --disassembler-style=:: Set disassembler style for objdump.
  275. --source::
  276. Interleave source code with assembly code. Enabled by default,
  277. disable with --no-source.
  278. --asm-raw::
  279. Show raw instruction encoding of assembly instructions.
  280. --show-total-period:: Show a column with the sum of periods.
  281. -I::
  282. --show-info::
  283. Display extended information about the perf.data file. This adds
  284. information which may be very large and thus may clutter the display.
  285. It currently includes: cpu and numa topology of the host system.
  286. -b::
  287. --branch-stack::
  288. Use the addresses of sampled taken branches instead of the instruction
  289. address to build the histograms. To generate meaningful output, the
  290. perf.data file must have been obtained using perf record -b or
  291. perf record --branch-filter xxx where xxx is a branch filter option.
  292. perf report is able to auto-detect whether a perf.data file contains
  293. branch stacks and it will automatically switch to the branch view mode,
  294. unless --no-branch-stack is used.
  295. --branch-history::
  296. Add the addresses of sampled taken branches to the callstack.
  297. This allows to examine the path the program took to each sample.
  298. The data collection must have used -b (or -j) and -g.
  299. --objdump=<path>::
  300. Path to objdump binary.
  301. --prefix=PREFIX::
  302. --prefix-strip=N::
  303. Remove first N entries from source file path names in executables
  304. and add PREFIX. This allows to display source code compiled on systems
  305. with different file system layout.
  306. --group::
  307. Show event group information together. It forces group output also
  308. if there are no groups defined in data file.
  309. --group-sort-idx::
  310. Sort the output by the event at the index n in group. If n is invalid,
  311. sort by the first event. It can support multiple groups with different
  312. amount of events. WARNING: This should be used on grouped events.
  313. --demangle::
  314. Demangle symbol names to human readable form. It's enabled by default,
  315. disable with --no-demangle.
  316. --demangle-kernel::
  317. Demangle kernel symbol names to human readable form (for C++ kernels).
  318. --mem-mode::
  319. Use the data addresses of samples in addition to instruction addresses
  320. to build the histograms. To generate meaningful output, the perf.data
  321. file must have been obtained using perf record -d -W and using a
  322. special event -e cpu/mem-loads/p or -e cpu/mem-stores/p. See
  323. 'perf mem' for simpler access.
  324. --percent-limit::
  325. Do not show entries which have an overhead under that percent.
  326. (Default: 0). Note that this option also sets the percent limit (threshold)
  327. of callchains. However the default value of callchain threshold is
  328. different than the default value of hist entries. Please see the
  329. --call-graph option for details.
  330. --percentage::
  331. Determine how to display the overhead percentage of filtered entries.
  332. Filters can be applied by --comms, --dsos and/or --symbols options and
  333. Zoom operations on the TUI (thread, dso, etc).
  334. "relative" means it's relative to filtered entries only so that the
  335. sum of shown entries will be always 100%. "absolute" means it retains
  336. the original value before and after the filter is applied.
  337. --header::
  338. Show header information in the perf.data file. This includes
  339. various information like hostname, OS and perf version, cpu/mem
  340. info, perf command line, event list and so on. Currently only
  341. --stdio output supports this feature.
  342. --header-only::
  343. Show only perf.data header (forces --stdio).
  344. --time::
  345. Only analyze samples within given time window: <start>,<stop>. Times
  346. have the format seconds.nanoseconds. If start is not given (i.e. time
  347. string is ',x.y') then analysis starts at the beginning of the file. If
  348. stop time is not given (i.e. time string is 'x.y,') then analysis goes
  349. to end of file. Multiple ranges can be separated by spaces, which
  350. requires the argument to be quoted e.g. --time "1234.567,1234.789 1235,"
  351. Also support time percent with multiple time ranges. Time string is
  352. 'a%/n,b%/m,...' or 'a%-b%,c%-%d,...'.
  353. For example:
  354. Select the second 10% time slice:
  355. perf report --time 10%/2
  356. Select from 0% to 10% time slice:
  357. perf report --time 0%-10%
  358. Select the first and second 10% time slices:
  359. perf report --time 10%/1,10%/2
  360. Select from 0% to 10% and 30% to 40% slices:
  361. perf report --time 0%-10%,30%-40%
  362. --switch-on EVENT_NAME::
  363. Only consider events after this event is found.
  364. This may be interesting to measure a workload only after some initialization
  365. phase is over, i.e. insert a perf probe at that point and then using this
  366. option with that probe.
  367. --switch-off EVENT_NAME::
  368. Stop considering events after this event is found.
  369. --show-on-off-events::
  370. Show the --switch-on/off events too. This has no effect in 'perf report' now
  371. but probably we'll make the default not to show the switch-on/off events
  372. on the --group mode and if there is only one event besides the off/on ones,
  373. go straight to the histogram browser, just like 'perf report' with no events
  374. explicitely specified does.
  375. --itrace::
  376. Options for decoding instruction tracing data. The options are:
  377. include::itrace.txt[]
  378. To disable decoding entirely, use --no-itrace.
  379. --full-source-path::
  380. Show the full path for source files for srcline output.
  381. --show-ref-call-graph::
  382. When multiple events are sampled, it may not be needed to collect
  383. callgraphs for all of them. The sample sites are usually nearby,
  384. and it's enough to collect the callgraphs on a reference event.
  385. So user can use "call-graph=no" event modifier to disable callgraph
  386. for other events to reduce the overhead.
  387. However, perf report cannot show callgraphs for the event which
  388. disable the callgraph.
  389. This option extends the perf report to show reference callgraphs,
  390. which collected by reference event, in no callgraph event.
  391. --stitch-lbr::
  392. Show callgraph with stitched LBRs, which may have more complete
  393. callgraph. The perf.data file must have been obtained using
  394. perf record --call-graph lbr.
  395. Disabled by default. In common cases with call stack overflows,
  396. it can recreate better call stacks than the default lbr call stack
  397. output. But this approach is not full proof. There can be cases
  398. where it creates incorrect call stacks from incorrect matches.
  399. The known limitations include exception handing such as
  400. setjmp/longjmp will have calls/returns not match.
  401. --socket-filter::
  402. Only report the samples on the processor socket that match with this filter
  403. --samples=N::
  404. Save N individual samples for each histogram entry to show context in perf
  405. report tui browser.
  406. --raw-trace::
  407. When displaying traceevent output, do not use print fmt or plugins.
  408. --hierarchy::
  409. Enable hierarchical output.
  410. --inline::
  411. If a callgraph address belongs to an inlined function, the inline stack
  412. will be printed. Each entry is function name or file/line. Enabled by
  413. default, disable with --no-inline.
  414. --mmaps::
  415. Show --tasks output plus mmap information in a format similar to
  416. /proc/<PID>/maps.
  417. Please note that not all mmaps are stored, options affecting which ones
  418. are include 'perf record --data', for instance.
  419. --ns::
  420. Show time stamps in nanoseconds.
  421. --stats::
  422. Display overall events statistics without any further processing.
  423. (like the one at the end of the perf report -D command)
  424. --tasks::
  425. Display monitored tasks stored in perf data. Displaying pid/tid/ppid
  426. plus the command string aligned to distinguish parent and child tasks.
  427. --percent-type::
  428. Set annotation percent type from following choices:
  429. global-period, local-period, global-hits, local-hits
  430. The local/global keywords set if the percentage is computed
  431. in the scope of the function (local) or the whole data (global).
  432. The period/hits keywords set the base the percentage is computed
  433. on - the samples period or the number of samples (hits).
  434. --time-quantum::
  435. Configure time quantum for time sort key. Default 100ms.
  436. Accepts s, us, ms, ns units.
  437. --total-cycles::
  438. When --total-cycles is specified, it supports sorting for all blocks by
  439. 'Sampled Cycles%'. This is useful to concentrate on the globally hottest
  440. blocks. In output, there are some new columns:
  441. 'Sampled Cycles%' - block sampled cycles aggregation / total sampled cycles
  442. 'Sampled Cycles' - block sampled cycles aggregation
  443. 'Avg Cycles%' - block average sampled cycles / sum of total block average
  444. sampled cycles
  445. 'Avg Cycles' - block average sampled cycles
  446. include::callchain-overhead-calculation.txt[]
  447. SEE ALSO
  448. --------
  449. linkperf:perf-stat[1], linkperf:perf-annotate[1], linkperf:perf-record[1],
  450. linkperf:perf-intel-pt[1]