1PERF-TOP(1)                       perf Manual                      PERF-TOP(1)
2
3
4

NAME

6       perf-top - System profiling tool.
7

SYNOPSIS

9       perf top [-e <EVENT> | --event=EVENT] [<options>]
10

DESCRIPTION

12       This command generates and displays a performance counter profile in
13       real time.
14

OPTIONS

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

INTERACTIVE PROMPTING KEYS

225       [d]
226           Display refresh delay.
227
228       [e]
229           Number of entries to display.
230
231       [E]
232           Event to display when multiple counters are active.
233
234       [f]
235           Profile display filter (>= hit count).
236
237       [F]
238           Annotation display filter (>= % of total).
239
240       [s]
241           Annotate symbol.
242
243       [S]
244           Stop annotation, return to full profile display.
245
246       [K]
247           Hide kernel symbols.
248
249       [U]
250           Hide user symbols.
251
252       [z]
253           Toggle event count zeroing across display updates.
254
255       [qQ]
256           Quit.
257
258       Pressing any unmapped key displays a menu, and prompts for input.
259

OVERHEAD CALCULATION

261       The overhead can be shown in two columns as Children and Self when perf
262       collects callchains. The self overhead is simply calculated by adding
263       all period values of the entry - usually a function (symbol). This is
264       the value that perf shows traditionally and sum of all the self
265       overhead values should be 100%.
266
267       The children overhead is calculated by adding all period values of the
268       child functions so that it can show the total overhead of the higher
269       level functions even if they don’t directly execute much. Children here
270       means functions that are called from another (parent) function.
271
272       It might be confusing that the sum of all the children overhead values
273       exceeds 100% since each of them is already an accumulation of self
274       overhead of its child functions. But with this enabled, users can find
275       which function has the most overhead even if samples are spread over
276       the children.
277
278       Consider the following example; there are three functions like below.
279
280
281           .ft C
282           void foo(void) {
283               /* do something */
284           }
285
286           void bar(void) {
287               /* do something */
288               foo();
289           }
290
291           int main(void) {
292               bar()
293               return 0;
294           }
295           .ft
296
297
298       In this case foo is a child of bar, and bar is an immediate child of
299       main so foo also is a child of main. In other words, main is a parent
300       of foo and bar, and bar is a parent of foo.
301
302       Suppose all samples are recorded in foo and bar only. When it’s
303       recorded with callchains the output will show something like below in
304       the usual (self-overhead-only) output of perf report:
305
306
307           .ft C
308           Overhead  Symbol
309           ........  .....................
310             60.00%  foo
311                     |
312                     --- foo
313                         bar
314                         main
315                         __libc_start_main
316
317             40.00%  bar
318                     |
319                     --- bar
320                         main
321                         __libc_start_main
322           .ft
323
324
325       When the --children option is enabled, the self overhead values of
326       child functions (i.e. foo and bar) are added to the parents to
327       calculate the children overhead. In this case the report could be
328       displayed as:
329
330
331           .ft C
332           Children      Self  Symbol
333           ........  ........  ....................
334            100.00%     0.00%  __libc_start_main
335                     |
336                     --- __libc_start_main
337
338            100.00%     0.00%  main
339                     |
340                     --- main
341                         __libc_start_main
342
343            100.00%    40.00%  bar
344                     |
345                     --- bar
346                         main
347                         __libc_start_main
348
349             60.00%    60.00%  foo
350                     |
351                     --- foo
352                         bar
353                         main
354                         __libc_start_main
355           .ft
356
357
358       In the above output, the self overhead of foo (60%) was add to the
359       children overhead of bar, main and __libc_start_main. Likewise, the
360       self overhead of bar (40%) was added to the children overhead of main
361       and \_\_libc_start_main.
362
363       So \_\_libc_start_main and main are shown first since they have same
364       (100%) children overhead (even though they have zero self overhead) and
365       they are the parents of foo and bar.
366
367       Since v3.16 the children overhead is shown by default and the output is
368       sorted by its values. The children overhead is disabled by specifying
369       --no-children option on the command line or by adding report.children =
370       false or top.children = false in the perf config file.
371

SEE ALSO

373       perf-stat(1), perf-list(1), perf-report(1)
374
375
376
377perf                              09/24/2019                       PERF-TOP(1)
Impressum