PERF-REPORT(1)

โœจ NAME โœจ

perf-report โ€” bestie, this is the one that reads your perf.data (the file perf record made for you) and shows you the whole profile. It's giving "receipts from your CPU." ๐Ÿ’…

๐ŸŒธ SYNOPSIS ๐ŸŒธ

perf report [-i <file> | --input=file]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

Okay so picture this: you already ran perf record and it wrote down all your performance counter tea โ˜•. This command is what displays that profile info. Iconic. Periodt. ๐Ÿ’–

๐Ÿ’œ OPTIONS ๐Ÿ’œ

  • -i, --input= โ€” the input file name, duh. (default: perf.data unless stdin is a fifo ๐Ÿซถ)
  • -v, --verbose โ€” be more verbose, like show symbol address and stuff. (show symbol address, etc) ๐Ÿ”
  • -q, --quiet โ€” do not show any warnings or messages. (Suppress -v) shhh ๐Ÿคซ
  • -n, --show-nr-samples โ€” show the number of samples for each symbol ๐Ÿ”ข
  • --show-cpu-utilization โ€” show sample percentage for different cpu modes.
  • -T, --threads โ€” show per-thread event counters. Heads up though, the input data file should be recorded with -s option.
  • -c, --comms= โ€” only consider symbols in these comms. It's a CSV, and it understands file://filename entries. This option will affect the percentage of the overhead and latency columns. See --percentage for more info. โœจ
  • --pid= โ€” only show events for given process ID (comma separated list).
  • --tid= โ€” only show events for given thread ID (comma separated list).
  • -d, --dsos= โ€” only consider symbols in these dsos. CSV that understands file://filename entries. This option will affect the percentage of the overhead and latency columns. See --percentage for more info.
  • -S, --symbols= โ€” only consider these symbols. CSV that understands file://filename entries. This option will affect the percentage of the overhead and latency columns. See --percentage for more info.
  • --symbol-filter= โ€” only show symbols that match (partially) with this filter.
  • -U, --hide-unresolved โ€” only display entries resolved to a symbol. no ghosts allowed ๐Ÿ‘ป
  • --parallelism โ€” only consider these parallelism levels. So like, parallelism level = the number of threads that actively run on CPUs at the time of sample. The flag accepts single number, comma-separated list, and ranges (for example: "1", "7,8", "1,64-128"). This is useful in understanding what a program is doing during sequential/low-parallelism phases as compared to high-parallelism phases. This option will affect the percentage of the overhead and latency columns. See --percentage for more info. Also see the โ€˜CPU and latency overheadsโ€™ section for more details. ๐Ÿงš
  • --latency โ€” show latency-centric profile rather than the default CPU-consumption-centric profile (requires perf record --latency flag). โš ๏ธ don't forget that flag bestie
  • -s, --sort= โ€” sort histogram entries by given key(s) โ€” multiple keys can be specified in CSV format. Following sort keys are available: pid, comm, dso, symbol, parent, cpu, socket, srcline, weight, local_weight, cgroup_id, addr, comm_nodigit.

