1PERF-CONFIG(1) perf Manual PERF-CONFIG(1)
2
3
4
6 perf-config - Get and set variables in a configuration file.
7
9 perf config [<file-option>] [section.name[=value] ...]
10 or
11 perf config [<file-option>] -l | --list
12
14 You can manage variables in a configuration file with this command.
15
17 -l, --list
18 Show current config variables, name and value, for all sections.
19
20 --user
21 For writing and reading options: write to user $HOME/.perfconfig
22 file or read it.
23
24 --system
25 For writing and reading options: write to system-wide
26 $(sysconfdir)/perfconfig or read it.
27
29 The perf configuration file contains many variables to change various
30 aspects of each of its tools, including output, disk usage, etc. The
31 $HOME/.perfconfig file is used to store a per-user configuration. The
32 file $(sysconfdir)/perfconfig can be used to store a system-wide
33 default configuration.
34
35 When reading or writing, the values are read from the system and user
36 configuration files by default, and options --system and --user can be
37 used to tell the command to read from or write to only that location.
38
39 Syntax
40 The file consist of sections. A section starts with its name surrounded
41 by square brackets and continues till the next section begins. Each
42 variable must be in a section, and have the form name = value, for
43 example:
44
45 [section]
46 name1 = value1
47 name2 = value2
48
49 Section names are case sensitive and can contain any characters except
50 newline (double quote " and backslash have to be escaped as \" and \\,
51 respectively). Section headers can’t span multiple lines.
52
53 Example
54 Given a $HOME/.perfconfig like this:
55
56 # # This is the config file, and # a # and ; character indicates a
57 comment #
58
59 [colors]
60 # Color variables
61 top = red, default
62 medium = green, default
63 normal = lightgray, default
64 selected = white, lightgray
65 jump_arrows = blue, default
66 addr = magenta, default
67 root = white, blue
68
69 [tui]
70 # Defaults if linked with libslang
71 report = on
72 annotate = on
73 top = on
74
75 [buildid]
76 # Default, disable using /dev/null
77 dir = ~/.debug
78
79 [annotate]
80 # Defaults
81 hide_src_code = false
82 use_offset = true
83 jump_arrows = true
84 show_nr_jumps = false
85
86 [help]
87 # Format can be man, info, web or html
88 format = man
89 autocorrect = 0
90
91 [ui]
92 show-headers = true
93
94 [call-graph]
95 # fp (framepointer), dwarf
96 record-mode = fp
97 print-type = graph
98 order = caller
99 sort-key = function
100
101 [report]
102 # Defaults
103 sort-order = comm,dso,symbol
104 percent-limit = 0
105 queue-size = 0
106 children = true
107 group = true
108
109 You can hide source code of annotate feature setting the config to
110 false with
111
112 % perf config annotate.hide_src_code=true
113
114 If you want to add or modify several config items, you can do like
115
116 % perf config ui.show-headers=false kmem.default=slab
117
118 To modify the sort order of report functionality in user config
119 file(i.e. ~/.perfconfig), do
120
121 % perf config --user report sort-order=srcline
122
123 To change colors of selected line to other foreground and background
124 colors in system config file (i.e. $(sysconf)/perfconfig), do
125
126 % perf config --system colors.selected=yellow,green
127
128 To query the record mode of call graph, do
129
130 % perf config call-graph.record-mode
131
132 If you want to know multiple config key/value pairs, you can do like
133
134 % perf config report.queue-size call-graph.order report.children
135
136 To query the config value of sort order of call graph in user config
137 file (i.e. ~/.perfconfig), do
138
139 % perf config --user call-graph.sort-order
140
141 To query the config value of buildid directory in system config file
142 (i.e. $(sysconf)/perfconfig), do
143
144 % perf config --system buildid.dir
145
146 Variables
147 colors.*
148 The variables for customizing the colors used in the output for the
149 report, top and annotate in the TUI. They should specify the
150 foreground and background colors, separated by a comma, for
151 example:
152
153 medium = green, lightgray
154
155 If you want to use the color configured for you terminal, just leave it
156 as 'default', for example:
157
158 medium = default, lightgray
159
160 Available colors:
161 red, yellow, green, cyan, gray, black, blue,
162 white, default, magenta, lightgray
163
164 colors.top
165 top means a overhead percentage which is more than 5%. And values
166 of this variable specify percentage colors. Basic key values are
167 foreground-color red and background-color default.
168
169 colors.medium
170 medium means a overhead percentage which has more than 0.5%.
171 Default values are green and default.
172
173 colors.normal
174 normal means the rest of overhead percentages except top, medium,
175 selected. Default values are lightgray and default.
176
177 colors.selected
178 This selects the colors for the current entry in a list of entries
179 from sub-commands (top, report, annotate). Default values are black
180 and lightgray.
181
182 colors.jump_arrows
183 Colors for jump arrows on assembly code listings such as jns, jmp,
184 jane, etc. Default values are blue, default.
185
186 colors.addr
187 This selects colors for addresses from annotate. Default values are
188 magenta, default.
189
190 colors.root
191 Colors for headers in the output of a sub-commands (top, report).
192 Default values are white, blue.
193
194 tui., gtk.
195 Subcommands that can be configured here are top, report and
196 annotate. These values are booleans, for example:
197
198 [tui]
199 top = true
200
201 will make the TUI be the default for the 'top' subcommand. Those will be
202 available if the required libs were detected at tool build time.
203
204 buildid.*, buildid.dir
205 Each executable and shared library in modern distributions comes
206 with a content based identifier that, if available, will be
207 inserted in a perf.data file header to, at analysis time find what
208 is needed to do symbol resolution, code annotation, etc.
209
210 The recording tools also stores a hard link or copy in a per-user
211 directory, $HOME/.debug/, of binaries, shared libraries, /proc/kallsyms
212 and /proc/kcore files to be used at analysis time.
213
214 The buildid.dir variable can be used to either change this directory
215 cache location, or to disable it altogether. If you want to disable it,
216 set buildid.dir to /dev/null. The default is $HOME/.debug
217
218 annotate.*
219 These options work only for TUI. These are in control of addresses,
220 jump function, source code in lines of assembly code from a
221 specific program.
222
223 annotate.hide_src_code
224 If a program which is analyzed has source code, this option lets
225 annotate print a list of assembly code with the source code. For
226 example, let’s see a part of a program. There’re four lines. If
227 this option is true, they can be printed without source code from a
228 program as below.
229
230 │ push %rbp
231 │ mov %rsp,%rbp
232 │ sub $0x10,%rsp
233 │ mov (%rdi),%rdx
234
235 But if this option is 'false', source code of the part
236 can be also printed as below. Default is 'false'.
237
238 │ struct rb_node *rb_next(const struct rb_node *node)
239 │ {
240 │ push %rbp
241 │ mov %rsp,%rbp
242 │ sub $0x10,%rsp
243 │ struct rb_node *parent;
244 │
245 │ if (RB_EMPTY_NODE(node))
246 │ mov (%rdi),%rdx
247 │ return n;
248
249 annotate.use_offset
250 Basing on a first address of a loaded function, offset can be used.
251 Instead of using original addresses of assembly code, addresses
252 subtracted from a base address can be printed. Let’s illustrate an
253 example. If a base address is 0XFFFFFFFF81624d50 as below,
254
255 ffffffff81624d50 <load0>
256
257 an address on assembly code has a specific absolute address as below
258
259 ffffffff816250b8:│ mov 0x8(%r14),%rdi
260
261 but if use_offset is 'true', an address subtracted from a base address is printed.
262 Default is true. This option is only applied to TUI.
263
264 368:│ mov 0x8(%r14),%rdi
265
266 annotate.jump_arrows
267 There can be jump instruction among assembly code. Depending on a
268 boolean value of jump_arrows, arrows can be printed or not which
269 represent where do the instruction jump into as below.
270
271 │ ┌──jmp 1333
272 │ │ xchg %ax,%ax
273 │1330:│ mov %r15,%r10
274 │1333:└─→cmp %r15,%r14
275
276 If jump_arrow is 'false', the arrows isn't printed as below.
277 Default is 'false'.
278
279 │ ↓ jmp 1333
280 │ xchg %ax,%ax
281 │1330: mov %r15,%r10
282 │1333: cmp %r15,%r14
283
284 annotate.show_linenr
285 When showing source code if this option is true, line numbers are
286 printed as below.
287
288 │1628 if (type & PERF_SAMPLE_IDENTIFIER) {
289 │ ↓ jne 508
290 │1628 data->id = *array;
291 │1629 array++;
292 │1630 }
293
294 However if this option is 'false', they aren't printed as below.
295 Default is 'false'.
296
297 │ if (type & PERF_SAMPLE_IDENTIFIER) {
298 │ ↓ jne 508
299 │ data->id = *array;
300 │ array++;
301 │ }
302
303 annotate.show_nr_jumps
304 Let’s see a part of assembly code.
305
306 │1382: movb $0x1,-0x270(%rbp)
307
308 If use this, the number of branches jumping to that address can be printed as below.
309 Default is 'false'.
310
311 │1 1382: movb $0x1,-0x270(%rbp)
312
313 annotate.show_total_period
314 To compare two records on an instruction base, with this option
315 provided, display total number of samples that belong to a line in
316 assembly code. If this option is true, total periods are printed
317 instead of percent values as below.
318
319 302 │ mov %eax,%eax
320
321 But if this option is 'false', percent values for overhead are printed i.e.
322 Default is 'false'.
323
324 99.93 │ mov %eax,%eax
325
326 annotate.offset_level
327 Default is 1, meaning just jump targets will have offsets show
328 right beside the instruction. When set to 2 call instructions will
329 also have its offsets shown, 3 or higher will show offsets for all
330 instructions.
331
332 hist.*, hist.percentage
333 This option control the way to calculate overhead of filtered
334 entries - that means the value of this option is effective only if
335 there’s a filter (by comm, dso or symbol name). Suppose a following
336 example:
337
338 Overhead Symbols
339 ........ .......
340 33.33% foo
341 33.33% bar
342 33.33% baz
343
344 This is an original overhead and we'll filter out the first 'foo'
345 entry. The value of 'relative' would increase the overhead of 'bar'
346 and 'baz' to 50.00% for each, while 'absolute' would show their
347 current overhead (33.33%).
348
349 ui.*, ui.show-headers
350 This option controls display of column headers (like Overhead and
351 Symbol) in report and top. If this option is false, they are
352 hidden. This option is only applied to TUI.
353
354 call-graph.*
355 When sub-commands top and report work with -g/—-children there’re
356 options in control of call-graph.
357
358 call-graph.record-mode
359 The record-mode can be fp (frame pointer), dwarf and lbr. The value
360 of dwarf is effective only if perf detect needed library (libunwind
361 or a recent version of libdw). lbr only work for cpus that support
362 it.
363
364 call-graph.dump-size
365 The size of stack to dump in order to do post-unwinding. Default is
366 8192 (byte). When using dwarf into record-mode, the default size
367 will be used if omitted.
368
369 call-graph.print-type
370 The print-types can be graph (graph absolute), fractal (graph
371 relative), flat and folded. This option controls a way to show
372 overhead for each callchain entry. Suppose a following example.
373
374 Overhead Symbols
375 ........ .......
376 40.00% foo
377 |
378 ---foo
379 |
380 |--50.00%--bar
381 | main
382 |
383 --50.00%--baz
384 main
385
386 This output is a 'fractal' format. The 'foo' came from 'bar' and 'baz' exactly
387 half and half so 'fractal' shows 50.00% for each
388 (meaning that it assumes 100% total overhead of 'foo').
389
390 The 'graph' uses absolute overhead value of 'foo' as total so each of
391 'bar' and 'baz' callchain will have 20.00% of overhead.
392 If 'flat' is used, single column and linear exposure of call chains.
393 'folded' mean call chains are displayed in a line, separated by semicolons.
394
395 call-graph.order
396 This option controls print order of callchains. The default is
397 callee which means callee is printed at top and then followed by
398 its caller and so on. The caller prints it in reverse order.
399
400 If this option is not set and report.children or top.children is
401 set to true (or the equivalent command line option is given),
402 the default value of this option is changed to 'caller' for the
403 execution of 'perf report' or 'perf top'. Other commands will
404 still default to 'callee'.
405
406 call-graph.sort-key
407 The callchains are merged if they contain same information. The
408 sort-key option determines a way to compare the callchains. A value
409 of sort-key can be function or address. The default is function.
410
411 call-graph.threshold
412 When there’re many callchains it’d print tons of lines. So perf
413 omits small callchains under a certain overhead (threshold) and
414 this option control the threshold. Default is 0.5 (%). The overhead
415 is calculated by value depends on call-graph.print-type.
416
417 call-graph.print-limit
418 This is a maximum number of lines of callchain printed for a single
419 histogram entry. Default is 0 which means no limitation.
420
421 report.*, report.sort_order
422 Allows changing the default sort order from "comm,dso,symbol" to
423 some other default, for instance "sym,dso" may be more fitting for
424 kernel developers.
425
426 report.percent-limit
427 This one is mostly the same as call-graph.threshold but works for
428 histogram entries. Entries having an overhead lower than this
429 percentage will not be printed. Default is 0. If percent-limit is
430 10, only entries which have more than 10% of overhead will be
431 printed.
432
433 report.queue-size
434 This option sets up the maximum allocation size of the internal
435 event queue for ordering events. Default is 0, meaning no limit.
436
437 report.children
438 Children means functions called from another function. If this
439 option is true, perf report cumulates callchains of children and
440 show (accumulated) total overhead as well as Self overhead. Please
441 refer to the perf report manual. The default is true.
442
443 report.group
444 This option is to show event group information together. Example
445 output with this turned on, notice that there is one column per
446 event in the group, ref-cycles and cycles:
447
448 # group: {ref-cycles,cycles}
449 # ========
450 #
451 # Samples: 7K of event 'anon group { ref-cycles, cycles }'
452 # Event count (approx.): 6876107743
453 #
454 # Overhead Command Shared Object Symbol
455 # ................ ....... ................. ...................
456 #
457 99.84% 99.76% noploop noploop [.] main
458 0.07% 0.00% noploop ld-2.15.so [.] strcmp
459 0.03% 0.00% noploop [kernel.kallsyms] [k] timerqueue_del
460
461 top.*, top.children
462 Same as report.children. So if it is enabled, the output of top
463 command will have Children overhead column as well as Self overhead
464 column by default. The default is true.
465
466 man.*, man.viewer
467 This option can assign a tool to view manual pages when help
468 subcommand was invoked. Supported tools are man, woman (with emacs
469 client) and konqueror. Default is man.
470
471 New man viewer tool can be also added using 'man.<tool>.cmd'
472 or use different path using 'man.<tool>.path' config option.
473
474 pager.*, pager.<subcommand>
475 When the subcommand is run on stdio, determine whether it uses
476 pager or not based on this value. Default is unspecified.
477
478 kmem.*, kmem.default
479 This option decides which allocator is to be analyzed if neither
480 --slab nor --page option is used. Default is slab.
481
482 record.*, record.build-id
483 This option can be cache, no-cache or skip. cache is to
484 post-process data and save/update the binaries into the build-id
485 cache (in ~/.debug). This is the default. But if this option is
486 no-cache, it will not update the build-id cache. skip skips
487 post-processing and does not update the cache.
488
489 diff.*, diff.order
490 This option sets the number of columns to sort the result. The
491 default is 0, which means sorting by baseline. Setting it to 1 will
492 sort the result by delta (or other compute method selected).
493
494 diff.compute
495 This options sets the method for computing the diff result.
496 Possible values are delta, delta-abs, ratio and wdiff. Default is
497 delta.
498
500 perf(1)
501
502
503
504perf 09/24/2019 PERF-CONFIG(1)