Output-Options.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the gprof profiler of the GNU system.
  4. Copyright (C) 1988-2017 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <title>GNU gprof: Output Options</title>
  15. <meta name="description" content="GNU gprof: Output Options">
  16. <meta name="keywords" content="GNU gprof: Output Options">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  23. <link href="Invoking.html#Invoking" rel="up" title="Invoking">
  24. <link href="Analysis-Options.html#Analysis-Options" rel="next" title="Analysis Options">
  25. <link href="Invoking.html#Invoking" rel="prev" title="Invoking">
  26. <style type="text/css">
  27. <!--
  28. a.summary-letter {text-decoration: none}
  29. blockquote.smallquotation {font-size: smaller}
  30. div.display {margin-left: 3.2em}
  31. div.example {margin-left: 3.2em}
  32. div.indentedblock {margin-left: 3.2em}
  33. div.lisp {margin-left: 3.2em}
  34. div.smalldisplay {margin-left: 3.2em}
  35. div.smallexample {margin-left: 3.2em}
  36. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  37. div.smalllisp {margin-left: 3.2em}
  38. kbd {font-style:oblique}
  39. pre.display {font-family: inherit}
  40. pre.format {font-family: inherit}
  41. pre.menu-comment {font-family: serif}
  42. pre.menu-preformatted {font-family: serif}
  43. pre.smalldisplay {font-family: inherit; font-size: smaller}
  44. pre.smallexample {font-size: smaller}
  45. pre.smallformat {font-family: inherit; font-size: smaller}
  46. pre.smalllisp {font-size: smaller}
  47. span.nocodebreak {white-space:nowrap}
  48. span.nolinebreak {white-space:nowrap}
  49. span.roman {font-family:serif; font-weight:normal}
  50. span.sansserif {font-family:sans-serif; font-weight:normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  56. <a name="Output-Options"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="Analysis-Options.html#Analysis-Options" accesskey="n" rel="next">Analysis Options</a>, Up: <a href="Invoking.html#Invoking" accesskey="u" rel="up">Invoking</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="Output-Options-1"></a>
  63. <h3 class="section">4.1 Output Options</h3>
  64. <p>These options specify which of several output formats
  65. <code>gprof</code> should produce.
  66. </p>
  67. <p>Many of these options take an optional <em>symspec</em> to specify
  68. functions to be included or excluded. These options can be
  69. specified multiple times, with different symspecs, to include
  70. or exclude sets of symbols. See <a href="Symspecs.html#Symspecs">Symspecs</a>.
  71. </p>
  72. <p>Specifying any of these options overrides the default (&lsquo;<samp>-p -q</samp>&rsquo;),
  73. which prints a flat profile and call graph analysis
  74. for all functions.
  75. </p>
  76. <dl compact="compact">
  77. <dt><code>-A[<var>symspec</var>]</code></dt>
  78. <dt><code>--annotated-source[=<var>symspec</var>]</code></dt>
  79. <dd><p>The &lsquo;<samp>-A</samp>&rsquo; option causes <code>gprof</code> to print annotated source code.
  80. If <var>symspec</var> is specified, print output only for matching symbols.
  81. See <a href="Annotated-Source.html#Annotated-Source">The Annotated Source Listing</a>.
  82. </p>
  83. </dd>
  84. <dt><code>-b</code></dt>
  85. <dt><code>--brief</code></dt>
  86. <dd><p>If the &lsquo;<samp>-b</samp>&rsquo; option is given, <code>gprof</code> doesn&rsquo;t print the
  87. verbose blurbs that try to explain the meaning of all of the fields in
  88. the tables. This is useful if you intend to print out the output, or
  89. are tired of seeing the blurbs.
  90. </p>
  91. </dd>
  92. <dt><code>-C[<var>symspec</var>]</code></dt>
  93. <dt><code>--exec-counts[=<var>symspec</var>]</code></dt>
  94. <dd><p>The &lsquo;<samp>-C</samp>&rsquo; option causes <code>gprof</code> to
  95. print a tally of functions and the number of times each was called.
  96. If <var>symspec</var> is specified, print tally only for matching symbols.
  97. </p>
  98. <p>If the profile data file contains basic-block count records, specifying
  99. the &lsquo;<samp>-l</samp>&rsquo; option, along with &lsquo;<samp>-C</samp>&rsquo;, will cause basic-block
  100. execution counts to be tallied and displayed.
  101. </p>
  102. </dd>
  103. <dt><code>-i</code></dt>
  104. <dt><code>--file-info</code></dt>
  105. <dd><p>The &lsquo;<samp>-i</samp>&rsquo; option causes <code>gprof</code> to display summary information
  106. about the profile data file(s) and then exit. The number of histogram,
  107. call graph, and basic-block count records is displayed.
  108. </p>
  109. </dd>
  110. <dt><code>-I <var>dirs</var></code></dt>
  111. <dt><code>--directory-path=<var>dirs</var></code></dt>
  112. <dd><p>The &lsquo;<samp>-I</samp>&rsquo; option specifies a list of search directories in
  113. which to find source files. Environment variable <var>GPROF_PATH</var>
  114. can also be used to convey this information.
  115. Used mostly for annotated source output.
  116. </p>
  117. </dd>
  118. <dt><code>-J[<var>symspec</var>]</code></dt>
  119. <dt><code>--no-annotated-source[=<var>symspec</var>]</code></dt>
  120. <dd><p>The &lsquo;<samp>-J</samp>&rsquo; option causes <code>gprof</code> not to
  121. print annotated source code.
  122. If <var>symspec</var> is specified, <code>gprof</code> prints annotated source,
  123. but excludes matching symbols.
  124. </p>
  125. </dd>
  126. <dt><code>-L</code></dt>
  127. <dt><code>--print-path</code></dt>
  128. <dd><p>Normally, source filenames are printed with the path
  129. component suppressed. The &lsquo;<samp>-L</samp>&rsquo; option causes <code>gprof</code>
  130. to print the full pathname of
  131. source filenames, which is determined
  132. from symbolic debugging information in the image file
  133. and is relative to the directory in which the compiler
  134. was invoked.
  135. </p>
  136. </dd>
  137. <dt><code>-p[<var>symspec</var>]</code></dt>
  138. <dt><code>--flat-profile[=<var>symspec</var>]</code></dt>
  139. <dd><p>The &lsquo;<samp>-p</samp>&rsquo; option causes <code>gprof</code> to print a flat profile.
  140. If <var>symspec</var> is specified, print flat profile only for matching symbols.
  141. See <a href="Flat-Profile.html#Flat-Profile">The Flat Profile</a>.
  142. </p>
  143. </dd>
  144. <dt><code>-P[<var>symspec</var>]</code></dt>
  145. <dt><code>--no-flat-profile[=<var>symspec</var>]</code></dt>
  146. <dd><p>The &lsquo;<samp>-P</samp>&rsquo; option causes <code>gprof</code> to suppress printing a flat profile.
  147. If <var>symspec</var> is specified, <code>gprof</code> prints a flat profile,
  148. but excludes matching symbols.
  149. </p>
  150. </dd>
  151. <dt><code>-q[<var>symspec</var>]</code></dt>
  152. <dt><code>--graph[=<var>symspec</var>]</code></dt>
  153. <dd><p>The &lsquo;<samp>-q</samp>&rsquo; option causes <code>gprof</code> to print the call graph analysis.
  154. If <var>symspec</var> is specified, print call graph only for matching symbols
  155. and their children.
  156. See <a href="Call-Graph.html#Call-Graph">The Call Graph</a>.
  157. </p>
  158. </dd>
  159. <dt><code>-Q[<var>symspec</var>]</code></dt>
  160. <dt><code>--no-graph[=<var>symspec</var>]</code></dt>
  161. <dd><p>The &lsquo;<samp>-Q</samp>&rsquo; option causes <code>gprof</code> to suppress printing the
  162. call graph.
  163. If <var>symspec</var> is specified, <code>gprof</code> prints a call graph,
  164. but excludes matching symbols.
  165. </p>
  166. </dd>
  167. <dt><code>-t</code></dt>
  168. <dt><code>--table-length=<var>num</var></code></dt>
  169. <dd><p>The &lsquo;<samp>-t</samp>&rsquo; option causes the <var>num</var> most active source lines in
  170. each source file to be listed when source annotation is enabled. The
  171. default is 10.
  172. </p>
  173. </dd>
  174. <dt><code>-y</code></dt>
  175. <dt><code>--separate-files</code></dt>
  176. <dd><p>This option affects annotated source output only.
  177. Normally, <code>gprof</code> prints annotated source files
  178. to standard-output. If this option is specified,
  179. annotated source for a file named <samp>path/<var>filename</var></samp>
  180. is generated in the file <samp><var>filename</var>-ann</samp>. If the underlying
  181. file system would truncate <samp><var>filename</var>-ann</samp> so that it
  182. overwrites the original <samp><var>filename</var></samp>, <code>gprof</code> generates
  183. annotated source in the file <samp><var>filename</var>.ann</samp> instead (if the
  184. original file name has an extension, that extension is <em>replaced</em>
  185. with <samp>.ann</samp>).
  186. </p>
  187. </dd>
  188. <dt><code>-Z[<var>symspec</var>]</code></dt>
  189. <dt><code>--no-exec-counts[=<var>symspec</var>]</code></dt>
  190. <dd><p>The &lsquo;<samp>-Z</samp>&rsquo; option causes <code>gprof</code> not to
  191. print a tally of functions and the number of times each was called.
  192. If <var>symspec</var> is specified, print tally, but exclude matching symbols.
  193. </p>
  194. </dd>
  195. <dt><code>-r</code></dt>
  196. <dt><code>--function-ordering</code></dt>
  197. <dd><p>The &lsquo;<samp>--function-ordering</samp>&rsquo; option causes <code>gprof</code> to print a
  198. suggested function ordering for the program based on profiling data.
  199. This option suggests an ordering which may improve paging, tlb and
  200. cache behavior for the program on systems which support arbitrary
  201. ordering of functions in an executable.
  202. </p>
  203. <p>The exact details of how to force the linker to place functions
  204. in a particular order is system dependent and out of the scope of this
  205. manual.
  206. </p>
  207. </dd>
  208. <dt><code>-R <var>map_file</var></code></dt>
  209. <dt><code>--file-ordering <var>map_file</var></code></dt>
  210. <dd><p>The &lsquo;<samp>--file-ordering</samp>&rsquo; option causes <code>gprof</code> to print a
  211. suggested .o link line ordering for the program based on profiling data.
  212. This option suggests an ordering which may improve paging, tlb and
  213. cache behavior for the program on systems which do not support arbitrary
  214. ordering of functions in an executable.
  215. </p>
  216. <p>Use of the &lsquo;<samp>-a</samp>&rsquo; argument is highly recommended with this option.
  217. </p>
  218. <p>The <var>map_file</var> argument is a pathname to a file which provides
  219. function name to object file mappings. The format of the file is similar to
  220. the output of the program <code>nm</code>.
  221. </p>
  222. <div class="smallexample">
  223. <pre class="smallexample">c-parse.o:00000000 T yyparse
  224. c-parse.o:00000004 C yyerrflag
  225. c-lang.o:00000000 T maybe_objc_method_name
  226. c-lang.o:00000000 T print_lang_statistics
  227. c-lang.o:00000000 T recognize_objc_keyword
  228. c-decl.o:00000000 T print_lang_identifier
  229. c-decl.o:00000000 T print_lang_type
  230. &hellip;
  231. </pre></div>
  232. <p>To create a <var>map_file</var> with <small>GNU</small> <code>nm</code>, type a command like
  233. <kbd>nm --extern-only --defined-only -v --print-file-name program-name</kbd>.
  234. </p>
  235. </dd>
  236. <dt><code>-T</code></dt>
  237. <dt><code>--traditional</code></dt>
  238. <dd><p>The &lsquo;<samp>-T</samp>&rsquo; option causes <code>gprof</code> to print its output in
  239. &ldquo;traditional&rdquo; BSD style.
  240. </p>
  241. </dd>
  242. <dt><code>-w <var>width</var></code></dt>
  243. <dt><code>--width=<var>width</var></code></dt>
  244. <dd><p>Sets width of output lines to <var>width</var>.
  245. Currently only used when printing the function index at the bottom
  246. of the call graph.
  247. </p>
  248. </dd>
  249. <dt><code>-x</code></dt>
  250. <dt><code>--all-lines</code></dt>
  251. <dd><p>This option affects annotated source output only.
  252. By default, only the lines at the beginning of a basic-block
  253. are annotated. If this option is specified, every line in
  254. a basic-block is annotated by repeating the annotation for the
  255. first line. This behavior is similar to <code>tcov</code>&rsquo;s &lsquo;<samp>-a</samp>&rsquo;.
  256. </p>
  257. </dd>
  258. <dt><code>--demangle[=<var>style</var>]</code></dt>
  259. <dt><code>--no-demangle</code></dt>
  260. <dd><p>These options control whether C++ symbol names should be demangled when
  261. printing output. The default is to demangle symbols. The
  262. <code>--no-demangle</code> option may be used to turn off demangling. Different
  263. compilers have different mangling styles. The optional demangling style
  264. argument can be used to choose an appropriate demangling style for your
  265. compiler.
  266. </p></dd>
  267. </dl>
  268. <hr>
  269. <div class="header">
  270. <p>
  271. Next: <a href="Analysis-Options.html#Analysis-Options" accesskey="n" rel="next">Analysis Options</a>, Up: <a href="Invoking.html#Invoking" accesskey="u" rel="up">Invoking</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
  272. </div>
  273. </body>
  274. </html>