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