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