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 same. 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.microseconds. If start is not given
457 (i.e., time string is ,x.y) then analysis starts at the beginning
458 of the file. If stop time is not given (i.e, time string is x.y,)
459 then analysis goes to end of file.
460
461 Also support time percent with multiple time range. Time string is
462 'a%/n,b%/m,...' or 'a%-b%,c%-%d,...'.
463
464 For example:
465 Select the second 10% time slice:
466
467 perf report --time 10%/2
468
469 Select from 0% to 10% time slice:
470
471 perf report --time 0%-10%
472
473 Select the first and second 10% time slices:
474
475 perf report --time 10%/1,10%/2
476
477 Select from 0% to 10% and 30% to 40% slices:
478
479 perf report --time 0%-10%,30%-40%
480
481 --itrace
482 Options for decoding instruction tracing data. The options are:
483
484 i synthesize instructions events
485 b synthesize branches events
486 c synthesize branches events (calls only)
487 r synthesize branches events (returns only)
488 x synthesize transactions events
489 w synthesize ptwrite events
490 p synthesize power events
491 e synthesize error events
492 d create a debug log
493 g synthesize a call chain (use with i or x)
494 l synthesize last branch entries (use with i or x)
495 s skip initial number of events
496
497 The default is all events i.e. the same as --itrace=ibxwpe,
498 except for perf script where it is --itrace=ce
499
500 In addition, the period (default 100000, except for perf script where it is 1)
501 for instructions events can be specified in units of:
502
503 i instructions
504 t ticks
505 ms milliseconds
506 us microseconds
507 ns nanoseconds (default)
508
509 Also the call chain size (default 16, max. 1024) for instructions or
510 transactions events can be specified.
511
512 Also the number of last branch entries (default 64, max. 1024) for
513 instructions or transactions events can be specified.
514
515 It is also possible to skip events generated (instructions, branches, transactions,
516 ptwrite, power) at the beginning. This is useful to ignore initialization code.
517
518 --itrace=i0nss1000000
519
520 skips the first million instructions.
521
522 To disable decoding entirely, use --no-itrace.
523
524 --full-source-path
525 Show the full path for source files for srcline output.
526
527 --show-ref-call-graph
528 When multiple events are sampled, it may not be needed to collect
529 callgraphs for all of them. The sample sites are usually nearby,
530 and it’s enough to collect the callgraphs on a reference event. So
531 user can use "call-graph=no" event modifier to disable callgraph
532 for other events to reduce the overhead. However, perf report
533 cannot show callgraphs for the event which disable the callgraph.
534 This option extends the perf report to show reference callgraphs,
535 which collected by reference event, in no callgraph event.
536
537 --socket-filter
538 Only report the samples on the processor socket that match with
539 this filter
540
541 --samples=N
542 Save N individual samples for each histogram entry to show context
543 in perf report tui browser.
544
545 --raw-trace
546 When displaying traceevent output, do not use print fmt or plugins.
547
548 --hierarchy
549 Enable hierarchical output.
550
551 --inline
552 If a callgraph address belongs to an inlined function, the inline
553 stack will be printed. Each entry is function name or file/line.
554 Enabled by default, disable with --no-inline.
555
556 --mmaps
557 Show --tasks output plus mmap information in a format similar to
558 /proc/<PID>/maps.
559
560 Please note that not all mmaps are stored, options affecting which ones
561 are include 'perf record --data', for instance.
562
563 --ns
564 Show time stamps in nanoseconds.
565
566 --stats
567 Display overall events statistics without any further processing.
568 (like the one at the end of the perf report -D command)
569
570 --tasks
571 Display monitored tasks stored in perf data. Displaying
572 pid/tid/ppid plus the command string aligned to distinguish parent
573 and child tasks.
574
575 --percent-type
576 Set annotation percent type from following choices: global-period,
577 local-period, global-hits, local-hits
578
579 The local/global keywords set if the percentage is computed
580 in the scope of the function (local) or the whole data (global).
581 The period/hits keywords set the base the percentage is computed
582 on - the samples period or the number of samples (hits).
583
584 --time-quantum
585 Configure time quantum for time sort key. Default 100ms. Accepts s,
586 us, ms, ns units.
587
589 The overhead can be shown in two columns as Children and Self when perf
590 collects callchains. The self overhead is simply calculated by adding
591 all period values of the entry - usually a function (symbol). This is
592 the value that perf shows traditionally and sum of all the self
593 overhead values should be 100%.
594
595 The children overhead is calculated by adding all period values of the
596 child functions so that it can show the total overhead of the higher
597 level functions even if they don’t directly execute much. Children here
598 means functions that are called from another (parent) function.
599
600 It might be confusing that the sum of all the children overhead values
601 exceeds 100% since each of them is already an accumulation of self
602 overhead of its child functions. But with this enabled, users can find
603 which function has the most overhead even if samples are spread over
604 the children.
605
606 Consider the following example; there are three functions like below.
607
608
609 .ft C
610 void foo(void) {
611 /* do something */
612 }
613
614 void bar(void) {
615 /* do something */
616 foo();
617 }
618
619 int main(void) {
620 bar()
621 return 0;
622 }
623 .ft
624
625
626 In this case foo is a child of bar, and bar is an immediate child of
627 main so foo also is a child of main. In other words, main is a parent
628 of foo and bar, and bar is a parent of foo.
629
630 Suppose all samples are recorded in foo and bar only. When it’s
631 recorded with callchains the output will show something like below in
632 the usual (self-overhead-only) output of perf report:
633
634
635 .ft C
636 Overhead Symbol
637 ........ .....................
638 60.00% foo
639 |
640 --- foo
641 bar
642 main
643 __libc_start_main
644
645 40.00% bar
646 |
647 --- bar
648 main
649 __libc_start_main
650 .ft
651
652
653 When the --children option is enabled, the self overhead values of
654 child functions (i.e. foo and bar) are added to the parents to
655 calculate the children overhead. In this case the report could be
656 displayed as:
657
658
659 .ft C
660 Children Self Symbol
661 ........ ........ ....................
662 100.00% 0.00% __libc_start_main
663 |
664 --- __libc_start_main
665
666 100.00% 0.00% main
667 |
668 --- main
669 __libc_start_main
670
671 100.00% 40.00% bar
672 |
673 --- bar
674 main
675 __libc_start_main
676
677 60.00% 60.00% foo
678 |
679 --- foo
680 bar
681 main
682 __libc_start_main
683 .ft
684
685
686 In the above output, the self overhead of foo (60%) was add to the
687 children overhead of bar, main and __libc_start_main. Likewise, the
688 self overhead of bar (40%) was added to the children overhead of main
689 and \_\_libc_start_main.
690
691 So \_\_libc_start_main and main are shown first since they have same
692 (100%) children overhead (even though they have zero self overhead) and
693 they are the parents of foo and bar.
694
695 Since v3.16 the children overhead is shown by default and the output is
696 sorted by its values. The children overhead is disabled by specifying
697 --no-children option on the command line or by adding report.children =
698 false or top.children = false in the perf config file.
699
701 perf-stat(1), perf-annotate(1), perf-record(1)
702
703
704
705perf 06/03/2019 PERF-REPORT(1)