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