You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Output-Options.html 12KB

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