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 hist.*, hist.percentage
327 This option control the way to calculate overhead of filtered
328 entries - that means the value of this option is effective only if
329 there’s a filter (by comm, dso or symbol name). Suppose a following
330 example:
331
332 Overhead Symbols
333 ........ .......
334 33.33% foo
335 33.33% bar
336 33.33% baz
337
338 This is an original overhead and we'll filter out the first 'foo'
339 entry. The value of 'relative' would increase the overhead of 'bar'
340 and 'baz' to 50.00% for each, while 'absolute' would show their
341 current overhead (33.33%).
342
343 ui.*, ui.show-headers
344 This option controls display of column headers (like Overhead and
345 Symbol) in report and top. If this option is false, they are
346 hidden. This option is only applied to TUI.
347
348 call-graph.*
349 When sub-commands top and report work with -g/—-children there’re
350 options in control of call-graph.
351
352 call-graph.record-mode
353 The record-mode can be fp (frame pointer), dwarf and lbr. The value
354 of dwarf is effective only if perf detect needed library (libunwind
355 or a recent version of libdw). lbr only work for cpus that support
356 it.
357
358 call-graph.dump-size
359 The size of stack to dump in order to do post-unwinding. Default is
360 8192 (byte). When using dwarf into record-mode, the default size
361 will be used if omitted.
362
363 call-graph.print-type
364 The print-types can be graph (graph absolute), fractal (graph
365 relative), flat and folded. This option controls a way to show
366 overhead for each callchain entry. Suppose a following example.
367
368 Overhead Symbols
369 ........ .......
370 40.00% foo
371 |
372 ---foo
373 |
374 |--50.00%--bar
375 | main
376 |
377 --50.00%--baz
378 main
379
380 This output is a 'fractal' format. The 'foo' came from 'bar' and 'baz' exactly
381 half and half so 'fractal' shows 50.00% for each
382 (meaning that it assumes 100% total overhead of 'foo').
383
384 The 'graph' uses absolute overhead value of 'foo' as total so each of
385 'bar' and 'baz' callchain will have 20.00% of overhead.
386 If 'flat' is used, single column and linear exposure of call chains.
387 'folded' mean call chains are displayed in a line, separated by semicolons.
388
389 call-graph.order
390 This option controls print order of callchains. The default is
391 callee which means callee is printed at top and then followed by
392 its caller and so on. The caller prints it in reverse order.
393
394 If this option is not set and report.children or top.children is
395 set to true (or the equivalent command line option is given),
396 the default value of this option is changed to 'caller' for the
397 execution of 'perf report' or 'perf top'. Other commands will
398 still default to 'callee'.
399
400 call-graph.sort-key
401 The callchains are merged if they contain same information. The
402 sort-key option determines a way to compare the callchains. A value
403 of sort-key can be function or address. The default is function.
404
405 call-graph.threshold
406 When there’re many callchains it’d print tons of lines. So perf
407 omits small callchains under a certain overhead (threshold) and
408 this option control the threshold. Default is 0.5 (%). The overhead
409 is calculated by value depends on call-graph.print-type.
410
411 call-graph.print-limit
412 This is a maximum number of lines of callchain printed for a single
413 histogram entry. Default is 0 which means no limitation.
414
415 report.*, report.sort_order
416 Allows changing the default sort order from "comm,dso,symbol" to
417 some other default, for instance "sym,dso" may be more fitting for
418 kernel developers.
419
420 report.percent-limit
421 This one is mostly the same as call-graph.threshold but works for
422 histogram entries. Entries having an overhead lower than this
423 percentage will not be printed. Default is 0. If percent-limit is
424 10, only entries which have more than 10% of overhead will be
425 printed.
426
427 report.queue-size
428 This option sets up the maximum allocation size of the internal
429 event queue for ordering events. Default is 0, meaning no limit.
430
431 report.children
432 Children means functions called from another function. If this
433 option is true, perf report cumulates callchains of children and
434 show (accumulated) total overhead as well as Self overhead. Please
435 refer to the perf report manual. The default is true.
436
437 report.group
438 This option is to show event group information together. Example
439 output with this turned on, notice that there is one column per
440 event in the group, ref-cycles and cycles:
441
442 # group: {ref-cycles,cycles}
443 # ========
444 #
445 # Samples: 7K of event 'anon group { ref-cycles, cycles }'
446 # Event count (approx.): 6876107743
447 #
448 # Overhead Command Shared Object Symbol
449 # ................ ....... ................. ...................
450 #
451 99.84% 99.76% noploop noploop [.] main
452 0.07% 0.00% noploop ld-2.15.so [.] strcmp
453 0.03% 0.00% noploop [kernel.kallsyms] [k] timerqueue_del
454
455 top.*, top.children
456 Same as report.children. So if it is enabled, the output of top
457 command will have Children overhead column as well as Self overhead
458 column by default. The default is true.
459
460 man.*, man.viewer
461 This option can assign a tool to view manual pages when help
462 subcommand was invoked. Supported tools are man, woman (with emacs
463 client) and konqueror. Default is man.
464
465 New man viewer tool can be also added using 'man.<tool>.cmd'
466 or use different path using 'man.<tool>.path' config option.
467
468 pager.*, pager.<subcommand>
469 When the subcommand is run on stdio, determine whether it uses
470 pager or not based on this value. Default is unspecified.
471
472 kmem.*, kmem.default
473 This option decides which allocator is to be analyzed if neither
474 --slab nor --page option is used. Default is slab.
475
476 record.*, record.build-id
477 This option can be cache, no-cache or skip. cache is to
478 post-process data and save/update the binaries into the build-id
479 cache (in ~/.debug). This is the default. But if this option is
480 no-cache, it will not update the build-id cache. skip skips
481 post-processing and does not update the cache.
482
483 diff.*, diff.order
484 This option sets the number of columns to sort the result. The
485 default is 0, which means sorting by baseline. Setting it to 1 will
486 sort the result by delta (or other compute method selected).
487
488 diff.compute
489 This options sets the method for computing the diff result.
490 Possible values are delta, delta-abs, ratio and wdiff. Default is
491 delta.
492
494 perf(1)
495
496
497
498perf 06/18/2019 PERF-CONFIG(1)