Path: blob/master/tools/perf/Documentation/perf-config.txt
26282 views
perf-config(1)1==============23NAME4----5perf-config - Get and set variables in a configuration file.67SYNOPSIS8--------9[verse]10'perf config' [<file-option>] [section.name[=value] ...]11or12'perf config' [<file-option>] -l | --list1314DESCRIPTION15-----------16You can manage variables in a configuration file with this command.1718OPTIONS19-------2021-l::22--list::23Show current config variables, name and value, for all sections.2425--user::26For writing and reading options: write to user27'$HOME/.perfconfig' file or read it.2829--system::30For writing and reading options: write to system-wide31'$(sysconfdir)/perfconfig' or read it.3233CONFIGURATION FILE34------------------3536The perf configuration file contains many variables to change various37aspects of each of its tools, including output, disk usage, etc.38The '$HOME/.perfconfig' file is used to store a per-user configuration.39The file '$(sysconfdir)/perfconfig' can be used to40store a system-wide default configuration.4142One can disable reading config files by setting the PERF_CONFIG environment43variable to /dev/null, or provide an alternate config file by setting that44variable.4546When reading or writing, the values are read from the system and user47configuration files by default, and options '--system' and '--user'48can be used to tell the command to read from or write to only that location.4950Syntax51~~~~~~5253The file consist of sections. A section starts with its name54surrounded by square brackets and continues till the next section55begins. Each variable must be in a section, and have the form56'name = value', for example:5758[section]59name1 = value160name2 = value26162Section names are case sensitive and can contain any characters except63newline (double quote `"` and backslash have to be escaped as `\"` and `\\`,64respectively). Section headers can't span multiple lines.6566Example67~~~~~~~6869Given a $HOME/.perfconfig like this:7071#72# This is the config file, and73# a '#' and ';' character indicates a comment74#7576[colors]77# Color variables78top = red, default79medium = green, default80normal = lightgray, default81selected = white, lightgray82jump_arrows = blue, default83addr = magenta, default84root = white, blue8586[tui]87# Defaults if linked with libslang88report = on89annotate = on90top = on9192[buildid]93# Default, disable using /dev/null94dir = ~/.debug9596[annotate]97# Defaults98hide_src_code = false99use_offset = true100jump_arrows = true101show_nr_jumps = false102103[help]104# Format can be man, info, web or html105format = man106autocorrect = 0107108[ui]109show-headers = true110111[call-graph]112# fp (framepointer), dwarf113record-mode = fp114print-type = graph115order = caller116sort-key = function117118[report]119# Defaults120sort_order = comm,dso,symbol121percent-limit = 0122queue-size = 0123children = true124group = true125skip-empty = true126127128You can hide source code of annotate feature setting the config to false with129130% perf config annotate.hide_src_code=true131132If you want to add or modify several config items, you can do like133134% perf config ui.show-headers=false kmem.default=slab135136To modify the sort order of report functionality in user config file(i.e. `~/.perfconfig`), do137138% perf config --user report.sort-order=srcline139140To change colors of selected line to other foreground and background colors141in system config file (i.e. `$(sysconf)/perfconfig`), do142143% perf config --system colors.selected=yellow,green144145To query the record mode of call graph, do146147% perf config call-graph.record-mode148149If you want to know multiple config key/value pairs, you can do like150151% perf config report.queue-size call-graph.order report.children152153To query the config value of sort order of call graph in user config file (i.e. `~/.perfconfig`), do154155% perf config --user call-graph.sort-order156157To query the config value of buildid directory in system config file (i.e. `$(sysconf)/perfconfig`), do158159% perf config --system buildid.dir160161Variables162~~~~~~~~~163164colors.*::165The variables for customizing the colors used in the output for the166'report', 'top' and 'annotate' in the TUI. They should specify the167foreground and background colors, separated by a comma, for example:168169medium = green, lightgray170171If you want to use the color configured for you terminal, just leave it172as 'default', for example:173174medium = default, lightgray175176Available colors:177red, yellow, green, cyan, gray, black, blue,178white, default, magenta, lightgray179180colors.top::181'top' means a overhead percentage which is more than 5%.182And values of this variable specify percentage colors.183Basic key values are foreground-color 'red' and184background-color 'default'.185colors.medium::186'medium' means a overhead percentage which has more than 0.5%.187Default values are 'green' and 'default'.188colors.normal::189'normal' means the rest of overhead percentages190except 'top', 'medium', 'selected'.191Default values are 'lightgray' and 'default'.192colors.selected::193This selects the colors for the current entry in a list of entries194from sub-commands (top, report, annotate).195Default values are 'black' and 'lightgray'.196colors.jump_arrows::197Colors for jump arrows on assembly code listings198such as 'jns', 'jmp', 'jane', etc.199Default values are 'blue', 'default'.200colors.addr::201This selects colors for addresses from 'annotate'.202Default values are 'magenta', 'default'.203colors.root::204Colors for headers in the output of a sub-commands (top, report).205Default values are 'white', 'blue'.206207core.*::208core.proc-map-timeout::209Sets a timeout (in milliseconds) for parsing /proc/<pid>/maps files.210Can be overridden by the --proc-map-timeout option on supported211subcommands. The default timeout is 500ms.212213tui.*, gtk.*::214Subcommands that can be configured here are 'top', 'report' and 'annotate'.215These values are booleans, for example:216217[tui]218top = true219220will make the TUI be the default for the 'top' subcommand. Those will be221available if the required libs were detected at tool build time.222223buildid.*::224buildid.dir::225Each executable and shared library in modern distributions comes with a226content based identifier that, if available, will be inserted in a227'perf.data' file header to, at analysis time find what is needed to do228symbol resolution, code annotation, etc.229230The recording tools also stores a hard link or copy in a per-user231directory, $HOME/.debug/, of binaries, shared libraries, /proc/kallsyms232and /proc/kcore files to be used at analysis time.233234The buildid.dir variable can be used to either change this directory235cache location, or to disable it altogether. If you want to disable it,236set buildid.dir to /dev/null. The default is $HOME/.debug237238buildid-cache.*::239buildid-cache.debuginfod=URLs240Specify debuginfod URLs to be used when retrieving perf.data binaries,241it follows the same syntax as the DEBUGINFOD_URLS variable, like:242243buildid-cache.debuginfod=http://192.168.122.174:8002244245annotate.*::246These are in control of addresses, jump function, source code247in lines of assembly code from a specific program.248249annotate.disassemblers::250Choose the disassembler to use: "objdump", "llvm", "capstone",251if not specified it will first try, if available, the "llvm" one,252then, if it fails, "capstone", and finally the original "objdump"253based one.254255Choosing a different one is useful when handling some feature that256is known to be best support at some point by one of the options,257to compare the output when in doubt about some bug, etc.258259This can be a list, in order of preference, the first one that works260finishes the process.261262annotate.addr2line::263addr2line binary to use for file names and line numbers.264265annotate.objdump::266objdump binary to use for disassembly and annotations,267including in the 'perf test' command.268269annotate.disassembler_style::270Use this to change the default disassembler style to some other value271supported by binutils, such as "intel", see the '-M' option help in the272'objdump' man page.273274annotate.hide_src_code::275If a program which is analyzed has source code,276this option lets 'annotate' print a list of assembly code with the source code.277For example, let's see a part of a program. There're four lines.278If this option is 'true', they can be printed279without source code from a program as below.280281│ push %rbp282│ mov %rsp,%rbp283│ sub $0x10,%rsp284│ mov (%rdi),%rdx285286But if this option is 'false', source code of the part287can be also printed as below. Default is 'false'.288289│ struct rb_node *rb_next(const struct rb_node *node)290│ {291│ push %rbp292│ mov %rsp,%rbp293│ sub $0x10,%rsp294│ struct rb_node *parent;295│296│ if (RB_EMPTY_NODE(node))297│ mov (%rdi),%rdx298│ return n;299300This option works with tui, stdio2 browsers.301302annotate.use_offset::303Basing on a first address of a loaded function, offset can be used.304Instead of using original addresses of assembly code,305addresses subtracted from a base address can be printed.306Let's illustrate an example.307If a base address is 0XFFFFFFFF81624d50 as below,308309ffffffff81624d50 <load0>310311an address on assembly code has a specific absolute address as below312313ffffffff816250b8:│ mov 0x8(%r14),%rdi314315but if use_offset is 'true', an address subtracted from a base address is printed.316Default is true. This option is only applied to TUI.317318368:│ mov 0x8(%r14),%rdi319320This option works with tui, stdio2 browsers.321322annotate.jump_arrows::323There can be jump instruction among assembly code.324Depending on a boolean value of jump_arrows,325arrows can be printed or not which represent326where do the instruction jump into as below.327328│ ┌──jmp 1333329│ │ xchg %ax,%ax330│1330:│ mov %r15,%r10331│1333:└─→cmp %r15,%r14332333If jump_arrow is 'false', the arrows isn't printed as below.334Default is 'false'.335336│ ↓ jmp 1333337│ xchg %ax,%ax338│1330: mov %r15,%r10339│1333: cmp %r15,%r14340341This option works with tui browser.342343annotate.show_linenr::344When showing source code if this option is 'true',345line numbers are printed as below.346347│1628 if (type & PERF_SAMPLE_IDENTIFIER) {348│ ↓ jne 508349│1628 data->id = *array;350│1629 array++;351│1630 }352353However if this option is 'false', they aren't printed as below.354Default is 'false'.355356│ if (type & PERF_SAMPLE_IDENTIFIER) {357│ ↓ jne 508358│ data->id = *array;359│ array++;360│ }361362This option works with tui, stdio2 browsers.363364annotate.show_nr_jumps::365Let's see a part of assembly code.366367│1382: movb $0x1,-0x270(%rbp)368369If use this, the number of branches jumping to that address can be printed as below.370Default is 'false'.371372│1 1382: movb $0x1,-0x270(%rbp)373374This option works with tui, stdio2 browsers.375376annotate.show_total_period::377To compare two records on an instruction base, with this option378provided, display total number of samples that belong to a line379in assembly code. If this option is 'true', total periods are printed380instead of percent values as below.381382302 │ mov %eax,%eax383384But if this option is 'false', percent values for overhead are printed i.e.385Default is 'false'.38638799.93 │ mov %eax,%eax388389This option works with tui, stdio2, stdio browsers.390391annotate.show_nr_samples::392By default perf annotate shows percentage of samples. This option393can be used to print absolute number of samples. Ex, when set as394false:395396Percent│39774.03 │ mov %fs:0x28,%rax398399When set as true:400401Samples│4026 │ mov %fs:0x28,%rax403404This option works with tui, stdio2, stdio browsers.405406annotate.offset_level::407Default is '1', meaning just jump targets will have offsets show right beside408the instruction. When set to '2' 'call' instructions will also have its offsets409shown, 3 or higher will show offsets for all instructions.410411This option works with tui, stdio2 browsers.412413annotate.demangle::414Demangle symbol names to human readable form. Default is 'true'.415416annotate.demangle_kernel::417Demangle kernel symbol names to human readable form. Default is 'true'.418419hist.*::420hist.percentage::421This option control the way to calculate overhead of filtered entries -422that means the value of this option is effective only if there's a423filter (by comm, dso or symbol name). Suppose a following example:424425Overhead Symbols426........ .......42733.33% foo42833.33% bar42933.33% baz430431This is an original overhead and we'll filter out the first 'foo'432entry. The value of 'relative' would increase the overhead of 'bar'433and 'baz' to 50.00% for each, while 'absolute' would show their434current overhead (33.33%).435436ui.*::437ui.show-headers::438This option controls display of column headers (like 'Overhead' and 'Symbol')439in 'report' and 'top'. If this option is false, they are hidden.440This option is only applied to TUI.441442call-graph.*::443The following controls the handling of call-graphs (obtained via the444-g/--call-graph options).445446call-graph.record-mode::447The mode for user space can be 'fp' (frame pointer), 'dwarf'448and 'lbr'. The value 'dwarf' is effective only if libunwind449(or a recent version of libdw) is present on the system;450the value 'lbr' only works for certain cpus. The method for451kernel space is controlled not by this option but by the452kernel config (CONFIG_UNWINDER_*).453454call-graph.dump-size::455The size of stack to dump in order to do post-unwinding. Default is 8192 (byte).456When using dwarf into record-mode, the default size will be used if omitted.457458call-graph.print-type::459The print-types can be graph (graph absolute), fractal (graph relative),460flat and folded. This option controls a way to show overhead for each callchain461entry. Suppose a following example.462463Overhead Symbols464........ .......46540.00% foo466|467---foo468|469|--50.00%--bar470| main471|472--50.00%--baz473main474475This output is a 'fractal' format. The 'foo' came from 'bar' and 'baz' exactly476half and half so 'fractal' shows 50.00% for each477(meaning that it assumes 100% total overhead of 'foo').478479The 'graph' uses absolute overhead value of 'foo' as total so each of480'bar' and 'baz' callchain will have 20.00% of overhead.481If 'flat' is used, single column and linear exposure of call chains.482'folded' mean call chains are displayed in a line, separated by semicolons.483484call-graph.order::485This option controls print order of callchains. The default is486'callee' which means callee is printed at top and then followed by its487caller and so on. The 'caller' prints it in reverse order.488489If this option is not set and report.children or top.children is490set to true (or the equivalent command line option is given),491the default value of this option is changed to 'caller' for the492execution of 'perf report' or 'perf top'. Other commands will493still default to 'callee'.494495call-graph.sort-key::496The callchains are merged if they contain same information.497The sort-key option determines a way to compare the callchains.498A value of 'sort-key' can be 'function' or 'address'.499The default is 'function'.500501call-graph.threshold::502When there're many callchains it'd print tons of lines. So perf omits503small callchains under a certain overhead (threshold) and this option504control the threshold. Default is 0.5 (%). The overhead is calculated505by value depends on call-graph.print-type.506507call-graph.print-limit::508This is a maximum number of lines of callchain printed for a single509histogram entry. Default is 0 which means no limitation.510511report.*::512report.sort_order::513Allows changing the default sort order from "comm,dso,symbol" to514some other default, for instance "sym,dso" may be more fitting for515kernel developers.516report.percent-limit::517This one is mostly the same as call-graph.threshold but works for518histogram entries. Entries having an overhead lower than this519percentage will not be printed. Default is '0'. If percent-limit520is '10', only entries which have more than 10% of overhead will be521printed.522523report.queue-size::524This option sets up the maximum allocation size of the internal525event queue for ordering events. Default is 0, meaning no limit.526527report.children::528'Children' means functions called from another function.529If this option is true, 'perf report' cumulates callchains of children530and show (accumulated) total overhead as well as 'Self' overhead.531Please refer to the 'perf report' manual. The default is 'true'.532533report.group::534This option is to show event group information together.535Example output with this turned on, notice that there is one column536per event in the group, ref-cycles and cycles:537538# group: {ref-cycles,cycles}539# ========540#541# Samples: 7K of event 'anon group { ref-cycles, cycles }'542# Event count (approx.): 6876107743543#544# Overhead Command Shared Object Symbol545# ................ ....... ................. ...................546#54799.84% 99.76% noploop noploop [.] main5480.07% 0.00% noploop ld-2.15.so [.] strcmp5490.03% 0.00% noploop [kernel.kallsyms] [k] timerqueue_del550551report.skip-empty::552This option can change default stat behavior with empty results.553If it's set true, 'perf report --stat' will not show 0 stats.554555top.*::556top.children::557Same as 'report.children'. So if it is enabled, the output of 'top'558command will have 'Children' overhead column as well as 'Self' overhead559column by default.560The default is 'true'.561562top.call-graph::563This is identical to 'call-graph.record-mode', except it is564applicable only for 'top' subcommand. This option ONLY setup565the unwind method. To enable 'perf top' to actually use it,566the command line option -g must be specified.567568man.*::569man.viewer::570This option can assign a tool to view manual pages when 'help'571subcommand was invoked. Supported tools are 'man', 'woman'572(with emacs client) and 'konqueror'. Default is 'man'.573574New man viewer tool can be also added using 'man.<tool>.cmd'575or use different path using 'man.<tool>.path' config option.576577pager.*::578pager.<subcommand>::579When the subcommand is run on stdio, determine whether it uses580pager or not based on this value. Default is 'unspecified'.581582kmem.*::583kmem.default::584This option decides which allocator is to be analyzed if neither585'--slab' nor '--page' option is used. Default is 'slab'.586587record.*::588record.build-id::589This option can be 'cache', 'no-cache', 'skip' or 'mmap'.590'cache' is to post-process data and save/update the binaries into591the build-id cache (in ~/.debug). This is the default.592But if this option is 'no-cache', it will not update the build-id cache.593'skip' skips post-processing and does not update the cache.594'mmap' skips post-processing and reads build-ids from MMAP events.595596record.call-graph::597This is identical to 'call-graph.record-mode', except it is598applicable only for 'record' subcommand. This option ONLY setup599the unwind method. To enable 'perf record' to actually use it,600the command line option -g must be specified.601602record.aio::603Use 'n' control blocks in asynchronous (Posix AIO) trace writing604mode ('n' default: 1, max: 4).605606record.debuginfod::607Specify debuginfod URL to be used when cacheing perf.data binaries,608it follows the same syntax as the DEBUGINFOD_URLS variable, like:609610http://192.168.122.174:8002611612If the URLs is 'system', the value of DEBUGINFOD_URLS system environment613variable is used.614615diff.*::616diff.order::617This option sets the number of columns to sort the result.618The default is 0, which means sorting by baseline.619Setting it to 1 will sort the result by delta (or other620compute method selected).621622diff.compute::623This options sets the method for computing the diff result.624Possible values are 'delta', 'delta-abs', 'ratio' and625'wdiff'. Default is 'delta'.626627trace.*::628trace.add_events::629Allows adding a set of events to add to the ones specified630by the user, or use as a default one if none was specified.631The initial use case is to add augmented_raw_syscalls.o to632activate the 'perf trace' logic that looks for syscall633pointer contents after the normal tracepoint payload.634635trace.args_alignment::636Number of columns to align the argument list, default is 70,637use 40 for the strace default, zero to no alignment.638639trace.no_inherit::640Do not follow children threads.641642trace.show_arg_names::643Should syscall argument names be printed? If not then trace.show_zeros644will be set.645646trace.show_duration::647Show syscall duration.648649trace.show_prefix::650If set to 'yes' will show common string prefixes in tables. The default651is to remove the common prefix in things like "MAP_SHARED", showing just "SHARED".652653trace.show_timestamp::654Show syscall start timestamp.655656trace.show_zeros::657Do not suppress syscall arguments that are equal to zero.658659trace.tracepoint_beautifiers::660Use "libtraceevent" to use that library to augment the tracepoint arguments,661"libbeauty", the default, to use the same argument beautifiers used in the662strace-like sys_enter+sys_exit lines.663664ftrace.*::665ftrace.tracer::666Can be used to select the default tracer when neither -G nor667-F option is not specified. Possible values are 'function' and668'function_graph'.669670samples.*::671672samples.context::673Define how many ns worth of time to show674around samples in perf report sample context browser.675676scripts.*::677678Any option defines a script that is added to the scripts menu679in the interactive perf browser and whose output is displayed.680The name of the option is the name, the value is a script command line.681The script gets the same options passed as a full perf script,682in particular -i perfdata file, --cpu, --tid683684convert.*::685686convert.queue-size::687Limit the size of ordered_events queue, so we could control688allocation size of perf data files without proper finished689round events.690stat.*::691692stat.big-num::693(boolean) Change the default for "--big-num". To make694"--no-big-num" the default, set "stat.big-num=false".695696intel-pt.*::697698intel-pt.cache-divisor::699700intel-pt.mispred-all::701If set, Intel PT decoder will set the mispred flag on all702branches.703704intel-pt.max-loops::705If set and non-zero, the maximum number of unconditional706branches decoded without consuming any trace packets. If707the maximum is exceeded there will be a "Never-ending loop"708error. The default is 100000.709710intel-pt.all-switch-events::711If the user has permission to do so, always record all context712switch events on all CPUs.713714auxtrace.*::715716auxtrace.dumpdir::717s390 only. The directory to save the auxiliary trace buffer718can be changed using this option. Ex, auxtrace.dumpdir=/tmp.719If the directory does not exist or has the wrong file type,720the current directory is used.721722itrace.*::723724debug-log-buffer-size::725Log size in bytes to output when using the option --itrace=d+e726Refer 'itrace' option of linkperf:perf-script[1] or727linkperf:perf-report[1]. The default is 16384.728729daemon.*::730731daemon.base::732Base path for daemon data. All sessions data are stored under733this path.734735session-<NAME>.*::736737session-<NAME>.run::738739Defines new record session for daemon. The value is record's740command line without the 'record' keyword.741742SEE ALSO743--------744linkperf:perf[1]745746747