xref: /linux/tools/perf/Documentation/perf-report.txt (revision e7e86d7697c6ed1dbbde18d7185c35b6967945ed)
1perf-report(1)
2==============
3
4NAME
5----
6perf-report - Read perf.data (created by perf record) and display the profile
7
8SYNOPSIS
9--------
10[verse]
11'perf report' [-i <file> | --input=file]
12
13DESCRIPTION
14-----------
15This command displays the performance counter profile information recorded
16via perf record.
17
18OPTIONS
19-------
20-i::
21--input=::
22        Input file name. (default: perf.data unless stdin is a fifo)
23
24-v::
25--verbose::
26        Be more verbose. (show symbol address, etc)
27
28-q::
29--quiet::
30	Do not show any warnings or messages.  (Suppress -v)
31
32-n::
33--show-nr-samples::
34	Show the number of samples for each symbol
35
36--show-cpu-utilization::
37        Show sample percentage for different cpu modes.
38
39-T::
40--threads::
41	Show per-thread event counters.  The input data file should be recorded
42	with -s option.
43-c::
44--comms=::
45	Only consider symbols in these comms. CSV that understands
46	file://filename entries.  This option will affect the percentage of
47	the overhead and latency columns.  See --percentage for more info.
48--pid=::
49        Only show events for given process ID (comma separated list).
50
51--tid=::
52        Only show events for given thread ID (comma separated list).
53-d::
54--dsos=::
55	Only consider symbols in these dsos. CSV that understands
56	file://filename entries.  This option will affect the percentage of
57	the overhead and latency columns.  See --percentage for more info.
58-S::
59--symbols=::
60	Only consider these symbols. CSV that understands
61	file://filename entries.  This option will affect the percentage of
62	the overhead and latency columns.  See --percentage for more info.
63
64--symbol-filter=::
65	Only show symbols that match (partially) with this filter.
66
67-U::
68--hide-unresolved::
69        Only display entries resolved to a symbol.
70
71--parallelism::
72        Only consider these parallelism levels. Parallelism level is the number
73        of threads that actively run on CPUs at the time of sample. The flag
74        accepts single number, comma-separated list, and ranges (for example:
75        "1", "7,8", "1,64-128"). This is useful in understanding what a program
76        is doing during sequential/low-parallelism phases as compared to
77        high-parallelism phases. This option will affect the percentage of
78        the overhead and latency columns. See --percentage for more info.
79        Also see the `CPU and latency overheads' section for more details.
80
81--latency::
82        Show latency-centric profile rather than the default
83        CPU-consumption-centric profile
84        (requires perf record --latency flag).
85
86-s::
87--sort=::
88	Sort histogram entries by given key(s) - multiple keys can be specified
89	in CSV format.  Following sort keys are available:
90	pid, comm, dso, symbol, parent, cpu, socket, srcline, weight,
91	local_weight, cgroup_id, addr.
92
93	Each key has following meaning:
94
95	- comm: command (name) of the task which can be read via /proc/<pid>/comm
96	- pid: command and tid of the task
97	- tgid: command and tgid of the task
98	- dso: name of library or module executed at the time of sample
99	- dso_size: size of library or module executed at the time of sample
100	- symbol: name of function executed at the time of sample
101	- symbol_size: size of function executed at the time of sample
102	- parent: name of function matched to the parent regex filter. Unmatched
103	entries are displayed as "[other]".
104	- cpu: cpu number the task ran at the time of sample
105	- socket: processor socket number the task ran at the time of sample
106	- parallelism: number of running threads at the time of sample
107	- srcline: filename and line number executed at the time of sample.  The
108	DWARF debugging info must be provided.
109	- srcfile: file name of the source file of the samples. Requires dwarf
110	information.
111	- weight: Event specific weight, e.g. memory latency or transaction
112	abort cost. This is the global weight.
113	- local_weight: Local weight version of the weight above.
114	- cgroup_id: ID derived from cgroup namespace device and inode numbers.
115	- cgroup: cgroup pathname in the cgroupfs.
116	- transaction: Transaction abort flags.
117	- overhead: CPU overhead percentage of sample.
118	- latency: latency (wall-clock) overhead percentage of sample.
119	  See the `CPU and latency overheads' section for more details.
120	- overhead_sys: CPU overhead percentage of sample running in system mode
121	- overhead_us: CPU overhead percentage of sample running in user mode
122	- overhead_guest_sys: CPU overhead percentage of sample running in system mode
123	on guest machine
124	- overhead_guest_us: CPU overhead percentage of sample running in user mode on
125	guest machine
126	- sample: Number of sample
127	- period: Raw number of event count of sample
128	- time: Separate the samples by time stamp with the resolution specified by
129	--time-quantum (default 100ms). Specify with overhead and before it.
130	- code_page_size: the code page size of sampled code address (ip)
131	- ins_lat: Instruction latency in core cycles. This is the global instruction
132	  latency
133	- local_ins_lat: Local instruction latency version
134	- p_stage_cyc: On powerpc, this presents the number of cycles spent in a
135	  pipeline stage. And currently supported only on powerpc.
136	- addr: (Full) virtual address of the sampled instruction
137	- retire_lat: On X86, this reports pipeline stall of this instruction compared
138	  to the previous instruction in cycles. And currently supported only on X86
139	- simd: Flags describing a SIMD operation. "e" for empty Arm SVE predicate. "p" for partial Arm SVE predicate
140	- type: Data type of sample memory access.
141	- typeoff: Offset in the data type of sample memory access.
142	- symoff: Offset in the symbol.
143	- weight1: Average value of event specific weight (1st field of weight_struct).
144	- weight2: Average value of event specific weight (2nd field of weight_struct).
145	- weight3: Average value of event specific weight (3rd field of weight_struct).
146
147	By default, overhead, comm, dso and symbol keys are used.
148	(i.e. --sort overhead,comm,dso,symbol).
149
150	If --branch-stack option is used, following sort keys are also
151	available:
152
153	- dso_from: name of library or module branched from
154	- dso_to: name of library or module branched to
155	- symbol_from: name of function branched from
156	- symbol_to: name of function branched to
157	- srcline_from: source file and line branched from
158	- srcline_to: source file and line branched to
159	- mispredict: "N" for predicted branch, "Y" for mispredicted branch
160	- in_tx: branch in TSX transaction
161	- abort: TSX transaction abort.
162	- cycles: Cycles in basic block
163
164	And default sort keys are changed to comm, dso_from, symbol_from, dso_to
165	and symbol_to, see '--branch-stack'.
166
167	When the sort key symbol is specified, columns "IPC" and "IPC Coverage"
168	are enabled automatically. Column "IPC" reports the average IPC per function
169	and column "IPC coverage" reports the percentage of instructions with
170	sampled IPC in this function. IPC means Instruction Per Cycle. If it's low,
171	it indicates there may be a performance bottleneck when the function is
172	executed, such as a memory access bottleneck. If a function has high overhead
173	and low IPC, it's worth further analyzing it to optimize its performance.
174
175	If the --mem-mode option is used, the following sort keys are also available
176	(incompatible with --branch-stack):
177	symbol_daddr, dso_daddr, locked, tlb, mem, snoop, dcacheline, blocked.
178
179	- symbol_daddr: name of data symbol being executed on at the time of sample
180	- dso_daddr: name of library or module containing the data being executed
181	on at the time of the sample
182	- locked: whether the bus was locked at the time of the sample
183	- tlb: type of tlb access for the data at the time of the sample
184	- mem: type of memory access for the data at the time of the sample
185	- snoop: type of snoop (if any) for the data at the time of the sample
186	- dcacheline: the cacheline the data address is on at the time of the sample
187	- phys_daddr: physical address of data being executed on at the time of sample
188	- data_page_size: the data page size of data being executed on at the time of sample
189	- blocked: reason of blocked load access for the data at the time of the sample
190
191	And the default sort keys are changed to local_weight, mem, sym, dso,
192	symbol_daddr, dso_daddr, snoop, tlb, locked, blocked, local_ins_lat,
193	see '--mem-mode'.
194
195	If the data file has tracepoint event(s), following (dynamic) sort keys
196	are also available:
197	trace, trace_fields, [<event>.]<field>[/raw]
198
199	- trace: pretty printed trace output in a single column
200	- trace_fields: fields in tracepoints in separate columns
201	- <field name>: optional event and field name for a specific field
202
203	The last form consists of event and field names.  If event name is
204	omitted, it searches all events for matching field name.  The matched
205	field will be shown only for the event has the field.  The event name
206	supports substring match so user doesn't need to specify full subsystem
207	and event name everytime.  For example, 'sched:sched_switch' event can
208	be shortened to 'switch' as long as it's not ambiguous.  Also event can
209	be specified by its index (starting from 1) preceded by the '%'.
210	So '%1' is the first event, '%2' is the second, and so on.
211
212	The field name can have '/raw' suffix which disables pretty printing
213	and shows raw field value like hex numbers.  The --raw-trace option
214	has the same effect for all dynamic sort keys.
215
216	The default sort keys are changed to 'trace' if all events in the data
217	file are tracepoint.
218
219-F::
220--fields=::
221	Specify output field - multiple keys can be specified in CSV format.
222	Following fields are available:
223	overhead, latency, overhead_sys, overhead_us, overhead_children, sample,
224	period, weight1, weight2, weight3, ins_lat, p_stage_cyc and retire_lat.
225	The last 3 names are alias for the corresponding weights.  When the weight
226	fields are used, they will show the average value of the weight.
227
228	Also it can 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::
237--parent=<regex>::
238        A regex filter to identify parent. The parent is a caller of this
239	function and searched through the callchain, thus it requires callchain
240	information recorded. The pattern is in the extended regex format and
241	defaults to "\^sys_|^do_page_fault", see '--sort parent'.
242
243-x::
244--exclude-other::
245        Only display entries with parent-match.
246
247-w::
248--column-widths=<width[,width...]>::
249	Force each column width to the provided list, for large terminal
250	readability.  0 means no limit (default behavior).
251
252-t::
253--field-separator=::
254	Use a special separator character and don't pad with spaces, replacing
255	all occurrences of this separator in symbol names (and other output)
256	with a '.' character, that thus it's the only non valid separator.
257
258-D::
259--dump-raw-trace::
260        Dump raw trace in ASCII.
261
262--disable-order::
263	Disable raw trace ordering.
264
265-g::
266--call-graph=<print_type,threshold[,print_limit],order,sort_key[,branch],value>::
267        Display call chains using type, min percent threshold, print limit,
268	call order, sort key, optional branch and value.  Note that ordering
269	is not fixed so any parameter can be given in an arbitrary order.
270	One exception is the print_limit which should be preceded by 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 recorded.
311	See the `Overhead calculation' section for more details. Enabled by
312	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.
319	Note that when using the --itrace option the synthesized callchain size
320	will override this value if the synthesized callchain size is bigger.
321
322	Default: 127
323
324-G::
325--inverted::
326        alias for inverted caller based call graph.
327
328--ignore-callees=<regex>::
329        Ignore callees of the function(s) matching the given regex.
330        This has the effect of collecting the callers of each such
331        function into one place in the call-graph tree.
332
333--pretty=<key>::
334        Pretty printing style.  key: normal, raw
335
336--stdio:: Use the stdio interface.
337
338--stdio-color::
339	'always', 'never' or 'auto', allowing configuring color output
340	via the command line, in addition to via "color.ui" .perfconfig.
341	Use '--stdio-color always' to generate color even when redirecting
342	to a pipe or file. Using just '--stdio-color' is equivalent to
343	using 'always'.
344
345--tui:: Use the TUI interface, that is integrated with annotate and allows
346        zooming into DSOs or threads, among other features. Use of --tui
347	requires a tty, if one is not present, as when piping to other
348	commands, the stdio interface is used.
349
350--gtk:: Use the GTK2 interface.
351
352-k::
353--vmlinux=<file>::
354        vmlinux pathname
355
356--ignore-vmlinux::
357	Ignore vmlinux files.
358
359--kallsyms=<file>::
360        kallsyms pathname
361
362-m::
363--modules::
364        Load module symbols. WARNING: This should only be used with -k and
365        a LIVE kernel.
366
367-f::
368--force::
369        Don't do ownership validation.
370
371--symfs=<directory>::
372        Look for files with symbols relative to this directory.
373
374-C::
375--cpu:: Only report samples for the list of CPUs provided. Multiple CPUs can
376	be provided as a comma-separated list with no space: 0,1. Ranges of
377	CPUs are specified with -: 0-2. Default is to report samples on all
378	CPUs.
379
380-M::
381--disassembler-style=:: Set disassembler style for objdump.
382
383--source::
384	Interleave source code with assembly code. Enabled by default,
385	disable with --no-source.
386
387--asm-raw::
388	Show raw instruction encoding of assembly instructions.
389
390--show-total-period:: Show a column with the sum of periods.
391
392-I::
393--show-info::
394	Display extended information about the perf.data file. This adds
395	information which may be very large and thus may clutter the display.
396	It currently includes: cpu and numa topology of the host system.
397
398-b::
399--branch-stack::
400	Use the addresses of sampled taken branches instead of the instruction
401	address to build the histograms. To generate meaningful output, the
402	perf.data file must have been obtained using perf record -b or
403	perf record --branch-filter xxx where xxx is a branch filter option.
404	perf report is able to auto-detect whether a perf.data file contains
405	branch stacks and it will automatically switch to the branch view mode,
406	unless --no-branch-stack is used.
407
408--branch-history::
409	Add the addresses of sampled taken branches to the callstack.
410	This allows to examine the path the program took to each sample.
411	The data collection must have used -b (or -j) and -g.
412
413	Also show with some branch flags that can be:
414	- Predicted: display the average percentage of predicated branches.
415		     (predicated number / total number)
416	- Abort: display the number of tsx aborted branches.
417	- Cycles: cycles in basic block.
418
419	- iterations: display the average number of iterations in callchain list.
420
421--addr2line=<path>::
422        Path to addr2line binary.
423
424--objdump=<path>::
425        Path to objdump binary.
426
427--prefix=PREFIX::
428--prefix-strip=N::
429	Remove first N entries from source file path names in executables
430	and add PREFIX. This allows to display source code compiled on systems
431	with different file system layout.
432
433--group::
434	Show event group information together. It forces group output also
435	if there are no groups defined in data file.
436
437--group-sort-idx::
438	Sort the output by the event at the index n in group. If n is invalid,
439	sort by the first event. It can support multiple groups with different
440	amount of events. WARNING: This should be used on grouped events.
441
442--demangle::
443	Demangle symbol names to human readable form. It's enabled by default,
444	disable with --no-demangle.
445
446--demangle-kernel::
447	Demangle kernel symbol names to human readable form (for C++ kernels).
448
449--mem-mode::
450	Use the data addresses of samples in addition to instruction addresses
451	to build the histograms.  To generate meaningful output, the perf.data
452	file must have been obtained using perf record -d -W and using a
453	special event -e cpu/mem-loads/p or -e cpu/mem-stores/p. See
454	'perf mem' for simpler access.
455
456--percent-limit::
457	Do not show entries which have an overhead under that percent.
458	(Default: 0).  Note that this option also sets the percent limit (threshold)
459	of callchains.  However the default value of callchain threshold is
460	different than the default value of hist entries.  Please see the
461	--call-graph option for details.
462
463--percentage::
464	Determine how to display the CPU and latency overhead percentage
465	of filtered entries. Filters can be applied by --comms, --dsos, --symbols
466	and/or --parallelism options and Zoom operations on the TUI (thread, dso, etc).
467
468	"relative" means it's relative to filtered entries only so that the
469	sum of shown entries will be always 100%.  "absolute" means it retains
470	the original value before and after the filter is applied.
471
472--header::
473	Show header information in the perf.data file.  This includes
474	various information like hostname, OS and perf version, cpu/mem
475	info, perf command line, event list and so on.  Currently only
476	--stdio output supports this feature.
477
478--header-only::
479	Show only perf.data header (forces --stdio).
480
481--time::
482	Only analyze samples within given time window: <start>,<stop>. Times
483	have the format seconds.nanoseconds. If start is not given (i.e. time
484	string is ',x.y') then analysis starts at the beginning of the file. If
485	stop time is not given (i.e. time string is 'x.y,') then analysis goes
486	to end of file. Multiple ranges can be separated by spaces, which
487	requires the argument to be quoted e.g. --time "1234.567,1234.789 1235,"
488
489	Also support time percent with multiple time ranges. Time string is
490	'a%/n,b%/m,...' or 'a%-b%,c%-%d,...'.
491
492	For example:
493	Select the second 10% time slice:
494
495	  perf report --time 10%/2
496
497	Select from 0% to 10% time slice:
498
499	  perf report --time 0%-10%
500
501	Select the first and second 10% time slices:
502
503	  perf report --time 10%/1,10%/2
504
505	Select from 0% to 10% and 30% to 40% slices:
506
507	  perf report --time 0%-10%,30%-40%
508
509--switch-on EVENT_NAME::
510	Only consider events after this event is found.
511
512	This may be interesting to measure a workload only after some initialization
513	phase is over, i.e. insert a perf probe at that point and then using this
514	option with that probe.
515
516--switch-off EVENT_NAME::
517	Stop considering events after this event is found.
518
519--show-on-off-events::
520	Show the --switch-on/off events too. This has no effect in 'perf report' now
521	but probably we'll make the default not to show the switch-on/off events
522        on the --group mode and if there is only one event besides the off/on ones,
523	go straight to the histogram browser, just like 'perf report' with no events
524	explicitly specified does.
525
526--itrace::
527	Options for decoding instruction tracing data. The options are:
528
529include::itrace.txt[]
530
531	To disable decoding entirely, use --no-itrace.
532
533--full-source-path::
534	Show the full path for source files for srcline output.
535
536--show-ref-call-graph::
537	When multiple events are sampled, it may not be needed to collect
538	callgraphs for all of them. The sample sites are usually nearby,
539	and it's enough to collect the callgraphs on a reference event.
540	So user can use "call-graph=no" event modifier to disable callgraph
541	for other events to reduce the overhead.
542	However, perf report cannot show callgraphs for the event which
543	disable the callgraph.
544	This option extends the perf report to show reference callgraphs,
545	which collected by reference event, in no callgraph event.
546
547--stitch-lbr::
548	Show callgraph with stitched LBRs, which may have more complete
549	callgraph. The perf.data file must have been obtained using
550	perf record --call-graph lbr.
551	Disabled by default. In common cases with call stack overflows,
552	it can recreate better call stacks than the default lbr call stack
553	output. But this approach is not foolproof. There can be cases
554	where it creates incorrect call stacks from incorrect matches.
555	The known limitations include exception handing such as
556	setjmp/longjmp will have calls/returns not match.
557
558--socket-filter::
559	Only report the samples on the processor socket that match with this filter
560
561--samples=N::
562	Save N individual samples for each histogram entry to show context in perf
563	report tui browser.
564
565--raw-trace::
566	When displaying traceevent output, do not use print fmt or plugins.
567
568-H::
569--hierarchy::
570	Enable hierarchical output.  In the hierarchy mode, each sort key groups
571	samples based on the criteria and then sub-divide it using the lower
572	level sort key.
573
574	For example:
575	In normal output:
576
577	  perf report -s dso,sym
578	  # Overhead  Shared Object      Symbol
579	      50.00%  [kernel.kallsyms]  [k] kfunc1
580	      20.00%  perf               [.] foo
581	      15.00%  [kernel.kallsyms]  [k] kfunc2
582	      10.00%  perf               [.] bar
583	       5.00%  libc.so            [.] libcall
584
585	In hierarchy output:
586
587	  perf report -s dso,sym --hierarchy
588	  #   Overhead  Shared Object / Symbol
589	      65.00%    [kernel.kallsyms]
590	        50.00%    [k] kfunc1
591	        15.00%    [k] kfunc2
592	      30.00%    perf
593	        20.00%    [.] foo
594	        10.00%    [.] bar
595	       5.00%    libc.so
596	         5.00%    [.] libcall
597
598--inline::
599	If a callgraph address belongs to an inlined function, the inline stack
600	will be printed. Each entry is function name or file/line. Enabled by
601	default, disable with --no-inline.
602
603--mmaps::
604	Show --tasks output plus mmap information in a format similar to
605	/proc/<PID>/maps.
606
607	Please note that not all mmaps are stored, options affecting which ones
608	are include 'perf record --data', for instance.
609
610--ns::
611	Show time stamps in nanoseconds.
612
613--stats::
614	Display overall events statistics without any further processing.
615	(like the one at the end of the perf report -D command)
616
617--tasks::
618	Display monitored tasks stored in perf data. Displaying pid/tid/ppid
619	plus the command string aligned to distinguish parent and child tasks.
620
621--percent-type::
622	Set annotation percent type from following choices:
623	  global-period, local-period, global-hits, local-hits
624
625	The local/global keywords set if the percentage is computed
626	in the scope of the function (local) or the whole data (global).
627	The period/hits keywords set the base the percentage is computed
628	on - the samples period or the number of samples (hits).
629
630--time-quantum::
631	Configure time quantum for time sort key. Default 100ms.
632	Accepts s, us, ms, ns units.
633
634--total-cycles::
635	When --total-cycles is specified, it supports sorting for all blocks by
636	'Sampled Cycles%'. This is useful to concentrate on the globally hottest
637	blocks. In output, there are some new columns:
638
639	'Sampled Cycles%' - block sampled cycles aggregation / total sampled cycles
640	'Sampled Cycles'  - block sampled cycles aggregation
641	'Avg Cycles%'     - block average sampled cycles / sum of total block average
642			    sampled cycles
643	'Avg Cycles'      - block average sampled cycles
644	'Branch Counter'  - block branch counter histogram (with -v showing the number)
645
646--skip-empty::
647	Do not print 0 results in the --stat output.
648
649include::cpu-and-latency-overheads.txt[]
650
651include::callchain-overhead-calculation.txt[]
652
653SEE ALSO
654--------
655linkperf:perf-stat[1], linkperf:perf-annotate[1], linkperf:perf-record[1],
656linkperf:perf-intel-pt[1]
657