Each key has following meaning: ๐Ÿ‘‡

  • comm: command (name) of the task which can be read via /proc/<pid>/comm
  • pid: command and tid of the task
  • tgid: command and tgid of the task
  • dso: name of library or module executed at the time of sample
  • dso_size: size of library or module executed at the time of sample
  • symbol: name of function executed at the time of sample
  • symbol_size: size of function executed at the time of sample
  • parent: name of function matched to the parent regex filter. Unmatched entries are displayed as "[other]".
  • cpu: cpu number the task ran at the time of sample
  • socket: processor socket number the task ran at the time of sample
  • parallelism: number of running threads at the time of sample
  • srcline: filename and line number executed at the time of sample. The DWARF debugging info must be provided.
  • srcfile: file name of the source file of the samples. Requires dwarf information.
  • weight: Event specific weight, e.g. memory latency or transaction abort cost. This is the global weight.
  • local_weight: Local weight version of the weight above.
  • cgroup_id: ID derived from cgroup namespace device and inode numbers.
  • cgroup: cgroup pathname in the cgroupfs.
  • transaction: Transaction abort flags.
  • overhead: CPU overhead percentage of sample.
  • latency: latency (wall-clock) overhead percentage of sample. See the โ€˜CPU and latency overheadsโ€™ section for more details.
  • overhead_sys: CPU overhead percentage of sample running in system mode
  • overhead_us: CPU overhead percentage of sample running in user mode
  • overhead_guest_sys: CPU overhead percentage of sample running in system mode on guest machine
  • overhead_guest_us: CPU overhead percentage of sample running in user mode on guest machine
  • sample: Number of sample
  • period: Raw number of event count of sample
  • time: Separate the samples by time stamp with the resolution specified by --time-quantum (default 100ms). Specify with overhead and before it.
  • code_page_size: the code page size of sampled code address (ip)
  • ins_lat: Instruction latency in core cycles. This is the global instruction latency
  • local_ins_lat: Local instruction latency version
  • p_stage_cyc: On powerpc, this presents the number of cycles spent in a pipeline stage. And currently supported only on powerpc.
  • addr: (Full) virtual address of the sampled instruction
  • retire_lat: On X86, this reports pipeline stall of this instruction compared to the previous instruction in cycles. And currently supported only on X86
  • simd: Flags describing a SIMD operation. The architecture type can be Armโ€™s ASE (Advanced SIMD extension), SVE, SME. It provides an extra tag for predicate: "e" for empty predicate, "p" for partial predicate, "d" for predicate disabled, and "f" for full predicate.
  • type: Data type of sample memory access.
  • typeoff: Offset in the data type of sample memory access.
  • symoff: Offset in the symbol.
  • weight1: Average value of event specific weight (1st field of weight_struct).
  • weight2: Average value of event specific weight (2nd field of weight_struct).
  • weight3: Average value of event specific weight (3rd field of weight_struct).
  • comm_nodigit: same as comm, with numbers replaced by "<N>"

By default, overhead, comm, dso and symbol keys are used. (i.e. --sort overhead,comm,dso,symbol).

If --branch-stack option is used, following sort keys are also available: ๐ŸŒฟ

  • dso_from: name of library or module branched from
  • dso_to: name of library or module branched to
  • symbol_from: name of function branched from
  • symbol_to: name of function branched to
  • srcline_from: source file and line branched from
  • srcline_to: source file and line branched to
  • mispredict: "N" for predicted branch, "Y" for mispredicted branch
  • in_tx: branch in TSX transaction
  • abort: TSX transaction abort.
  • cycles: Cycles in basic block

And default sort keys are changed to comm, dso_from, symbol_from, dso_to and symbol_to, see '--branch-stack'.

When the sort key symbol is specified, columns "IPC" and "IPC Coverage" are enabled automatically. Column "IPC" reports the average IPC per function and column "IPC coverage" reports the percentage of instructions with sampled IPC in this function. IPC means Instruction Per Cycle. If it's low, it indicates there may be a performance bottleneck when the function is executed, such as a memory access bottleneck. If a function has high overhead and low IPC, it's worth further analyzing it to optimize its performance. ๐Ÿ”ฅ

If the --mem-mode option is used, the following sort keys are also available (incompatible with --branch-stack): symbol_daddr, dso_daddr, locked, tlb, mem, snoop, dcacheline, blocked.

  • symbol_daddr: name of data symbol being executed on at the time of sample
  • dso_daddr: name of library or module containing the data being executed on at the time of the sample
  • locked: whether the bus was locked at the time of the sample
  • tlb: type of tlb access for the data at the time of the sample
  • mem: type of memory access for the data at the time of the sample
  • snoop: type of snoop (if any) for the data at the time of the sample
  • dcacheline: the cacheline the data address is on at the time of the sample
  • phys_daddr: physical address of data being executed on at the time of sample
  • data_page_size: the data page size of data being executed on at the time of sample
  • blocked: reason of blocked load access for the data at the time of the sample

And the default sort keys are changed to local_weight, mem, sym, dso, symbol_daddr, dso_daddr, snoop, tlb, locked, blocked, local_ins_lat, see '--mem-mode'.

