xref: /linux/tools/perf/Documentation/perf-top.txt (revision e3b9f1e81de2083f359bacd2a94bf1c024f2ede0)
1perf-top(1)
2===========
3
4NAME
5----
6perf-top - System profiling tool.
7
8SYNOPSIS
9--------
10[verse]
11'perf top' [-e <EVENT> | --event=EVENT] [<options>]
12
13DESCRIPTION
14-----------
15This command generates and displays a performance counter profile in real time.
16
17
18OPTIONS
19-------
20-a::
21--all-cpus::
22        System-wide collection.  (default)
23
24-c <count>::
25--count=<count>::
26	Event period to sample.
27
28-C <cpu-list>::
29--cpu=<cpu>::
30Monitor only on the list of CPUs provided. Multiple CPUs can be provided as a
31comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2.
32Default is to monitor all CPUS.
33
34-d <seconds>::
35--delay=<seconds>::
36	Number of seconds to delay between refreshes.
37
38-e <event>::
39--event=<event>::
40	Select the PMU event. Selection can be a symbolic event name
41	(use 'perf list' to list all events) or a raw PMU
42	event (eventsel+umask) in the form of rNNN where NNN is a
43	hexadecimal event descriptor.
44
45-E <entries>::
46--entries=<entries>::
47	Display this many functions.
48
49-f <count>::
50--count-filter=<count>::
51	Only display functions with more events than this.
52
53--group::
54        Put the counters into a counter group.
55
56-F <freq>::
57--freq=<freq>::
58	Profile at this frequency. Use 'max' to use the currently maximum
59	allowed frequency, i.e. the value in the kernel.perf_event_max_sample_rate
60	sysctl.
61
62-i::
63--inherit::
64	Child tasks do not inherit counters.
65
66-k <path>::
67--vmlinux=<path>::
68	Path to vmlinux.  Required for annotation functionality.
69
70-m <pages>::
71--mmap-pages=<pages>::
72	Number of mmap data pages (must be a power of two) or size
73	specification with appended unit character - B/K/M/G. The
74	size is rounded up to have nearest pages power of two value.
75
76-p <pid>::
77--pid=<pid>::
78	Profile events on existing Process ID (comma separated list).
79
80-t <tid>::
81--tid=<tid>::
82        Profile events on existing thread ID (comma separated list).
83
84-u::
85--uid=::
86        Record events in threads owned by uid. Name or number.
87
88-r <priority>::
89--realtime=<priority>::
90	Collect data with this RT SCHED_FIFO priority.
91
92--sym-annotate=<symbol>::
93        Annotate this symbol.
94
95-K::
96--hide_kernel_symbols::
97        Hide kernel symbols.
98
99-U::
100--hide_user_symbols::
101        Hide user symbols.
102
103--demangle-kernel::
104        Demangle kernel symbols.
105
106-D::
107--dump-symtab::
108        Dump the symbol table used for profiling.
109
110-v::
111--verbose::
112	Be more verbose (show counter open errors, etc).
113
114-z::
115--zero::
116	Zero history across display updates.
117
118-s::
119--sort::
120	Sort by key(s): pid, comm, dso, symbol, parent, srcline, weight,
121	local_weight, abort, in_tx, transaction, overhead, sample, period.
122	Please see description of --sort in the perf-report man page.
123
124--fields=::
125	Specify output field - multiple keys can be specified in CSV format.
126	Following fields are available:
127	overhead, overhead_sys, overhead_us, overhead_children, sample and period.
128	Also it can contain any sort key(s).
129
130	By default, every sort keys not specified in --field will be appended
131	automatically.
132
133-n::
134--show-nr-samples::
135	Show a column with the number of samples.
136
137--show-total-period::
138	Show a column with the sum of periods.
139
140--dsos::
141	Only consider symbols in these dsos.  This option will affect the
142	percentage of the overhead column.  See --percentage for more info.
143
144--comms::
145	Only consider symbols in these comms.  This option will affect the
146	percentage of the overhead column.  See --percentage for more info.
147
148--symbols::
149	Only consider these symbols.  This option will affect the
150	percentage of the overhead column.  See --percentage for more info.
151
152-M::
153--disassembler-style=:: Set disassembler style for objdump.
154
155--source::
156	Interleave source code with assembly code. Enabled by default,
157	disable with --no-source.
158
159--asm-raw::
160	Show raw instruction encoding of assembly instructions.
161
162-g::
163	Enables call-graph (stack chain/backtrace) recording.
164
165--call-graph [mode,type,min[,limit],order[,key][,branch]]::
166	Setup and enable call-graph (stack chain/backtrace) recording,
167	implies -g.  See `--call-graph` section in perf-record and
168	perf-report man pages for details.
169
170--children::
171	Accumulate callchain of children to parent entry so that then can
172	show up in the output.  The output will have a new "Children" column
173	and will be sorted on the data.  It requires -g/--call-graph option
174	enabled.  See the `overhead calculation' section for more details.
175	Enabled by default, disable with --no-children.
176
177--max-stack::
178	Set the stack depth limit when parsing the callchain, anything
179	beyond the specified depth will be ignored. This is a trade-off
180	between information loss and faster processing especially for
181	workloads that can have a very long callchain stack.
182
183	Default: /proc/sys/kernel/perf_event_max_stack when present, 127 otherwise.
184
185--ignore-callees=<regex>::
186        Ignore callees of the function(s) matching the given regex.
187        This has the effect of collecting the callers of each such
188        function into one place in the call-graph tree.
189
190--percent-limit::
191	Do not show entries which have an overhead under that percent.
192	(Default: 0).
193
194--percentage::
195	Determine how to display the overhead percentage of filtered entries.
196	Filters can be applied by --comms, --dsos and/or --symbols options and
197	Zoom operations on the TUI (thread, dso, etc).
198
199	"relative" means it's relative to filtered entries only so that the
200	sum of shown entries will be always 100%. "absolute" means it retains
201	the original value before and after the filter is applied.
202
203-w::
204--column-widths=<width[,width...]>::
205	Force each column width to the provided list, for large terminal
206	readability.  0 means no limit (default behavior).
207
208--proc-map-timeout::
209	When processing pre-existing threads /proc/XXX/mmap, it may take
210	a long time, because the file may be huge. A time out is needed
211	in such cases.
212	This option sets the time out limit. The default value is 500 ms.
213
214
215-b::
216--branch-any::
217	Enable taken branch stack sampling. Any type of taken branch may be sampled.
218	This is a shortcut for --branch-filter any. See --branch-filter for more infos.
219
220-j::
221--branch-filter::
222	Enable taken branch stack sampling. Each sample captures a series of consecutive
223	taken branches. The number of branches captured with each sample depends on the
224	underlying hardware, the type of branches of interest, and the executed code.
225	It is possible to select the types of branches captured by enabling filters.
226	For a full list of modifiers please see the perf record manpage.
227
228	The option requires at least one branch type among any, any_call, any_ret, ind_call, cond.
229	The privilege levels may be omitted, in which case, the privilege levels of the associated
230	event are applied to the branch filter. Both kernel (k) and hypervisor (hv) privilege
231	levels are subject to permissions.  When sampling on multiple events, branch stack sampling
232	is enabled for all the sampling events. The sampled branch type is the same for all events.
233	The various filters must be specified as a comma separated list: --branch-filter any_ret,u,k
234	Note that this feature may not be available on all processors.
235
236--raw-trace::
237	When displaying traceevent output, do not use print fmt or plugins.
238
239--hierarchy::
240	Enable hierarchy output.
241
242--force::
243	Don't do ownership validation.
244
245--num-thread-synthesize::
246	The number of threads to run when synthesizing events for existing processes.
247	By default, the number of threads equals to the number of online CPUs.
248
249INTERACTIVE PROMPTING KEYS
250--------------------------
251
252[d]::
253	Display refresh delay.
254
255[e]::
256	Number of entries to display.
257
258[E]::
259	Event to display when multiple counters are active.
260
261[f]::
262	Profile display filter (>= hit count).
263
264[F]::
265	Annotation display filter (>= % of total).
266
267[s]::
268	Annotate symbol.
269
270[S]::
271	Stop annotation, return to full profile display.
272
273[K]::
274	Hide kernel symbols.
275
276[U]::
277	Hide user symbols.
278
279[z]::
280	Toggle event count zeroing across display updates.
281
282[qQ]::
283	Quit.
284
285Pressing any unmapped key displays a menu, and prompts for input.
286
287include::callchain-overhead-calculation.txt[]
288
289SEE ALSO
290--------
291linkperf:perf-stat[1], linkperf:perf-list[1], linkperf:perf-report[1]
292