xref: /linux/tools/perf/Documentation/perf-annotate.txt (revision 5ea5880764cbb164afb17a62e76ca75dc371409d)
1perf-annotate(1)
2================
3
4NAME
5----
6perf-annotate - Read perf.data (created by perf record) and display annotated code
7
8SYNOPSIS
9--------
10[verse]
11'perf annotate' [-i <file> | --input=file] [symbol_name]
12
13DESCRIPTION
14-----------
15This command reads the input file and displays an annotated version of the
16code. If the object file has debug symbols then the source code will be
17displayed alongside assembly code.
18
19If there is no debug info in the object, then annotated assembly is displayed.
20
21OPTIONS
22-------
23-i::
24--input=<file>::
25        Input file name. (default: perf.data unless stdin is a fifo)
26
27-d::
28--dsos=<dso[,dso...]>::
29        Only consider symbols in these dsos.
30-s::
31--symbol=<symbol>::
32        Symbol to annotate.
33
34-f::
35--force::
36        Don't do ownership validation.
37
38-v::
39--verbose::
40        Be more verbose. (Show symbol address, etc)
41
42-q::
43--quiet::
44	Do not show any warnings or messages.  (Suppress -v)
45
46-n::
47--show-nr-samples::
48	Show the number of samples for each symbol
49
50-D::
51--dump-raw-trace::
52        Dump raw trace in ASCII.
53
54-k::
55--vmlinux=<file>::
56        vmlinux pathname.
57
58--ignore-vmlinux::
59	Ignore vmlinux files.
60
61--itrace::
62	Options for decoding instruction tracing data. The options are:
63
64include::itrace.txt[]
65
66	To disable decoding entirely, use --no-itrace.
67
68-m::
69--modules::
70        Load module symbols. WARNING: use only with -k and LIVE kernel.
71
72-l::
73--print-line::
74        Print matching source lines (may be slow).
75
76-P::
77--full-paths::
78        Don't shorten the displayed pathnames.
79
80--stdio:: Use the stdio interface.
81
82--stdio2:: Use the stdio2 interface, non-interactive, uses the TUI formatting.
83
84--stdio-color=<mode>::
85	'always', 'never' or 'auto', allowing configuring color output
86	via the command line, in addition to via "color.ui" .perfconfig.
87	Use '--stdio-color always' to generate color even when redirecting
88	to a pipe or file. Using just '--stdio-color' is equivalent to
89	using 'always'.
90
91--tui:: Use the TUI interface. Use of --tui requires a tty, if one is not
92	present, as when piping to other commands, the stdio interface is
93	used. This interfaces starts by centering on the line with more
94	samples, TAB/UNTAB cycles through the lines with more samples.
95
96--gtk:: Use the GTK interface.
97
98-C::
99--cpu=<cpu>:: Only report samples for the list of CPUs provided. Multiple CPUs can
100	be provided as a comma-separated list with no space: 0,1. Ranges of
101	CPUs are specified with -: 0-2. Default is to report samples on all
102	CPUs.
103
104--asm-raw::
105	Show raw instruction encoding of assembly instructions.
106
107--show-total-period:: Show a column with the sum of periods.
108
109--source::
110	Interleave source code with assembly code. Enabled by default,
111	disable with --no-source.
112
113--symfs=<directory[,layout]>::
114        Look for files with symbols relative to this directory. The optional
115        layout can be 'hierarchy' (default, matches full path) or 'flat'
116        (only matches base name). This is useful when debug files are stored
117        in a flat directory structure.
118
119-M::
120--disassembler-style=:: Set disassembler style for objdump.
121
122--addr2line=<path>::
123        Path to addr2line binary.
124
125--objdump=<path>::
126        Path to objdump binary.
127
128--prefix=PREFIX::
129--prefix-strip=N::
130	Remove first N entries from source file path names in executables
131	and add PREFIX. This allows to display source code compiled on systems
132	with different file system layout.
133
134--skip-missing::
135	Skip symbols that cannot be annotated.
136
137--group::
138	Show event group information together
139
140--demangle::
141	Demangle symbol names to human readable form. It's enabled by default,
142	disable with --no-demangle.
143
144--demangle-kernel::
145	Demangle kernel symbol names to human readable form (for C++ kernels).
146
147--percent-type::
148	Set annotation percent type from following choices:
149	  global-period, local-period, global-hits, local-hits
150
151	The local/global keywords set if the percentage is computed
152	in the scope of the function (local) or the whole data (global).
153	The period/hits keywords set the base the percentage is computed
154	on - the samples period or the number of samples (hits).
155
156--percent-limit::
157	Do not show functions which have an overhead under that percent on
158	stdio or stdio2 (Default: 0).  Note that this is about selection of
159	functions to display, not about lines within the function.
160
161--data-type[=TYPE_NAME]::
162	Display data type annotation instead of code.  It infers data type of
163	samples (if they are memory accessing instructions) using DWARF debug
164	information.  It can take an optional argument of data type name.  In
165	that case it'd show annotation for the type only, otherwise it'd show
166	all data types it finds.
167
168--type-stat::
169	Show stats for the data type annotation.
170
171--skip-empty::
172	Do not display empty (or dummy) events.
173
174--code-with-type::
175	Show data type info in code annotation (for memory instructions only).
176
177
178SEE ALSO
179--------
180linkperf:perf-record[1], linkperf:perf-report[1]
181