perf-report.txt 21 KB

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