PERF-CONFIG(1) | perf Manual | PERF-CONFIG(1) |
perf-config - Get and set variables in a configuration file.
perf config [<file-option>] [section.name[=value] ...] or perf config [<file-option>] -l | --list
You can manage variables in a configuration file with this command.
-l, --list
--user
--system
The perf configuration file contains many variables to change various aspects of each of its tools, including output, disk usage, etc. The $HOME/.perfconfig file is used to store a per-user configuration. The file $(sysconfdir)/perfconfig can be used to store a system-wide default configuration.
One an disable reading config files by setting the PERF_CONFIG environment variable to /dev/null, or provide an alternate config file by setting that variable.
When reading or writing, the values are read from the system and user configuration files by default, and options --system and --user can be used to tell the command to read from or write to only that location.
The file consist of sections. A section starts with its name surrounded by square brackets and continues till the next section begins. Each variable must be in a section, and have the form name = value, for example:
[section]
name1 = value1
name2 = value2
Section names are case sensitive and can contain any characters except newline (double quote " and backslash have to be escaped as \" and \\, respectively). Section headers can’t span multiple lines.
Given a $HOME/.perfconfig like this:
# # This is the config file, and # a # and ; character indicates a comment #
[colors]
# Color variables
top = red, default
medium = green, default
normal = lightgray, default
selected = white, lightgray
jump_arrows = blue, default
addr = magenta, default
root = white, blue
[tui]
# Defaults if linked with libslang
report = on
annotate = on
top = on
[buildid]
# Default, disable using /dev/null
dir = ~/.debug
[annotate]
# Defaults
hide_src_code = false
use_offset = true
jump_arrows = true
show_nr_jumps = false
[help]
# Format can be man, info, web or html
format = man
autocorrect = 0
[ui]
show-headers = true
[call-graph]
# fp (framepointer), dwarf
record-mode = fp
print-type = graph
order = caller
sort-key = function
[report]
# Defaults
sort_order = comm,dso,symbol
percent-limit = 0
queue-size = 0
children = true
group = true
skip-empty = true
[llvm]
dump-obj = true
clang-opt = -g
You can hide source code of annotate feature setting the config to false with
% perf config annotate.hide_src_code=true
If you want to add or modify several config items, you can do like
% perf config ui.show-headers=false kmem.default=slab
To modify the sort order of report functionality in user config file(i.e. ~/.perfconfig), do
% perf config --user report.sort-order=srcline
To change colors of selected line to other foreground and background colors in system config file (i.e. $(sysconf)/perfconfig), do
% perf config --system colors.selected=yellow,green
To query the record mode of call graph, do
% perf config call-graph.record-mode
If you want to know multiple config key/value pairs, you can do like
% perf config report.queue-size call-graph.order report.children
To query the config value of sort order of call graph in user config file (i.e. ~/.perfconfig), do
% perf config --user call-graph.sort-order
To query the config value of buildid directory in system config file (i.e. $(sysconf)/perfconfig), do
% perf config --system buildid.dir
colors.*
medium = green, lightgray
If you want to use the color configured for you terminal, just leave it as 'default', for example:
medium = default, lightgray
Available colors: red, yellow, green, cyan, gray, black, blue, white, default, magenta, lightgray
colors.top
colors.medium
colors.normal
colors.selected
colors.jump_arrows
colors.addr
colors.root
core.*, core.proc-map-timeout
tui., gtk.
[tui]
top = true
will make the TUI be the default for the 'top' subcommand. Those will be available if the required libs were detected at tool build time.
buildid.*, buildid.dir
The recording tools also stores a hard link or copy in a per-user directory, $HOME/.debug/, of binaries, shared libraries, /proc/kallsyms and /proc/kcore files to be used at analysis time.
The buildid.dir variable can be used to either change this directory cache location, or to disable it altogether. If you want to disable it, set buildid.dir to /dev/null. The default is $HOME/.debug
buildid-cache.*
buildid-cache.debuginfod=http://192.168.122.174:8002
annotate.*
annotate.disassembler_style:
Use this to change the default disassembler style to some other value
supported by binutils, such as "intel", see the '-M' option help in the
'objdump' man page.
annotate.hide_src_code
│ push %rbp │ mov %rsp,%rbp │ sub $0x10,%rsp │ mov (%rdi),%rdx
But if this option is 'false', source code of the part can be also printed as below. Default is 'false'.
│ struct rb_node *rb_next(const struct rb_node *node) │ { │ push %rbp │ mov %rsp,%rbp │ sub $0x10,%rsp │ struct rb_node *parent; │ │ if (RB_EMPTY_NODE(node)) │ mov (%rdi),%rdx │ return n;
This option works with tui, stdio2 browsers.
annotate.use_offset
ffffffff81624d50 <load0>
an address on assembly code has a specific absolute address as below
ffffffff816250b8:│ mov 0x8(%r14),%rdi
but if use_offset is 'true', an address subtracted from a base address is printed. Default is true. This option is only applied to TUI.
368:│ mov 0x8(%r14),%rdi
This option works with tui, stdio2 browsers.
annotate.jump_arrows
│ ┌──jmp 1333 │ │ xchg %ax,%ax │1330:│ mov %r15,%r10 │1333:└─→cmp %r15,%r14
If jump_arrow is 'false', the arrows isn't printed as below. Default is 'false'.
│ ↓ jmp 1333 │ xchg %ax,%ax │1330: mov %r15,%r10 │1333: cmp %r15,%r14
This option works with tui browser.
annotate.show_linenr
│1628 if (type & PERF_SAMPLE_IDENTIFIER) { │ ↓ jne 508 │1628 data->id = *array; │1629 array++; │1630 }
However if this option is 'false', they aren't printed as below. Default is 'false'.
│ if (type & PERF_SAMPLE_IDENTIFIER) { │ ↓ jne 508 │ data->id = *array; │ array++; │ }
This option works with tui, stdio2 browsers.
annotate.show_nr_jumps
│1382: movb $0x1,-0x270(%rbp)
If use this, the number of branches jumping to that address can be printed as below. Default is 'false'.
│1 1382: movb $0x1,-0x270(%rbp)
This option works with tui, stdio2 browsers.
annotate.show_total_period
302 │ mov %eax,%eax
But if this option is 'false', percent values for overhead are printed i.e. Default is 'false'.
99.93 │ mov %eax,%eax
This option works with tui, stdio2, stdio browsers.
annotate.show_nr_samples
Percent│
74.03 │ mov %fs:0x28,%rax
When set as true:
Samples│
6 │ mov %fs:0x28,%rax
This option works with tui, stdio2, stdio browsers.
annotate.offset_level
This option works with tui, stdio2 browsers.
annotate.demangle
annotate.demangle_kernel
hist.*, hist.percentage
Overhead Symbols ........ .......
33.33% foo
33.33% bar
33.33% baz
This is an original overhead and we'll filter out the first 'foo' entry. The value of 'relative' would increase the overhead of 'bar' and 'baz' to 50.00% for each, while 'absolute' would show their current overhead (33.33%).
ui.*, ui.show-headers
call-graph.*
call-graph.record-mode
call-graph.dump-size
call-graph.print-type
Overhead Symbols ........ .......
40.00% foo
|
---foo
|
|--50.00%--bar
| main
|
--50.00%--baz
main
This output is a 'fractal' format. The 'foo' came from 'bar' and 'baz' exactly half and half so 'fractal' shows 50.00% for each (meaning that it assumes 100% total overhead of 'foo').
The 'graph' uses absolute overhead value of 'foo' as total so each of 'bar' and 'baz' callchain will have 20.00% of overhead. If 'flat' is used, single column and linear exposure of call chains. 'folded' mean call chains are displayed in a line, separated by semicolons.
call-graph.order
If this option is not set and report.children or top.children is set to true (or the equivalent command line option is given), the default value of this option is changed to 'caller' for the execution of 'perf report' or 'perf top'. Other commands will still default to 'callee'.
call-graph.sort-key
call-graph.threshold
call-graph.print-limit
report.*, report.sort_order
report.percent-limit
report.queue-size
report.children
report.group
# group: {ref-cycles,cycles} # ======== # # Samples: 7K of event 'anon group { ref-cycles, cycles }' # Event count (approx.): 6876107743 # # Overhead Command Shared Object Symbol # ................ ....... ................. ................... #
99.84% 99.76% noploop noploop [.] main
0.07% 0.00% noploop ld-2.15.so [.] strcmp
0.03% 0.00% noploop [kernel.kallsyms] [k] timerqueue_del
report.skip-empty
top.*, top.children
top.call-graph
man.*, man.viewer
New man viewer tool can be also added using 'man.<tool>.cmd' or use different path using 'man.<tool>.path' config option.
pager.*, pager.<subcommand>
kmem.*, kmem.default
record.*, record.build-id
record.call-graph
record.aio
record.debuginfod
http://192.168.122.174:8002
If the URLs is 'system', the value of DEBUGINFOD_URLS system environment variable is used.
diff.*, diff.order
diff.compute
trace.*, trace.add_events
trace.args_alignment
trace.no_inherit
trace.show_arg_names
trace.show_duration
trace.show_prefix
trace.show_timestamp
trace.show_zeros
trace.tracepoint_beautifiers
ftrace.*, ftrace.tracer
llvm.*, llvm.clang-path
llvm.clang-bpf-cmd-template
llvm.clang-opt
llvm.kbuild-dir
llvm.kbuild-opts
llvm.dump-obj
llvm.opts
samples.*, samples.context
scripts.*
convert.*, convert.queue-size
stat.*, stat.big-num
intel-pt.*, intel-pt.cache-divisor, intel-pt.mispred-all
intel-pt.max-loops
auxtrace.*, auxtrace.dumpdir
itrace.*, debug-log-buffer-size
daemon.*, daemon.base
session-<NAME>.*, session-<NAME>.run
2024-02-01 | perf |