If the data file has tracepoint event(s), following (dynamic) sort keys are also available: trace, trace_fields, [<event>.]<field>[/raw] ๐Ÿฆ‹

  • trace: pretty printed trace output in a single column
  • trace_fields: fields in tracepoints in separate columns
  • <field name>: optional event and field name for a specific field

The last form consists of event and field names. If event name is omitted, it searches all events for matching field name. The matched field will be shown only for the event has the field. The event name supports substring match so user doesn't need to specify full subsystem and event name everytime. For example, 'sched:sched_switch' event can be shortened to 'switch' as long as it's not ambiguous. Also event can be specified by its index (starting from 1) preceded by the '%'. So '%1' is the first event, '%2' is the second, and so on. ๐Ÿค“

The field name can have '/raw' suffix which disables pretty printing and shows raw field value like hex numbers. The --raw-trace option has the same effect for all dynamic sort keys. โœจ


Quick side note before we keep going: the default sort keys get swapped over to trace if literally every event in the data file is a tracepoint. ๐ŸŒ€

  • -F, --fields= โ€” pick your output fields, bestie โ€” and yeah, you can specify multiple keys in CSV format. Here's the whole menu of them: overhead, latency, overhead_sys, overhead_us, overhead_children, sample, period, weight1, weight2, weight3, ins_lat, p_stage_cyc and retire_lat. The last 3 names are aliases for the corresponding weights. When you use the weight fields, they show you the average value of the weight. โœจ It can also contain any sort key(s), which is lowkey iconic of it. By default, every sort key you didn't specify in -F gets appended automatically. (automatic queen behavior ๐Ÿ’…) Oh, and if your keys start with a + prefix, it appends the specified field(s) to the default field order. Like: perf report -F +period,sample. ๐Ÿซถ
  • -p, --parent=<regex> โ€” a regex filter to identify the parent. The parent is a caller of this function, and it gets searched through the callchain, so this one requires callchain information to be recorded. The pattern is in extended regex format and defaults to "^sys_|^do_page_fault" โ€” see --sort parent. ๐Ÿ”
  • -x, --exclude-other โ€” only display entries with parent-match. nothing else makes the cut, sorry not sorry ๐Ÿ™ˆ
  • -w, --column-widths=<width[,width...]> โ€” force each column width to the provided list, for large-terminal readability. 0 means no limit (that's the default behavior). ๐Ÿ“
  • -t, --field-separator= โ€” use a special separator character and don't pad with spaces, replacing all occurrences of this separator in symbol names (and other output) with a . character โ€” that way it's the only non-valid separator. periodt. ๐ŸŽ€
  • -D, --dump-raw-trace โ€” dump raw trace in ASCII. raw and unfiltered, main character energy ๐Ÿ’€
  • --disable-order โ€” disable raw trace ordering.
  • -g, --call-graph= โ€” display call chains. The full shape is:
<print_type,threshold[,print_limit],order,sort_key[,branch],value>

Note that the ordering is not fixed, so any parameter can be given in an arbitrary order. One exception: the print_limit, which should be preceded by threshold. โš ๏ธ

print_type can be either:

  • flat: single column, linear exposure of call chains.
  • graph: use a graph tree, displaying absolute overhead rates. (default)
  • fractal: like graph, but displays relative rates. Each branch of the tree is considered as a new profiled object.
  • folded: call chains are displayed in a line, separated by semicolons.
  • none: disable call chain display.

threshold is a percentage value which specifies a minimum percent to be included in the output call graph. Default is 0.5 (%). ๐Ÿ“Š

print_limit is only applied when the stdio interface is used. It's there to limit the number of call graph entries in a single hist entry. Note that it needs to be given after threshold (but not necessarily consecutive). Default is 0 (unlimited).

order can be either:

  • callee: callee based call graph.
  • caller: inverted caller based call graph.

Default is 'caller' when --children is used, otherwise 'callee'.

sort_key can be:

  • function: compare on functions (default)
  • address: compare on individual code addresses
  • srcline: compare on source filename and line number

branch can be:

  • branch: include last branch information in callgraph when available. Usually more convenient to use --branch-history for this.

value can be:

  • percent: display overhead percent (default)
  • period: display event period
  • count: display event count
  • --children โ€” accumulate the callchain of children to the parent entry so that they can then show up in the output. The output will have a new "Children" column and will be sorted on the data. It requires that callchains are recorded. See the 'Overhead calculation' section for more details. Enabled by default โ€” disable it with --no-children. ๐Ÿ‘ถ
  • --max-stack โ€” set the stack depth limit when parsing the callchain; anything beyond the specified depth will be ignored. It's a trade-off between information loss and faster processing, especially for workloads that can have a very long callchain stack. Note that when you're using the --itrace option, the synthesized callchain size will override this value if the synthesized callchain size is bigger. ๐Ÿฅž

Default: 127

  • -G, --inverted โ€” alias for inverted caller based call graph. same vibe, shorter name ๐Ÿ’ซ
  • --ignore-callees=<regex> โ€” ignore callees of the function(s) matching the given regex. This has the effect of collecting the callers of each such function into one place in the call-graph tree. ๐Ÿšซ
  • --pretty=<key> โ€” pretty printing style. key: normal, raw.
  • --stdio โ€” use the stdio interface.
  • --stdio-color โ€” always, never or auto, letting you configure color output via the command line, in addition to via "color.ui" .perfconfig. Use --stdio-color always to generate color even when you're redirecting to a pipe or a file. Using just --stdio-color is equivalent to using always. ๐ŸŒˆ
  • --tui โ€” use the TUI interface, which is integrated with annotate and lets you zoom into DSOs or threads, among other features. Using --tui requires a tty โ€” if one isn't present, like when piping to other commands, the stdio interface is used. ๐Ÿ–ฅ๏ธ
  • --gtk โ€” use the GTK2 interface.
  • -k, --vmlinux=<file> โ€” vmlinux pathname.
  • --ignore-vmlinux โ€” ignore vmlinux files.
  • --kallsyms=<file> โ€” kallsyms pathname.
  • -m, --modules โ€” load module symbols. WARNING: this should only be used with -k and a LIVE kernel. ๐Ÿ”ฅ (respect the caps, bestie โ€” this one bites)
  • -f, --force โ€” don't do ownership validation.
  • --symfs=<directory[,layout]> โ€” look for files with symbols relative to this directory. The optional layout can be hierarchy (default, matches full path) or flat (only matches base name). Super useful when debug files are stored in a flat directory structure. ๐Ÿ—‚๏ธ
  • -C, --cpu โ€” only report samples for the list of CPUs provided. Multiple CPUs can be provided as a comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2. Default is to report samples on all CPUs.
  • -M, --disassembler-style= โ€” set disassembler style for objdump.
  • --source โ€” interleave source code with assembly code. Enabled by default โ€” disable it with --no-source. ๐Ÿ’ป
  • --asm-raw โ€” show raw instruction encoding of assembly instructions.
  • --show-total-period โ€” show a column with the sum of periods.
  • -I, --show-info โ€” display extended information about the perf.data file. This adds information which may be very large and thus may clutter the display. It currently includes: cpu and numa topology of the host system. ๐Ÿ™ˆ (it's a lot, she warns you)
  • -b, --branch-stack โ€” use the addresses of sampled taken branches instead of the instruction address to build the histograms. To generate meaningful output, the perf.data file must have been obtained using perf record -b or perf record --branch-filter xxx, where xxx is a branch filter option. perf report is able to auto-detect whether a perf.data file contains branch stacks and it will automatically switch to the branch view mode โ€” unless --no-branch-stack is used. ๐ŸŒฟ
  • --branch-history โ€” add the addresses of sampled taken branches to the callstack. This lets you examine the path the program took to each sample. The data collection must have used -b (or -j) and -g. ๐Ÿ”Ž

Also show with some branch flags, which can be:

  • Predicted: display the average percentage of predicated branches. (predicated number / total number)
  • Abort: display the number of tsx aborted branches.
  • Cycles: cycles in basic block.
  • iterations: display the average number of iterations in callchain list.
  • --addr2line=<path> โ€” path to the addr2line binary.
  • --objdump=<path> โ€” path to the objdump binary.
  • --prefix=PREFIX, --prefix-strip=N โ€” remove the first N entries from source file path names in executables and add PREFIX. This lets you display source code compiled on systems with a different file system layout. ๐Ÿงš
  • --group โ€” show event group information together. It forces group output even if there are no groups defined in the data file. ๐Ÿ‘ฏ
  • --group-sort-idx โ€” sort the output by the event at the index n in the group. If n is invalid, sort by the first event. It can support multiple groups with different amounts of events. WARNING: this should be used on grouped events. โš ๏ธ
  • --demangle โ€” demangle symbol names to human readable form. It's enabled by default โ€” disable it with --no-demangle. โœจ
  • --demangle-kernel โ€” demangle kernel symbol names to human readable form (for C++ kernels).
  • --mem-mode โ€” use the data addresses of samples in addition to instruction addresses to build the histograms. To generate meaningful output, the perf.data file must have been obtained using perf record -d -W and using a special event -e cpu/mem-loads/p or -e cpu/mem-stores/p. See perf mem for simpler access. ๐Ÿง 
  • --percent-limit โ€” do not show entries which have an overhead under that percent. (Default: 0). Note that this option also sets the percent limit (threshold) of callchains. However, the default value of the callchain threshold is different than the default value of hist entries. Please see the --call-graph option for details. ๐Ÿ“‰
  • --percentage โ€” determine how to display the CPU and latency overhead percentage of filtered entries. Filters can be applied by --comms, --dsos, --symbols and/or --parallelism options, and by Zoom operations on the TUI (thread, dso, etc). ๐ŸŽš๏ธ

"relative" means it's relative to filtered entries only, so that the sum of shown entries will always be 100%. "absolute" means it retains the original value before and after the filter is applied.

  • --header โ€” show header information in the perf.data file. This includes various info like hostname, OS and perf version, cpu/mem info, perf command line, event list and so on. Currently only --stdio output supports this feature. ๐Ÿ“‹
  • --header-only โ€” show only the perf.data header (forces --stdio). ๐ŸŽ€
  • --time โ€” bestie, this one says only analyze samples inside the time window you give it: <start>,<stop>. Times are in seconds.nanoseconds format. If the start isnโ€™t given (i.e. the time string looks like ,x.y), analysis starts at the beginning of the file. If the stop time isnโ€™t given (i.e. the time string looks like x.y,), analysis goes to the end of the file. You can separate multiple ranges with spaces, which means you gotta quote the argument, e.g. --time "1234.567,1234.789 1235,"

It also supports time percent with multiple time ranges. Time string is 'a%/n,b%/m,...' or 'a%-b%,c%-%d,...'.

For example, select the second 10% time slice:

perf report --time 10%/2

Select from 0% to 10% time slice:

perf report --time 0%-10%

Select the first and second 10% time slices:

perf report --time 10%/1,10%/2

Select from 0% to 10% and 30% to 40% slices:

perf report --time 0%-10%,30%-40%
  • --switch-on EVENT_NAME โ€” only consider events after this event is found. This is lowkey interesting when you wanna measure a workload only after some initialization phase is over โ€” i.e. insert a perf probe at that point and then use this option with that probe. โœจ
  • --switch-off EVENT_NAME โ€” stop considering events after this event is found.
  • --show-on-off-events โ€” show the --switch-on/--switch-off events too. This has no effect in perf report right now, but probably weโ€™ll make the default not show the switch-on/off events on the --group mode and, if there is only one event besides the off/on ones, go straight to the histogram browser, just like perf report with no events explicitly specified does.
  • --itrace โ€” options for decoding instruction tracing data. The options are:
    • i โ€” synthesize instructions events
    • y โ€” synthesize cycles events
    • b โ€” synthesize branches events
    • c โ€” synthesize branches events (calls only)
    • r โ€” synthesize branches events (returns only)
    • x โ€” synthesize transactions events
    • w โ€” synthesize ptwrite events
    • p โ€” synthesize power events (incl. PSB events for Intel PT)
    • o โ€” synthesize other events recorded due to the use of aux-output (refer to perf record)
    • I โ€” synthesize interrupt or similar (asynchronous) events (e.g. Intel PT Event Trace)
    • e โ€” synthesize error events
    • d โ€” create a debug log
    • f โ€” synthesize first level cache events
    • m โ€” synthesize last level cache events
    • M โ€” synthesize memory events
    • t โ€” synthesize TLB events
    • a โ€” synthesize remote access events
    • g โ€” synthesize a call chain (use with i or x)
    • G โ€” synthesize a call chain on existing event records
    • l โ€” synthesize last branch entries (use with i or x)
    • L โ€” synthesize last branch entries on existing event records
    • s โ€” skip initial number of events
    • q โ€” quicker (less detailed) decoding
    • A โ€” approximate IPC
    • Z โ€” prefer to ignore timestamps (so-called "timeless" decoding)
    • T โ€” use the timestamp trace as kernel time

The default is all events i.e. the same as --itrace=iybxwpe, except for perf script where it is --itrace=ce.

In addition, the period (default 100000, except for perf script where it is 1) for instructions events can be specified in units of:

  • i โ€” instructions
  • t โ€” ticks
  • ms โ€” milliseconds
  • us โ€” microseconds
  • ns โ€” nanoseconds (default)

Also the call chain size (default 16, max. 1024) for instructions or transactions events can be specified.

Also the number of last branch entries (default 64, max. 1024) for instructions or transactions events can be specified.

Similar to options g and l, size may also be specified for options G and L. On x86, note that G and L work poorly when data has been recorded with large PEBS. Refer linkperf:perf-intel-pt[1] man page for details.

It is also possible to skip events generated (instructions, branches, transactions, ptwrite, power) at the beginning. This is useful to ignore initialization code.

--itrace=i0nss1000000

skips the first million instructions.

The 'e' option may be followed by flags which affect what errors will or will not be reported. Each flag must be preceded by either '+' or '-'. The flags are:

  • o โ€” overflow
  • l โ€” trace data lost

If supported, the 'd' option may be followed by flags which affect what debug messages will or will not be logged. Each flag must be preceded by either '+' or '-'. The flags are:

  • a โ€” all perf events
  • e โ€” output only on errors (size configurable - see linkperf:perf-config[1])
  • o โ€” output to stdout

If supported, the 'q' option may be repeated to increase the effect.

To disable decoding entirely, use --no-itrace.

  • --full-source-path โ€” show the full path for source files for srcline output. ๐ŸŽ€
  • --show-ref-call-graph โ€” when multiple events are sampled, it may not be needed to collect callgraphs for all of them. The sample sites are usually nearby, and itโ€™s enough to collect the callgraphs on a reference event. So the user can use "call-graph=no" event modifier to disable callgraph for other events and reduce the overhead. However, perf report cannot show callgraphs for the event which disabled the callgraph. This option extends perf report to show reference callgraphs, which were collected by the reference event, in no-callgraph events.
  • --stitch-lbr โ€” show callgraph with stitched LBRs, which may have more complete callgraph. The perf.data file must have been obtained using perf record --call-graph lbr. Disabled by default. In common cases with call stack overflows, it can recreate better call stacks than the default LBR call stack output. But this approach is not foolproof. There can be cases where it creates incorrect call stacks from incorrect matches. The known limitations include exception handing such as setjmp/longjmp will have calls/returns not match.
  • --socket-filter โ€” only report the samples on the processor socket that match with this filter.
  • --samples=N โ€” save N individual samples for each histogram entry to show context in the perf report TUI browser.
  • --raw-trace โ€” when displaying traceevent output, do not use print fmt or plugins.
  • -H, --hierarchy โ€” enable hierarchical output. In the hierarchy mode, each sort key groups samples based on the criteria and then sub-divides it using the lower level sort key. ๐Ÿ‘‘

For example, in normal output:

perf report -s dso,sym
# Overhead  Shared Object      Symbol
    50.00%  [kernel.kallsyms]  [k] kfunc1
    20.00%  perf               [.] foo
    15.00%  [kernel.kallsyms]  [k] kfunc2
    10.00%  perf               [.] bar
     5.00%  libc.so            [.] libcall

In hierarchy output:

perf report -s dso,sym --hierarchy
#   Overhead  Shared Object / Symbol
    65.00%    [kernel.kallsyms]
      50.00%    [k] kfunc1
      15.00%    [k] kfunc2
    30.00%    perf
      20.00%    [.] foo
      10.00%    [.] bar
     5.00%    libc.so
       5.00%    [.] libcall
  • --inline โ€” if a callgraph address belongs to an inlined function, the inline stack will be printed. Each entry is function name or file/line. Enabled by default, disable with --no-inline. ๐Ÿ’…
  • --mmaps โ€” show --tasks output plus mmap information in a format similar to /proc/<PID>/maps.

Please note that not all mmaps are stored; options affecting which ones are stored include 'perf record --data', for instance.

  • --ns โ€” show time stamps in nanoseconds.
  • --stats โ€” display overall events statistics without any further processing. (Like the one at the end of the perf report -D command.)
  • --tasks โ€” display monitored tasks stored in perf data. Displaying pid/tid/ppid plus the command string aligned to distinguish parent and child tasks.
  • --percent-type โ€” set annotation percent type from the following choices: global-period, local-period, global-hits, local-hits.

The local/global keywords set if the percentage is computed in the scope of the function (local) or the whole data (global). The period/hits keywords set the base the percentage is computed on โ€” the samples period or the number of samples (hits).

  • --time-quantum โ€” configure time quantum for time sort key. Default 100ms. Accepts s, us, ms, ns units. ๐Ÿ•ฐ๏ธ
  • --total-cycles โ€” when --total-cycles is specified, it supports sorting for all blocks by Sampled Cycles%. This is useful to concentrate on the globally hottest blocks. In output, there are some new columns:
    • 'Sampled Cycles%' โ€” block sampled cycles aggregation / total sampled cycles
    • 'Sampled Cycles' โ€” block sampled cycles aggregation
    • 'Avg Cycles%' โ€” block average sampled cycles / sum of total block average sampled cycles
    • 'Avg Cycles' โ€” block average sampled cycles
    • 'Branch Counter' โ€” block branch counter histogram (with -v showing the number)
  • --skip-empty โ€” do not print 0 results in the --stat output. ๐Ÿซถ

๐Ÿ’… CPU AND LATENCY OVERHEADS ๐Ÿ’…

Okay bestie, buckle up, because there are literally two notions of time and they are not the same vibe: wall-clock time and CPU time. For a single-threaded program, or a program running on a single-core machine, these notions are the same. But for a multi-threaded/multi-process program running on a multi-core machine, these notions are significantly different. Each second of wall-clock time we have number-of-cores seconds of CPU time. Perf can measure overhead for both of these times (shown in overhead and latency columns for CPU and wall-clock time correspondingly).

Optimizing CPU overhead is useful to improve throughput, while optimizing latency overhead is useful to improve latency. Itโ€™s important to understand which one is useful in a concrete situation at hand. For example, the former may be useful to improve max throughput of a CI build server that runs on 100% CPU utilization, while the latter may be useful to improve user-perceived latency of a single interactive program build. These overheads may be significantly different in some cases. For example, consider a program that executes function foo for 9 seconds with 1 thread, and then executes function bar for 1 second with 128 threads (consumes 128 seconds of CPU time). The CPU overhead is: foo - 6.6%, bar - 93.4%. While the latency overhead is: foo - 90%, bar - 10%. If we try to optimize running time of the program looking at the (wrong in this case) CPU overhead, we would concentrate on the function bar, but it can yield only 10% running time improvement at best.

By default, perf shows only CPU overhead. To show latency overhead, use perf record --latency and perf report:

Overhead  Latency  Command
  93.88%   25.79%  cc1
   1.90%   39.87%  gzip
   0.99%   10.16%  dpkg-deb
   0.57%    1.00%  as
   0.40%    0.46%  sh

To sort by latency overhead, use perf report --latency:

Latency  Overhead  Command
 39.87%     1.90%  gzip
 25.79%    93.88%  cc1
 10.16%     0.99%  dpkg-deb
  4.17%     0.29%  git
  2.81%     0.11%  objtool

To get insight into the difference between the overheads, you may check parallelization histogram with --sort=latency,parallelism,comm,symbol --hierarchy flags. It shows fraction of (wall-clock) time the workload utilizes different numbers of cores (Parallelism column). For example, in the following case the workload utilizes only 1 core most of the time, but also has some highly-parallel phases, which explains significant difference between CPU and wall-clock overheads:

  Latency  Overhead     Parallelism / Command / Symbol
+  56.98%     2.29%     1
+  16.94%     1.36%     2
+   4.00%    20.13%     125
+   3.66%    18.25%     124
+   3.48%    17.66%     126
+   3.26%     0.39%     3
+   2.61%    12.93%     123

By expanding corresponding lines, you may see what commands/functions run at the given parallelism level:

  Latency  Overhead     Parallelism / Command / Symbol
-  56.98%     2.29%     1
      32.80%     1.32%     gzip
       4.46%     0.18%     cc1
       2.81%     0.11%     objtool
       2.43%     0.10%     dpkg-source
       2.22%     0.09%     ld
       2.10%     0.08%     dpkg-genchanges

To see the normal function-level profile for particular parallelism levels (number of threads actively running on CPUs), you may use --parallelism filter. For example, to see the profile only for low parallelism phases of a workload use --latency --parallelism=1-2 flags.


๐Ÿงฎ OVERHEAD CALCULATION ๐Ÿงฎ

The CPU overhead can be shown in two columns as Children and Self when perf collects callchains (and corresponding Wall columns for wall-clock overhead). The Self overhead is simply calculated by adding all period values of the entry - usually a function (symbol). This is the value that perf shows traditionally and sum of all the Self overhead values should be 100%.

The Children overhead is calculated by adding all period values of the child functions so that it can show the total overhead of the higher level functions even if they donโ€™t directly execute much. Children here means functions that are called from another (parent) function.

It might be confusing that the sum of all the Children overhead values exceeds 100% since each of them is already an accumulation of Self overhead of its child functions. But with this enabled, users can find which function has the most overhead even if samples are spread over the children.

Consider the following example; there are three functions like below.

void foo(void) {
    /* do something */
}

void bar(void) {
    /* do something */
    foo();
}

int main(void) {
    bar()
    return 0;
}

In this case foo is a child of bar, and bar is an immediate child of main so foo also is a child of main. In other words, main is a parent of foo and bar, and bar is a parent of foo.

Suppose all samples are recorded in foo and bar only. When itโ€™s recorded with callchains the output will show something like below in the usual (Self-overhead-only) output of perf report:

Overhead  Symbol
........  .....................
  60.00%  foo
          |
          --- foo
              bar
              main
              __libc_start_main

  40.00%  bar
          |
          --- bar
              main
              __libc_start_main

When the --children option is enabled, the Self overhead values of child functions (i.e. foo and bar) are added to the parents to calculate the Children overhead. In this case the report could be displayed as:

Children      Self  Symbol
........  ........  ....................
 100.00%     0.00%  __libc_start_main
          |
          --- __libc_start_main

 100.00%     0.00%  main
          |
          --- main
              __libc_start_main

 100.00%    40.00%  bar
          |
          --- bar
              main
              __libc_start_main

  60.00%    60.00%  foo
          |
          --- foo
              bar
              main
              __libc_start_main

In the above output, the Self overhead of foo (60%) was added to the Children overhead of bar, main and __libc_start_main. Likewise, the Self overhead of bar (40%) was added to the Children overhead of main and __libc_start_main.

So __libc_start_main and main are shown first since they have same (100%) Children overhead (even though they have zero Self overhead) and they are the parents of foo and bar.

Since v3.16 the Children overhead is shown by default and the output is sorted by its values. The Children overhead is disabled by specifying --no-children option on the command line or by adding report.children = false or top.children = false in the perf config file.


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

Go give these icons a read next, bestie:

Thatโ€™s the whole vibe check, bestie. This was perf, dated 10/31/2026, page PERF-REPORT(1) โ€” signing off with a sparkle ๐Ÿ’…โœจ๐Ÿซถ

๐Ÿ“ฆ where this page comes from