perf-config.txt 15 KB

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