1PERF-REPORT(1) perf Manual PERF-REPORT(1)
2
3
4
6 perf-report - Read perf.data (created by perf record) and display the
7 profile
8
10 perf report [-i <file> | --input=file]
11
13 This command displays the performance counter profile information
14 recorded via perf record.
15
17 -i, --input=
18 Input file name. (default: perf.data unless stdin is a fifo)
19
20 -v, --verbose
21 Be more verbose. (show symbol address, etc)
22
23 -q, --quiet
24 Do not show any message. (Suppress -v)
25
26 -n, --show-nr-samples
27 Show the number of samples for each symbol
28
29 --show-cpu-utilization
30 Show sample percentage for different cpu modes.
31
32 -T, --threads
33 Show per-thread event counters. The input data file should be
34 recorded with -s option.
35
36 -c, --comms=
37 Only consider symbols in these comms. CSV that understands
38 file://filename entries. This option will affect the percentage of
39 the overhead column. See --percentage for more info.
40
41 --pid=
42 Only show events for given process ID (comma separated list).
43
44 --tid=
45 Only show events for given thread ID (comma separated list).
46
47 -d, --dsos=
48 Only consider symbols in these dsos. CSV that understands
49 file://filename entries. This option will affect the percentage of
50 the overhead column. See --percentage for more info.
51
52 -S, --symbols=
53 Only consider these symbols. CSV that understands file://filename
54 entries. This option will affect the percentage of the overhead
55 column. See --percentage for more info.
56
57 --symbol-filter=
58 Only show symbols that match (partially) with this filter.
59
60 -U, --hide-unresolved
61 Only display entries resolved to a symbol.
62
63 -s, --sort=
64 Sort histogram entries by given key(s) - multiple keys can be
65 specified in CSV format. Following sort keys are available: pid,
66 comm, dso, symbol, parent, cpu, socket, srcline, weight,
67 local_weight, cgroup_id.
68
69 Each key has following meaning:
70
71 · comm: command (name) of the task which can be read via
72 /proc/<pid>/comm
73
74 · pid: command and tid of the task
75
76 · dso: name of library or module executed at the time of sample
77
78 · dso_size: size of library or module executed at the time of
79 sample
80
81 · symbol: name of function executed at the time of sample
82
83 · symbol_size: size of function executed at the time of sample
84
85 · parent: name of function matched to the parent regex filter.
86 Unmatched entries are displayed as "[other]".
87
88 · cpu: cpu number the task ran at the time of sample
89
90 · socket: processor socket number the task ran at the time of
91 sample
92
93 · srcline: filename and line number executed at the time of
94 sample. The DWARF debugging info must be provided.
95
96 · srcfile: file name of the source file of the samples. Requires
97 dwarf information.
98
99 · weight: Event specific weight, e.g. memory latency or
100 transaction abort cost. This is the global weight.
101
102 · local_weight: Local weight version of the weight above.
103
104 · cgroup_id: ID derived from cgroup namespace device and inode
105 numbers.
106
107 · cgroup: cgroup pathname in the cgroupfs.
108
109 · transaction: Transaction abort flags.
110
111 · overhead: Overhead percentage of sample
112
113 · overhead_sys: Overhead percentage of sample running in system
114 mode
115
116 · overhead_us: Overhead percentage of sample running in user mode
117
118 · overhead_guest_sys: Overhead percentage of sample running in
119 system mode on guest machine
120
121 · overhead_guest_us: Overhead percentage of sample running in
122 user mode on guest machine
123
124 · sample: Number of sample
125
126 · period: Raw number of event count of sample
127
128 · time: Separate the samples by time stamp with the resolution
129 specified by --time-quantum (default 100ms). Specify with
130 overhead and before it.
131
132 By default, comm, dso and symbol keys are used.
133 (i.e. --sort comm,dso,symbol)
134
135 If --branch-stack option is used, following sort keys are also
136 available:
137
138 · dso_from: name of library or module branched from
139
140 · dso_to: name of library or module branched to
141
142 · symbol_from: name of function branched from
143
144 · symbol_to: name of function branched to
145
146 · srcline_from: source file and line branched from
147
148 · srcline_to: source file and line branched to
149
150 · mispredict: "N" for predicted branch, "Y" for mispredicted
151 branch
152
153 · in_tx: branch in TSX transaction
154
155 · abort: TSX transaction abort.
156
157 · cycles: Cycles in basic block
158
159 And default sort keys are changed to comm, dso_from, symbol_from, dso_to
160 and symbol_to, see '--branch-stack'.
161
162 When the sort key symbol is specified, columns "IPC" and "IPC Coverage"
163 are enabled automatically. Column "IPC" reports the average IPC per function
164 and column "IPC coverage" reports the percentage of instructions with
165 sampled IPC in this function. IPC means Instruction Per Cycle. If it's low,
166 it indicates there may be a performance bottleneck when the function is
167 executed, such as a memory access bottleneck. If a function has high overhead
168 and low IPC, it's worth further analyzing it to optimize its performance.
169
170 If the --mem-mode option is used, the following sort keys are also available
171 (incompatible with --branch-stack):
172 symbol_daddr, dso_daddr, locked, tlb, mem, snoop, dcacheline.
173
174 · symbol_daddr: name of data symbol being executed on at the time
175 of sample
176
177 · dso_daddr: name of library or module containing the data being
178 executed on at the time of the sample
179
180 · locked: whether the bus was locked at the time of the sample
181
182 · tlb: type of tlb access for the data at the time of the sample
183
184 · mem: type of memory access for the data at the time of the
185 sample
186
187 · snoop: type of snoop (if any) for the data at the time of the
188 sample
189
190 · dcacheline: the cacheline the data address is on at the time of
191 the sample
192
193 · phys_daddr: physical address of data being executed on at the
194 time of sample
195
196 · data_page_size: the data page size of data being executed on at
197 the time of sample
198
199 And the default sort keys are changed to local_weight, mem, sym, dso,
200 symbol_daddr, dso_daddr, snoop, tlb, locked, see '--mem-mode'.
201
202 If the data file has tracepoint event(s), following (dynamic) sort keys
203 are also available:
204 trace, trace_fields, [<event>.]<field>[/raw]
205
206 · trace: pretty printed trace output in a single column
207
208 · trace_fields: fields in tracepoints in separate columns
209
210 · <field name>: optional event and field name for a specific
211 field
212
213 The last form consists of event and field names. If event name is
214 omitted, it searches all events for matching field name. The matched
215 field will be shown only for the event has the field. The event name
216 supports substring match so user doesn't need to specify full subsystem
217 and event name everytime. For example, 'sched:sched_switch' event can
218 be shortened to 'switch' as long as it's not ambiguous. Also event can
219 be specified by its index (starting from 1) preceded by the '%'.
220 So '%1' is the first event, '%2' is the second, and so on.
221
222 The field name can have '/raw' suffix which disables pretty printing
223 and shows raw field value like hex numbers. The --raw-trace option
224 has the same effect for all dynamic sort keys.
225
226 The default sort keys are changed to 'trace' if all events in the data
227 file are tracepoint.
228
229 -F, --fields=
230 Specify output field - multiple keys can be specified in CSV
231 format. Following fields are available: overhead, overhead_sys,
232 overhead_us, overhead_children, sample and period. Also it can
233 contain any sort key(s).
234
235 By default, every sort keys not specified in -F will be appended
236 automatically.
237
238 If the keys starts with a prefix '+', then it will append the specified
239 field(s) to the default field order. For example: perf report -F +period,sample.
240
241 -p, --parent=<regex>
242 A regex filter to identify parent. The parent is a caller of this
243 function and searched through the callchain, thus it requires
244 callchain information recorded. The pattern is in the extended
245 regex format and defaults to "^sys_|^do_page_fault", see --sort
246 parent.
247
248 -x, --exclude-other
249 Only display entries with parent-match.
250
251 -w, --column-widths=<width[,width...]>
252 Force each column width to the provided list, for large terminal
253 readability. 0 means no limit (default behavior).
254
255 -t, --field-separator=
256 Use a special separator character and don’t pad with spaces,
257 replacing all occurrences of this separator in symbol names (and
258 other output) with a . character, that thus it’s the only non
259 valid separator.
260
261 -D, --dump-raw-trace
262 Dump raw trace in ASCII.
263
264 -g,
265 --call-graph=<print_type,threshold[,print_limit],order,sort_key[,branch],value>
266 Display call chains using type, min percent threshold, print limit,
267 call order, sort key, optional branch and value. Note that ordering
268 is not fixed so any parameter can be given in an arbitrary order.
269 One exception is the print_limit which should be preceded by
270 threshold.
271
272 print_type can be either:
273 - flat: single column, linear exposure of call chains.
274 - graph: use a graph tree, displaying absolute overhead rates. (default)
275 - fractal: like graph, but displays relative rates. Each branch of
276 the tree is considered as a new profiled object.
277 - folded: call chains are displayed in a line, separated by semicolons
278 - none: disable call chain display.
279
280 threshold is a percentage value which specifies a minimum percent to be
281 included in the output call graph. Default is 0.5 (%).
282
283 print_limit is only applied when stdio interface is used. It's to limit
284 number of call graph entries in a single hist entry. Note that it needs
285 to be given after threshold (but not necessarily consecutive).
286 Default is 0 (unlimited).
287
288 order can be either:
289 - callee: callee based call graph.
290 - caller: inverted caller based call graph.
291 Default is 'caller' when --children is used, otherwise 'callee'.
292
293 sort_key can be:
294 - function: compare on functions (default)
295 - address: compare on individual code addresses
296 - srcline: compare on source filename and line number
297
298 branch can be:
299 - branch: include last branch information in callgraph when available.
300 Usually more convenient to use --branch-history for this.
301
302 value can be:
303 - percent: display overhead percent (default)
304 - period: display event period
305 - count: display event count
306
307 --children
308 Accumulate callchain of children to parent entry so that then can
309 show up in the output. The output will have a new "Children" column
310 and will be sorted on the data. It requires callchains are
311 recorded. See the ‘overhead calculation’ section for more details.
312 Enabled by default, disable with --no-children.
313
314 --max-stack
315 Set the stack depth limit when parsing the callchain, anything
316 beyond the specified depth will be ignored. This is a trade-off
317 between information loss and faster processing especially for
318 workloads that can have a very long callchain stack. Note that when
319 using the --itrace option the synthesized callchain size will
320 override this value if the synthesized callchain size is bigger.
321
322 Default: 127
323
324 -G, --inverted
325 alias for inverted caller based call graph.
326
327 --ignore-callees=<regex>
328 Ignore callees of the function(s) matching the given regex. This
329 has the effect of collecting the callers of each such function into
330 one place in the call-graph tree.
331
332 --pretty=<key>
333 Pretty printing style. key: normal, raw
334
335 --stdio
336 Use the stdio interface.
337
338 --stdio-color
339 always, never or auto, allowing configuring color output via the
340 command line, in addition to via "color.ui" .perfconfig. Use
341 --stdio-color always to generate color even when redirecting to a
342 pipe or file. Using just --stdio-color is equivalent to using
343 always.
344
345 --tui
346 Use the TUI interface, that is integrated with annotate and allows
347 zooming into DSOs or threads, among other features. Use of --tui
348 requires a tty, if one is not present, as when piping to other
349 commands, the stdio interface is used.
350
351 --gtk
352 Use the GTK2 interface.
353
354 -k, --vmlinux=<file>
355 vmlinux pathname
356
357 --ignore-vmlinux
358 Ignore vmlinux files.
359
360 --kallsyms=<file>
361 kallsyms pathname
362
363 -m, --modules
364 Load module symbols. WARNING: This should only be used with -k and
365 a LIVE kernel.
366
367 -f, --force
368 Don’t do ownership validation.
369
370 --symfs=<directory>
371 Look for files with symbols relative to this directory.
372
373 -C, --cpu
374 Only report samples for the list of CPUs provided. Multiple CPUs
375 can be provided as a comma-separated list with no space: 0,1.
376 Ranges of CPUs are specified with -: 0-2. Default is to report
377 samples on all CPUs.
378
379 -M, --disassembler-style=
380 Set disassembler style for objdump.
381
382 --source
383 Interleave source code with assembly code. Enabled by default,
384 disable with --no-source.
385
386 --asm-raw
387 Show raw instruction encoding of assembly instructions.
388
389 --show-total-period
390 Show a column with the sum of periods.
391
392 -I, --show-info
393 Display extended information about the perf.data file. This adds
394 information which may be very large and thus may clutter the
395 display. It currently includes: cpu and numa topology of the host
396 system.
397
398 -b, --branch-stack
399 Use the addresses of sampled taken branches instead of the
400 instruction address to build the histograms. To generate meaningful
401 output, the perf.data file must have been obtained using perf
402 record -b or perf record --branch-filter xxx where xxx is a branch
403 filter option. perf report is able to auto-detect whether a
404 perf.data file contains branch stacks and it will automatically
405 switch to the branch view mode, unless --no-branch-stack is used.
406
407 --branch-history
408 Add the addresses of sampled taken branches to the callstack. This
409 allows to examine the path the program took to each sample. The
410 data collection must have used -b (or -j) and -g.
411
412 --objdump=<path>
413 Path to objdump binary.
414
415 --prefix=PREFIX, --prefix-strip=N
416 Remove first N entries from source file path names in executables
417 and add PREFIX. This allows to display source code compiled on
418 systems with different file system layout.
419
420 --group
421 Show event group information together. It forces group output also
422 if there are no groups defined in data file.
423
424 --group-sort-idx
425 Sort the output by the event at the index n in group. If n is
426 invalid, sort by the first event. It can support multiple groups
427 with different amount of events. WARNING: This should be used on
428 grouped events.
429
430 --demangle
431 Demangle symbol names to human readable form. It’s enabled by
432 default, disable with --no-demangle.
433
434 --demangle-kernel
435 Demangle kernel symbol names to human readable form (for C++
436 kernels).
437
438 --mem-mode
439 Use the data addresses of samples in addition to instruction
440 addresses to build the histograms. To generate meaningful output,
441 the perf.data file must have been obtained using perf record -d -W
442 and using a special event -e cpu/mem-loads/p or -e
443 cpu/mem-stores/p. See perf mem for simpler access.
444
445 --percent-limit
446 Do not show entries which have an overhead under that percent.
447 (Default: 0). Note that this option also sets the percent limit
448 (threshold) of callchains. However the default value of callchain
449 threshold is different than the default value of hist entries.
450 Please see the --call-graph option for details.
451
452 --percentage
453 Determine how to display the overhead percentage of filtered
454 entries. Filters can be applied by --comms, --dsos and/or --symbols
455 options and Zoom operations on the TUI (thread, dso, etc).
456
457 "relative" means it's relative to filtered entries only so that the
458 sum of shown entries will be always 100%. "absolute" means it retains
459 the original value before and after the filter is applied.
460
461 --header
462 Show header information in the perf.data file. This includes
463 various information like hostname, OS and perf version, cpu/mem
464 info, perf command line, event list and so on. Currently only
465 --stdio output supports this feature.
466
467 --header-only
468 Show only perf.data header (forces --stdio).
469
470 --time
471 Only analyze samples within given time window: <start>,<stop>.
472 Times have the format seconds.nanoseconds. If start is not given
473 (i.e. time string is ,x.y) then analysis starts at the beginning of
474 the file. If stop time is not given (i.e. time string is x.y,) then
475 analysis goes to end of file. Multiple ranges can be separated by
476 spaces, which requires the argument to be quoted e.g. --time
477 "1234.567,1234.789 1235,"
478
479 Also support time percent with multiple time ranges. Time string is
480 'a%/n,b%/m,...' or 'a%-b%,c%-%d,...'.
481
482 For example:
483 Select the second 10% time slice:
484
485 perf report --time 10%/2
486
487 Select from 0% to 10% time slice:
488
489 perf report --time 0%-10%
490
491 Select the first and second 10% time slices:
492
493 perf report --time 10%/1,10%/2
494
495 Select from 0% to 10% and 30% to 40% slices:
496
497 perf report --time 0%-10%,30%-40%
498
499 --switch-on EVENT_NAME
500 Only consider events after this event is found.
501
502 This may be interesting to measure a workload only after some initialization
503 phase is over, i.e. insert a perf probe at that point and then using this
504 option with that probe.
505
506 --switch-off EVENT_NAME
507 Stop considering events after this event is found.
508
509 --show-on-off-events
510 Show the --switch-on/off events too. This has no effect in perf
511 report now but probably we’ll make the default not to show the
512 switch-on/off events on the --group mode and if there is only one
513 event besides the off/on ones, go straight to the histogram
514 browser, just like perf report with no events explicitely specified
515 does.
516
517 --itrace
518 Options for decoding instruction tracing data. The options are:
519
520 i synthesize instructions events
521 b synthesize branches events (branch misses for Arm SPE)
522 c synthesize branches events (calls only)
523 r synthesize branches events (returns only)
524 x synthesize transactions events
525 w synthesize ptwrite events
526 p synthesize power events
527 o synthesize other events recorded due to the use
528 of aux-output (refer to perf record)
529 e synthesize error events
530 d create a debug log
531 f synthesize first level cache events
532 m synthesize last level cache events
533 M synthesize memory events
534 t synthesize TLB events
535 a synthesize remote access events
536 g synthesize a call chain (use with i or x)
537 G synthesize a call chain on existing event records
538 l synthesize last branch entries (use with i or x)
539 L synthesize last branch entries on existing event records
540 s skip initial number of events
541 q quicker (less detailed) decoding
542
543 The default is all events i.e. the same as --itrace=ibxwpe,
544 except for perf script where it is --itrace=ce
545
546 In addition, the period (default 100000, except for perf script where it is 1)
547 for instructions events can be specified in units of:
548
549 i instructions
550 t ticks
551 ms milliseconds
552 us microseconds
553 ns nanoseconds (default)
554
555 Also the call chain size (default 16, max. 1024) for instructions or
556 transactions events can be specified.
557
558 Also the number of last branch entries (default 64, max. 1024) for
559 instructions or transactions events can be specified.
560
561 Similar to options g and l, size may also be specified for options G and L.
562 On x86, note that G and L work poorly when data has been recorded with
563 large PEBS. Refer linkperf:perf-intel-pt[1] man page for details.
564
565 It is also possible to skip events generated (instructions, branches, transactions,
566 ptwrite, power) at the beginning. This is useful to ignore initialization code.
567
568 --itrace=i0nss1000000
569
570 skips the first million instructions.
571
572 The 'e' option may be followed by flags which affect what errors will or
573 will not be reported. Each flag must be preceded by either '+' or '-'.
574 The flags are:
575 o overflow
576 l trace data lost
577
578 If supported, the 'd' option may be followed by flags which affect what
579 debug messages will or will not be logged. Each flag must be preceded
580 by either '+' or '-'. The flags are:
581 a all perf events
582
583 If supported, the 'q' option may be repeated to increase the effect.
584
585 To disable decoding entirely, use --no-itrace.
586
587 --full-source-path
588 Show the full path for source files for srcline output.
589
590 --show-ref-call-graph
591 When multiple events are sampled, it may not be needed to collect
592 callgraphs for all of them. The sample sites are usually nearby,
593 and it’s enough to collect the callgraphs on a reference event. So
594 user can use "call-graph=no" event modifier to disable callgraph
595 for other events to reduce the overhead. However, perf report
596 cannot show callgraphs for the event which disable the callgraph.
597 This option extends the perf report to show reference callgraphs,
598 which collected by reference event, in no callgraph event.
599
600 --stitch-lbr
601 Show callgraph with stitched LBRs, which may have more complete
602 callgraph. The perf.data file must have been obtained using perf
603 record --call-graph lbr. Disabled by default. In common cases with
604 call stack overflows, it can recreate better call stacks than the
605 default lbr call stack output. But this approach is not full proof.
606 There can be cases where it creates incorrect call stacks from
607 incorrect matches. The known limitations include exception handing
608 such as setjmp/longjmp will have calls/returns not match.
609
610 --socket-filter
611 Only report the samples on the processor socket that match with
612 this filter
613
614 --samples=N
615 Save N individual samples for each histogram entry to show context
616 in perf report tui browser.
617
618 --raw-trace
619 When displaying traceevent output, do not use print fmt or plugins.
620
621 --hierarchy
622 Enable hierarchical output.
623
624 --inline
625 If a callgraph address belongs to an inlined function, the inline
626 stack will be printed. Each entry is function name or file/line.
627 Enabled by default, disable with --no-inline.
628
629 --mmaps
630 Show --tasks output plus mmap information in a format similar to
631 /proc/<PID>/maps.
632
633 Please note that not all mmaps are stored, options affecting which ones
634 are include 'perf record --data', for instance.
635
636 --ns
637 Show time stamps in nanoseconds.
638
639 --stats
640 Display overall events statistics without any further processing.
641 (like the one at the end of the perf report -D command)
642
643 --tasks
644 Display monitored tasks stored in perf data. Displaying
645 pid/tid/ppid plus the command string aligned to distinguish parent
646 and child tasks.
647
648 --percent-type
649 Set annotation percent type from following choices: global-period,
650 local-period, global-hits, local-hits
651
652 The local/global keywords set if the percentage is computed
653 in the scope of the function (local) or the whole data (global).
654 The period/hits keywords set the base the percentage is computed
655 on - the samples period or the number of samples (hits).
656
657 --time-quantum
658 Configure time quantum for time sort key. Default 100ms. Accepts s,
659 us, ms, ns units.
660
661 --total-cycles
662 When --total-cycles is specified, it supports sorting for all
663 blocks by Sampled Cycles%. This is useful to concentrate on the
664 globally hottest blocks. In output, there are some new columns:
665
666 'Sampled Cycles%' - block sampled cycles aggregation / total sampled cycles
667 'Sampled Cycles' - block sampled cycles aggregation
668 'Avg Cycles%' - block average sampled cycles / sum of total block average
669 sampled cycles
670 'Avg Cycles' - block average sampled cycles
671
673 The overhead can be shown in two columns as Children and Self when perf
674 collects callchains. The self overhead is simply calculated by adding
675 all period values of the entry - usually a function (symbol). This is
676 the value that perf shows traditionally and sum of all the self
677 overhead values should be 100%.
678
679 The children overhead is calculated by adding all period values of the
680 child functions so that it can show the total overhead of the higher
681 level functions even if they don’t directly execute much. Children here
682 means functions that are called from another (parent) function.
683
684 It might be confusing that the sum of all the children overhead values
685 exceeds 100% since each of them is already an accumulation of self
686 overhead of its child functions. But with this enabled, users can find
687 which function has the most overhead even if samples are spread over
688 the children.
689
690 Consider the following example; there are three functions like below.
691
692
693 .ft C
694 void foo(void) {
695 /* do something */
696 }
697
698 void bar(void) {
699 /* do something */
700 foo();
701 }
702
703 int main(void) {
704 bar()
705 return 0;
706 }
707 .ft
708
709
710 In this case foo is a child of bar, and bar is an immediate child of
711 main so foo also is a child of main. In other words, main is a parent
712 of foo and bar, and bar is a parent of foo.
713
714 Suppose all samples are recorded in foo and bar only. When it’s
715 recorded with callchains the output will show something like below in
716 the usual (self-overhead-only) output of perf report:
717
718
719 .ft C
720 Overhead Symbol
721 ........ .....................
722 60.00% foo
723 |
724 --- foo
725 bar
726 main
727 __libc_start_main
728
729 40.00% bar
730 |
731 --- bar
732 main
733 __libc_start_main
734 .ft
735
736
737 When the --children option is enabled, the self overhead values of
738 child functions (i.e. foo and bar) are added to the parents to
739 calculate the children overhead. In this case the report could be
740 displayed as:
741
742
743 .ft C
744 Children Self Symbol
745 ........ ........ ....................
746 100.00% 0.00% __libc_start_main
747 |
748 --- __libc_start_main
749
750 100.00% 0.00% main
751 |
752 --- main
753 __libc_start_main
754
755 100.00% 40.00% bar
756 |
757 --- bar
758 main
759 __libc_start_main
760
761 60.00% 60.00% foo
762 |
763 --- foo
764 bar
765 main
766 __libc_start_main
767 .ft
768
769
770 In the above output, the self overhead of foo (60%) was add to the
771 children overhead of bar, main and __libc_start_main. Likewise, the
772 self overhead of bar (40%) was added to the children overhead of main
773 and \_\_libc_start_main.
774
775 So \_\_libc_start_main and main are shown first since they have same
776 (100%) children overhead (even though they have zero self overhead) and
777 they are the parents of foo and bar.
778
779 Since v3.16 the children overhead is shown by default and the output is
780 sorted by its values. The children overhead is disabled by specifying
781 --no-children option on the command line or by adding report.children =
782 false or top.children = false in the perf config file.
783
785 perf-stat(1), perf-annotate(1), perf-record(1), perf-intel-pt(1)
786
787
788
789perf 03/30/2021 PERF-REPORT(1)