Back to home page

OSCL-LXR

 
 

    


0001 perf-top(1)
0002 ===========
0003 
0004 NAME
0005 ----
0006 perf-top - System profiling tool.
0007 
0008 SYNOPSIS
0009 --------
0010 [verse]
0011 'perf top' [-e <EVENT> | --event=EVENT] [<options>]
0012 
0013 DESCRIPTION
0014 -----------
0015 This command generates and displays a performance counter profile in real time.
0016 
0017 
0018 OPTIONS
0019 -------
0020 -a::
0021 --all-cpus::
0022         System-wide collection.  (default)
0023 
0024 -c <count>::
0025 --count=<count>::
0026         Event period to sample.
0027 
0028 -C <cpu-list>::
0029 --cpu=<cpu>::
0030 Monitor only on the list of CPUs provided. Multiple CPUs can be provided as a
0031 comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2.
0032 Default is to monitor all CPUS.
0033 
0034 -d <seconds>::
0035 --delay=<seconds>::
0036         Number of seconds to delay between refreshes.
0037 
0038 -e <event>::
0039 --event=<event>::
0040         Select the PMU event. Selection can be a symbolic event name
0041         (use 'perf list' to list all events) or a raw PMU event in the form
0042         of rN where N is a hexadecimal value that represents the raw register
0043         encoding with the layout of the event control registers as described
0044         by entries in /sys/bus/event_source/devices/cpu/format/*.
0045 
0046 -E <entries>::
0047 --entries=<entries>::
0048         Display this many functions.
0049 
0050 -f <count>::
0051 --count-filter=<count>::
0052         Only display functions with more events than this.
0053 
0054 --group::
0055         Put the counters into a counter group.
0056 
0057 --group-sort-idx::
0058         Sort the output by the event at the index n in group. If n is invalid,
0059         sort by the first event. It can support multiple groups with different
0060         amount of events. WARNING: This should be used on grouped events.
0061 
0062 -F <freq>::
0063 --freq=<freq>::
0064         Profile at this frequency. Use 'max' to use the currently maximum
0065         allowed frequency, i.e. the value in the kernel.perf_event_max_sample_rate
0066         sysctl.
0067 
0068 -i::
0069 --inherit::
0070         Child tasks do not inherit counters.
0071 
0072 -k <path>::
0073 --vmlinux=<path>::
0074         Path to vmlinux.  Required for annotation functionality.
0075 
0076 --ignore-vmlinux::
0077         Ignore vmlinux files.
0078 
0079 --kallsyms=<file>::
0080         kallsyms pathname
0081 
0082 -m <pages>::
0083 --mmap-pages=<pages>::
0084         Number of mmap data pages (must be a power of two) or size
0085         specification with appended unit character - B/K/M/G. The
0086         size is rounded up to have nearest pages power of two value.
0087 
0088 -p <pid>::
0089 --pid=<pid>::
0090         Profile events on existing Process ID (comma separated list).
0091 
0092 -t <tid>::
0093 --tid=<tid>::
0094         Profile events on existing thread ID (comma separated list).
0095 
0096 -u::
0097 --uid=::
0098         Record events in threads owned by uid. Name or number.
0099 
0100 -r <priority>::
0101 --realtime=<priority>::
0102         Collect data with this RT SCHED_FIFO priority.
0103 
0104 --sym-annotate=<symbol>::
0105         Annotate this symbol.
0106 
0107 -K::
0108 --hide_kernel_symbols::
0109         Hide kernel symbols.
0110 
0111 -U::
0112 --hide_user_symbols::
0113         Hide user symbols.
0114 
0115 --demangle-kernel::
0116         Demangle kernel symbols.
0117 
0118 -D::
0119 --dump-symtab::
0120         Dump the symbol table used for profiling.
0121 
0122 -v::
0123 --verbose::
0124         Be more verbose (show counter open errors, etc).
0125 
0126 -z::
0127 --zero::
0128         Zero history across display updates.
0129 
0130 -s::
0131 --sort::
0132         Sort by key(s): pid, comm, dso, symbol, parent, srcline, weight,
0133         local_weight, abort, in_tx, transaction, overhead, sample, period.
0134         Please see description of --sort in the perf-report man page.
0135 
0136 --fields=::
0137         Specify output field - multiple keys can be specified in CSV format.
0138         Following fields are available:
0139         overhead, overhead_sys, overhead_us, overhead_children, sample and period.
0140         Also it can contain any sort key(s).
0141 
0142         By default, every sort keys not specified in --field will be appended
0143         automatically.
0144 
0145 -n::
0146 --show-nr-samples::
0147         Show a column with the number of samples.
0148 
0149 --show-total-period::
0150         Show a column with the sum of periods.
0151 
0152 --dsos::
0153         Only consider symbols in these dsos.  This option will affect the
0154         percentage of the overhead column.  See --percentage for more info.
0155 
0156 --comms::
0157         Only consider symbols in these comms.  This option will affect the
0158         percentage of the overhead column.  See --percentage for more info.
0159 
0160 --symbols::
0161         Only consider these symbols.  This option will affect the
0162         percentage of the overhead column.  See --percentage for more info.
0163 
0164 -M::
0165 --disassembler-style=:: Set disassembler style for objdump.
0166 
0167 --prefix=PREFIX::
0168 --prefix-strip=N::
0169         Remove first N entries from source file path names in executables
0170         and add PREFIX. This allows to display source code compiled on systems
0171         with different file system layout.
0172 
0173 --source::
0174         Interleave source code with assembly code. Enabled by default,
0175         disable with --no-source.
0176 
0177 --asm-raw::
0178         Show raw instruction encoding of assembly instructions.
0179 
0180 -g::
0181         Enables call-graph (stack chain/backtrace) recording.
0182 
0183 --call-graph [mode,type,min[,limit],order[,key][,branch]]::
0184         Setup and enable call-graph (stack chain/backtrace) recording,
0185         implies -g.  See `--call-graph` section in perf-record and
0186         perf-report man pages for details.
0187 
0188 --children::
0189         Accumulate callchain of children to parent entry so that then can
0190         show up in the output.  The output will have a new "Children" column
0191         and will be sorted on the data.  It requires -g/--call-graph option
0192         enabled.  See the `overhead calculation' section for more details.
0193         Enabled by default, disable with --no-children.
0194 
0195 --max-stack::
0196         Set the stack depth limit when parsing the callchain, anything
0197         beyond the specified depth will be ignored. This is a trade-off
0198         between information loss and faster processing especially for
0199         workloads that can have a very long callchain stack.
0200 
0201         Default: /proc/sys/kernel/perf_event_max_stack when present, 127 otherwise.
0202 
0203 --ignore-callees=<regex>::
0204         Ignore callees of the function(s) matching the given regex.
0205         This has the effect of collecting the callers of each such
0206         function into one place in the call-graph tree.
0207 
0208 --percent-limit::
0209         Do not show entries which have an overhead under that percent.
0210         (Default: 0).
0211 
0212 --percentage::
0213         Determine how to display the overhead percentage of filtered entries.
0214         Filters can be applied by --comms, --dsos and/or --symbols options and
0215         Zoom operations on the TUI (thread, dso, etc).
0216 
0217         "relative" means it's relative to filtered entries only so that the
0218         sum of shown entries will be always 100%. "absolute" means it retains
0219         the original value before and after the filter is applied.
0220 
0221 -w::
0222 --column-widths=<width[,width...]>::
0223         Force each column width to the provided list, for large terminal
0224         readability.  0 means no limit (default behavior).
0225 
0226 --proc-map-timeout::
0227         When processing pre-existing threads /proc/XXX/mmap, it may take
0228         a long time, because the file may be huge. A time out is needed
0229         in such cases.
0230         This option sets the time out limit. The default value is 500 ms.
0231 
0232 
0233 -b::
0234 --branch-any::
0235         Enable taken branch stack sampling. Any type of taken branch may be sampled.
0236         This is a shortcut for --branch-filter any. See --branch-filter for more infos.
0237 
0238 -j::
0239 --branch-filter::
0240         Enable taken branch stack sampling. Each sample captures a series of consecutive
0241         taken branches. The number of branches captured with each sample depends on the
0242         underlying hardware, the type of branches of interest, and the executed code.
0243         It is possible to select the types of branches captured by enabling filters.
0244         For a full list of modifiers please see the perf record manpage.
0245 
0246         The option requires at least one branch type among any, any_call, any_ret, ind_call, cond.
0247         The privilege levels may be omitted, in which case, the privilege levels of the associated
0248         event are applied to the branch filter. Both kernel (k) and hypervisor (hv) privilege
0249         levels are subject to permissions.  When sampling on multiple events, branch stack sampling
0250         is enabled for all the sampling events. The sampled branch type is the same for all events.
0251         The various filters must be specified as a comma separated list: --branch-filter any_ret,u,k
0252         Note that this feature may not be available on all processors.
0253 
0254 --raw-trace::
0255         When displaying traceevent output, do not use print fmt or plugins.
0256 
0257 --hierarchy::
0258         Enable hierarchy output.
0259 
0260 --overwrite::
0261         Enable this to use just the most recent records, which helps in high core count
0262         machines such as Knights Landing/Mill, but right now is disabled by default as
0263         the pausing used in this technique is leading to loss of metadata events such
0264         as PERF_RECORD_MMAP which makes 'perf top' unable to resolve samples, leading
0265         to lots of unknown samples appearing on the UI. Enable this if you are in such
0266         machines and profiling a workload that doesn't creates short lived threads and/or
0267         doesn't uses many executable mmap operations. Work is being planed to solve
0268         this situation, till then, this will remain disabled by default.
0269 
0270 --force::
0271         Don't do ownership validation.
0272 
0273 --num-thread-synthesize::
0274         The number of threads to run when synthesizing events for existing processes.
0275         By default, the number of threads equals to the number of online CPUs.
0276 
0277 --namespaces::
0278         Record events of type PERF_RECORD_NAMESPACES and display it with the
0279         'cgroup_id' sort key.
0280 
0281 -G name::
0282 --cgroup name::
0283 monitor only in the container (cgroup) called "name". This option is available only
0284 in per-cpu mode. The cgroup filesystem must be mounted. All threads belonging to
0285 container "name" are monitored when they run on the monitored CPUs. Multiple cgroups
0286 can be provided. Each cgroup is applied to the corresponding event, i.e., first cgroup
0287 to first event, second cgroup to second event and so on. It is possible to provide
0288 an empty cgroup (monitor all the time) using, e.g., -G foo,,bar. Cgroups must have
0289 corresponding events, i.e., they always refer to events defined earlier on the command
0290 line. If the user wants to track multiple events for a specific cgroup, the user can
0291 use '-e e1 -e e2 -G foo,foo' or just use '-e e1 -e e2 -G foo'.
0292 
0293 --all-cgroups::
0294         Record events of type PERF_RECORD_CGROUP and display it with the
0295         'cgroup' sort key.
0296 
0297 --switch-on EVENT_NAME::
0298         Only consider events after this event is found.
0299 
0300         E.g.:
0301 
0302            Find out where broadcast packets are handled
0303 
0304                 perf probe -L icmp_rcv
0305 
0306            Insert a probe there:
0307 
0308                 perf probe icmp_rcv:59
0309 
0310            Start perf top and ask it to only consider the cycles events when a
0311            broadcast packet arrives This will show a menu with two entries and
0312            will start counting when a broadcast packet arrives:
0313 
0314                 perf top -e cycles,probe:icmp_rcv --switch-on=probe:icmp_rcv
0315 
0316            Alternatively one can ask for --group and then two overhead columns
0317            will appear, the first for cycles and the second for the switch-on event.
0318 
0319                 perf top --group -e cycles,probe:icmp_rcv --switch-on=probe:icmp_rcv
0320 
0321         This may be interesting to measure a workload only after some initialization
0322         phase is over, i.e. insert a perf probe at that point and use the above
0323         examples replacing probe:icmp_rcv with the just-after-init probe.
0324 
0325 --switch-off EVENT_NAME::
0326         Stop considering events after this event is found.
0327 
0328 --show-on-off-events::
0329         Show the --switch-on/off events too. This has no effect in 'perf top' now
0330         but probably we'll make the default not to show the switch-on/off events
0331         on the --group mode and if there is only one event besides the off/on ones,
0332         go straight to the histogram browser, just like 'perf top' with no events
0333         explicitly specified does.
0334 
0335 --stitch-lbr::
0336         Show callgraph with stitched LBRs, which may have more complete
0337         callgraph. The option must be used with --call-graph lbr recording.
0338         Disabled by default. In common cases with call stack overflows,
0339         it can recreate better call stacks than the default lbr call stack
0340         output. But this approach is not full proof. There can be cases
0341         where it creates incorrect call stacks from incorrect matches.
0342         The known limitations include exception handing such as
0343         setjmp/longjmp will have calls/returns not match.
0344 
0345 ifdef::HAVE_LIBPFM[]
0346 --pfm-events events::
0347 Select a PMU event using libpfm4 syntax (see http://perfmon2.sf.net)
0348 including support for event filters. For example '--pfm-events
0349 inst_retired:any_p:u:c=1:i'. More than one event can be passed to the
0350 option using the comma separator. Hardware events and generic hardware
0351 events cannot be mixed together. The latter must be used with the -e
0352 option. The -e option and this one can be mixed and matched.  Events
0353 can be grouped using the {} notation.
0354 endif::HAVE_LIBPFM[]
0355 
0356 INTERACTIVE PROMPTING KEYS
0357 --------------------------
0358 
0359 [d]::
0360         Display refresh delay.
0361 
0362 [e]::
0363         Number of entries to display.
0364 
0365 [E]::
0366         Event to display when multiple counters are active.
0367 
0368 [f]::
0369         Profile display filter (>= hit count).
0370 
0371 [F]::
0372         Annotation display filter (>= % of total).
0373 
0374 [s]::
0375         Annotate symbol.
0376 
0377 [S]::
0378         Stop annotation, return to full profile display.
0379 
0380 [K]::
0381         Hide kernel symbols.
0382 
0383 [U]::
0384         Hide user symbols.
0385 
0386 [z]::
0387         Toggle event count zeroing across display updates.
0388 
0389 [qQ]::
0390         Quit.
0391 
0392 Pressing any unmapped key displays a menu, and prompts for input.
0393 
0394 include::callchain-overhead-calculation.txt[]
0395 
0396 SEE ALSO
0397 --------
0398 linkperf:perf-stat[1], linkperf:perf-list[1], linkperf:perf-report[1]