perf-config.txt 17 KB

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