perf-config.txt 15 KB

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