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