~ubuntu-branches/ubuntu/hoary/binutils/hoary

« back to all changes in this revision

Viewing changes to gprof/gprof.1

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-03-18 13:07:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050318130752-j4i37zgqclj53b94
Tags: 2.15-5ubuntu2
debian/rules: Call pkgstriptranslations if present (the package does not
use debhelper, thus it does not happen automatically).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
 
2
.\"
 
3
.\" Standard preamble:
 
4
.\" ========================================================================
 
5
.de Sh \" Subsection heading
 
6
.br
 
7
.if t .Sp
 
8
.ne 5
 
9
.PP
 
10
\fB\\$1\fR
 
11
.PP
 
12
..
 
13
.de Sp \" Vertical space (when we can't use .PP)
 
14
.if t .sp .5v
 
15
.if n .sp
 
16
..
 
17
.de Vb \" Begin verbatim text
 
18
.ft CW
 
19
.nf
 
20
.ne \\$1
 
21
..
 
22
.de Ve \" End verbatim text
 
23
.ft R
 
24
.fi
 
25
..
 
26
.\" Set up some character translations and predefined strings.  \*(-- will
 
27
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
 
28
.\" double quote, and \*(R" will give a right double quote.  | will give a
 
29
.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
 
30
.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
 
31
.\" expand to `' in nroff, nothing in troff, for use with C<>.
 
32
.tr \(*W-|\(bv\*(Tr
 
33
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
 
34
.ie n \{\
 
35
.    ds -- \(*W-
 
36
.    ds PI pi
 
37
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
 
38
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
 
39
.    ds L" ""
 
40
.    ds R" ""
 
41
.    ds C` ""
 
42
.    ds C' ""
 
43
'br\}
 
44
.el\{\
 
45
.    ds -- \|\(em\|
 
46
.    ds PI \(*p
 
47
.    ds L" ``
 
48
.    ds R" ''
 
49
'br\}
 
50
.\"
 
51
.\" If the F register is turned on, we'll generate index entries on stderr for
 
52
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
 
53
.\" entries marked with X<> in POD.  Of course, you'll have to process the
 
54
.\" output yourself in some meaningful fashion.
 
55
.if \nF \{\
 
56
.    de IX
 
57
.    tm Index:\\$1\t\\n%\t"\\$2"
 
58
..
 
59
.    nr % 0
 
60
.    rr F
 
61
.\}
 
62
.\"
 
63
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 
64
.\" way too many mistakes in technical documents.
 
65
.hy 0
 
66
.\"
 
67
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 
68
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
 
69
.    \" fudge factors for nroff and troff
 
70
.if n \{\
 
71
.    ds #H 0
 
72
.    ds #V .8m
 
73
.    ds #F .3m
 
74
.    ds #[ \f1
 
75
.    ds #] \fP
 
76
.\}
 
77
.if t \{\
 
78
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
 
79
.    ds #V .6m
 
80
.    ds #F 0
 
81
.    ds #[ \&
 
82
.    ds #] \&
 
83
.\}
 
84
.    \" simple accents for nroff and troff
 
85
.if n \{\
 
86
.    ds ' \&
 
87
.    ds ` \&
 
88
.    ds ^ \&
 
89
.    ds , \&
 
90
.    ds ~ ~
 
91
.    ds /
 
92
.\}
 
93
.if t \{\
 
94
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
 
95
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
 
96
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
 
97
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
 
98
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
 
99
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
 
100
.\}
 
101
.    \" troff and (daisy-wheel) nroff accents
 
102
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
 
103
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
 
104
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
 
105
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
 
106
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
 
107
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
 
108
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
 
109
.ds ae a\h'-(\w'a'u*4/10)'e
 
110
.ds Ae A\h'-(\w'A'u*4/10)'E
 
111
.    \" corrections for vroff
 
112
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
 
113
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
 
114
.    \" for low resolution devices (crt and lpr)
 
115
.if \n(.H>23 .if \n(.V>19 \
 
116
\{\
 
117
.    ds : e
 
118
.    ds 8 ss
 
119
.    ds o a
 
120
.    ds d- d\h'-1'\(ga
 
121
.    ds D- D\h'-1'\(hy
 
122
.    ds th \o'bp'
 
123
.    ds Th \o'LP'
 
124
.    ds ae ae
 
125
.    ds Ae AE
 
126
.\}
 
127
.rm #[ #] #H #V #F C
 
128
.\" ========================================================================
 
129
.\"
 
130
.IX Title "GPROF 1"
 
131
.TH GPROF 1 "2004-04-09" "binutils-2.14.91" "GNU"
 
132
.SH "NAME"
 
133
gprof \- display call graph profile data
 
134
.SH "SYNOPSIS"
 
135
.IX Header "SYNOPSIS"
 
136
gprof [ \-[abcDhilLsTvwxyz] ] [ \-[ACeEfFJnNOpPqQZ][\fIname\fR] ] 
 
137
 [ \-I \fIdirs\fR ] [ \-d[\fInum\fR] ] [ \-k \fIfrom/to\fR ]
 
138
 [ \-m \fImin-count\fR ] [ \-t \fItable-length\fR ]
 
139
 [ \-\-[no\-]annotated\-source[=\fIname\fR] ] 
 
140
 [ \-\-[no\-]exec\-counts[=\fIname\fR] ]
 
141
 [ \-\-[no\-]flat\-profile[=\fIname\fR] ] [ \-\-[no\-]graph[=\fIname\fR] ]
 
142
 [ \-\-[no\-]time=\fIname\fR] [ \-\-all\-lines ] [ \-\-brief ] 
 
143
 [ \-\-debug[=\fIlevel\fR] ] [ \-\-function\-ordering ] 
 
144
 [ \-\-file\-ordering ] [ \-\-directory\-path=\fIdirs\fR ]
 
145
 [ \-\-display\-unused\-functions ] [ \-\-file\-format=\fIname\fR ]
 
146
 [ \-\-file\-info ] [ \-\-help ] [ \-\-line ] [ \-\-min\-count=\fIn\fR ]
 
147
 [ \-\-no\-static ] [ \-\-print\-path ] [ \-\-separate\-files ]
 
148
 [ \-\-static\-call\-graph ] [ \-\-sum ] [ \-\-table\-length=\fIlen\fR ]
 
149
 [ \-\-traditional ] [ \-\-version ] [ \-\-width=\fIn\fR ]
 
150
 [ \-\-ignore\-non\-functions ] [ \-\-demangle[=\fI\s-1STYLE\s0\fR] ]
 
151
 [ \-\-no\-demangle ] [ \fIimage-file\fR ] [ \fIprofile-file\fR ... ]
 
152
.SH "DESCRIPTION"
 
153
.IX Header "DESCRIPTION"
 
154
\&\f(CW\*(C`gprof\*(C'\fR produces an execution profile of C, Pascal, or Fortran77 
 
155
programs.  The effect of called routines is incorporated in the profile 
 
156
of each caller.  The profile data is taken from the call graph profile file
 
157
(\fIgmon.out\fR default) which is created by programs
 
158
that are compiled with the \fB\-pg\fR option of
 
159
\&\f(CW\*(C`cc\*(C'\fR, \f(CW\*(C`pc\*(C'\fR, and \f(CW\*(C`f77\*(C'\fR.
 
160
The \fB\-pg\fR option also links in versions of the library routines
 
161
that are compiled for profiling.  \f(CW\*(C`Gprof\*(C'\fR reads the given object 
 
162
file (the default is \f(CW\*(C`a.out\*(C'\fR) and establishes the relation between
 
163
its symbol table and the call graph profile from \fIgmon.out\fR.
 
164
If more than one profile file is specified, the \f(CW\*(C`gprof\*(C'\fR
 
165
output shows the sum of the profile information in the given profile files.
 
166
.PP
 
167
\&\f(CW\*(C`Gprof\*(C'\fR calculates the amount of time spent in each routine.
 
168
Next, these times are propagated along the edges of the call graph.
 
169
Cycles are discovered, and calls into a cycle are made to share the time
 
170
of the cycle.
 
171
.PP
 
172
Several forms of output are available from the analysis.
 
173
.PP
 
174
The \fIflat profile\fR shows how much time your program spent in each function,
 
175
and how many times that function was called.  If you simply want to know
 
176
which functions burn most of the cycles, it is stated concisely here.
 
177
.PP
 
178
The \fIcall graph\fR shows, for each function, which functions called it, which
 
179
other functions it called, and how many times.  There is also an estimate
 
180
of how much time was spent in the subroutines of each function.  This can
 
181
suggest places where you might try to eliminate function calls that use a
 
182
lot of time.  
 
183
.PP
 
184
The \fIannotated source\fR listing is a copy of the program's
 
185
source code, labeled with the number of times each line of the
 
186
program was executed.  
 
187
.SH "OPTIONS"
 
188
.IX Header "OPTIONS"
 
189
These options specify which of several output formats
 
190
\&\f(CW\*(C`gprof\*(C'\fR should produce.
 
191
.PP
 
192
Many of these options take an optional \fIsymspec\fR to specify
 
193
functions to be included or excluded.  These options can be
 
194
specified multiple times, with different symspecs, to include
 
195
or exclude sets of symbols.  
 
196
.PP
 
197
Specifying any of these options overrides the default (\fB\-p \-q\fR),
 
198
which prints a flat profile and call graph analysis
 
199
for all functions.
 
200
.ie n .IP """\-A[\f(CIsymspec\f(CW]""" 4
 
201
.el .IP "\f(CW\-A[\f(CIsymspec\f(CW]\fR" 4
 
202
.IX Item "-A[symspec]"
 
203
.PD 0
 
204
.ie n .IP """\-\-annotated\-source[=\f(CIsymspec\f(CW]""" 4
 
205
.el .IP "\f(CW\-\-annotated\-source[=\f(CIsymspec\f(CW]\fR" 4
 
206
.IX Item "--annotated-source[=symspec]"
 
207
.PD
 
208
The \fB\-A\fR option causes \f(CW\*(C`gprof\*(C'\fR to print annotated source code.
 
209
If \fIsymspec\fR is specified, print output only for matching symbols.
 
210
.ie n .IP """\-b""" 4
 
211
.el .IP "\f(CW\-b\fR" 4
 
212
.IX Item "-b"
 
213
.PD 0
 
214
.ie n .IP """\-\-brief""" 4
 
215
.el .IP "\f(CW\-\-brief\fR" 4
 
216
.IX Item "--brief"
 
217
.PD
 
218
If the \fB\-b\fR option is given, \f(CW\*(C`gprof\*(C'\fR doesn't print the
 
219
verbose blurbs that try to explain the meaning of all of the fields in
 
220
the tables.  This is useful if you intend to print out the output, or
 
221
are tired of seeing the blurbs.
 
222
.ie n .IP """\-C[\f(CIsymspec\f(CW]""" 4
 
223
.el .IP "\f(CW\-C[\f(CIsymspec\f(CW]\fR" 4
 
224
.IX Item "-C[symspec]"
 
225
.PD 0
 
226
.ie n .IP """\-\-exec\-counts[=\f(CIsymspec\f(CW]""" 4
 
227
.el .IP "\f(CW\-\-exec\-counts[=\f(CIsymspec\f(CW]\fR" 4
 
228
.IX Item "--exec-counts[=symspec]"
 
229
.PD
 
230
The \fB\-C\fR option causes \f(CW\*(C`gprof\*(C'\fR to
 
231
print a tally of functions and the number of times each was called.
 
232
If \fIsymspec\fR is specified, print tally only for matching symbols.
 
233
.Sp
 
234
If the profile data file contains basic-block count records, specifying
 
235
the \fB\-l\fR option, along with \fB\-C\fR, will cause basic-block
 
236
execution counts to be tallied and displayed.
 
237
.ie n .IP """\-i""" 4
 
238
.el .IP "\f(CW\-i\fR" 4
 
239
.IX Item "-i"
 
240
.PD 0
 
241
.ie n .IP """\-\-file\-info""" 4
 
242
.el .IP "\f(CW\-\-file\-info\fR" 4
 
243
.IX Item "--file-info"
 
244
.PD
 
245
The \fB\-i\fR option causes \f(CW\*(C`gprof\*(C'\fR to display summary information
 
246
about the profile data file(s) and then exit.  The number of histogram,
 
247
call graph, and basic-block count records is displayed.
 
248
.ie n .IP """\-I \f(CIdirs\f(CW""" 4
 
249
.el .IP "\f(CW\-I \f(CIdirs\f(CW\fR" 4
 
250
.IX Item "-I dirs"
 
251
.PD 0
 
252
.ie n .IP """\-\-directory\-path=\f(CIdirs\f(CW""" 4
 
253
.el .IP "\f(CW\-\-directory\-path=\f(CIdirs\f(CW\fR" 4
 
254
.IX Item "--directory-path=dirs"
 
255
.PD
 
256
The \fB\-I\fR option specifies a list of search directories in
 
257
which to find source files.  Environment variable \fI\s-1GPROF_PATH\s0\fR
 
258
can also be used to convey this information.
 
259
Used mostly for annotated source output.
 
260
.ie n .IP """\-J[\f(CIsymspec\f(CW]""" 4
 
261
.el .IP "\f(CW\-J[\f(CIsymspec\f(CW]\fR" 4
 
262
.IX Item "-J[symspec]"
 
263
.PD 0
 
264
.ie n .IP """\-\-no\-annotated\-source[=\f(CIsymspec\f(CW]""" 4
 
265
.el .IP "\f(CW\-\-no\-annotated\-source[=\f(CIsymspec\f(CW]\fR" 4
 
266
.IX Item "--no-annotated-source[=symspec]"
 
267
.PD
 
268
The \fB\-J\fR option causes \f(CW\*(C`gprof\*(C'\fR not to
 
269
print annotated source code.
 
270
If \fIsymspec\fR is specified, \f(CW\*(C`gprof\*(C'\fR prints annotated source,
 
271
but excludes matching symbols.
 
272
.ie n .IP """\-L""" 4
 
273
.el .IP "\f(CW\-L\fR" 4
 
274
.IX Item "-L"
 
275
.PD 0
 
276
.ie n .IP """\-\-print\-path""" 4
 
277
.el .IP "\f(CW\-\-print\-path\fR" 4
 
278
.IX Item "--print-path"
 
279
.PD
 
280
Normally, source filenames are printed with the path
 
281
component suppressed.  The \fB\-L\fR option causes \f(CW\*(C`gprof\*(C'\fR
 
282
to print the full pathname of
 
283
source filenames, which is determined
 
284
from symbolic debugging information in the image file
 
285
and is relative to the directory in which the compiler
 
286
was invoked.
 
287
.ie n .IP """\-p[\f(CIsymspec\f(CW]""" 4
 
288
.el .IP "\f(CW\-p[\f(CIsymspec\f(CW]\fR" 4
 
289
.IX Item "-p[symspec]"
 
290
.PD 0
 
291
.ie n .IP """\-\-flat\-profile[=\f(CIsymspec\f(CW]""" 4
 
292
.el .IP "\f(CW\-\-flat\-profile[=\f(CIsymspec\f(CW]\fR" 4
 
293
.IX Item "--flat-profile[=symspec]"
 
294
.PD
 
295
The \fB\-p\fR option causes \f(CW\*(C`gprof\*(C'\fR to print a flat profile.
 
296
If \fIsymspec\fR is specified, print flat profile only for matching symbols.
 
297
.ie n .IP """\-P[\f(CIsymspec\f(CW]""" 4
 
298
.el .IP "\f(CW\-P[\f(CIsymspec\f(CW]\fR" 4
 
299
.IX Item "-P[symspec]"
 
300
.PD 0
 
301
.ie n .IP """\-\-no\-flat\-profile[=\f(CIsymspec\f(CW]""" 4
 
302
.el .IP "\f(CW\-\-no\-flat\-profile[=\f(CIsymspec\f(CW]\fR" 4
 
303
.IX Item "--no-flat-profile[=symspec]"
 
304
.PD
 
305
The \fB\-P\fR option causes \f(CW\*(C`gprof\*(C'\fR to suppress printing a flat profile.
 
306
If \fIsymspec\fR is specified, \f(CW\*(C`gprof\*(C'\fR prints a flat profile,
 
307
but excludes matching symbols.
 
308
.ie n .IP """\-q[\f(CIsymspec\f(CW]""" 4
 
309
.el .IP "\f(CW\-q[\f(CIsymspec\f(CW]\fR" 4
 
310
.IX Item "-q[symspec]"
 
311
.PD 0
 
312
.ie n .IP """\-\-graph[=\f(CIsymspec\f(CW]""" 4
 
313
.el .IP "\f(CW\-\-graph[=\f(CIsymspec\f(CW]\fR" 4
 
314
.IX Item "--graph[=symspec]"
 
315
.PD
 
316
The \fB\-q\fR option causes \f(CW\*(C`gprof\*(C'\fR to print the call graph analysis.
 
317
If \fIsymspec\fR is specified, print call graph only for matching symbols
 
318
and their children.
 
319
.ie n .IP """\-Q[\f(CIsymspec\f(CW]""" 4
 
320
.el .IP "\f(CW\-Q[\f(CIsymspec\f(CW]\fR" 4
 
321
.IX Item "-Q[symspec]"
 
322
.PD 0
 
323
.ie n .IP """\-\-no\-graph[=\f(CIsymspec\f(CW]""" 4
 
324
.el .IP "\f(CW\-\-no\-graph[=\f(CIsymspec\f(CW]\fR" 4
 
325
.IX Item "--no-graph[=symspec]"
 
326
.PD
 
327
The \fB\-Q\fR option causes \f(CW\*(C`gprof\*(C'\fR to suppress printing the
 
328
call graph.
 
329
If \fIsymspec\fR is specified, \f(CW\*(C`gprof\*(C'\fR prints a call graph,
 
330
but excludes matching symbols.
 
331
.ie n .IP """\-y""" 4
 
332
.el .IP "\f(CW\-y\fR" 4
 
333
.IX Item "-y"
 
334
.PD 0
 
335
.ie n .IP """\-\-separate\-files""" 4
 
336
.el .IP "\f(CW\-\-separate\-files\fR" 4
 
337
.IX Item "--separate-files"
 
338
.PD
 
339
This option affects annotated source output only.
 
340
Normally, \f(CW\*(C`gprof\*(C'\fR prints annotated source files
 
341
to standard\-output.  If this option is specified,
 
342
annotated source for a file named \fIpath/\fIfilename\fI\fR
 
343
is generated in the file \fI\fIfilename\fI\-ann\fR.  If the underlying
 
344
filesystem would truncate \fI\fIfilename\fI\-ann\fR so that it
 
345
overwrites the original \fI\fIfilename\fI\fR, \f(CW\*(C`gprof\*(C'\fR generates
 
346
annotated source in the file \fI\fIfilename\fI.ann\fR instead (if the
 
347
original file name has an extension, that extension is \fIreplaced\fR
 
348
with \fI.ann\fR).
 
349
.ie n .IP """\-Z[\f(CIsymspec\f(CW]""" 4
 
350
.el .IP "\f(CW\-Z[\f(CIsymspec\f(CW]\fR" 4
 
351
.IX Item "-Z[symspec]"
 
352
.PD 0
 
353
.ie n .IP """\-\-no\-exec\-counts[=\f(CIsymspec\f(CW]""" 4
 
354
.el .IP "\f(CW\-\-no\-exec\-counts[=\f(CIsymspec\f(CW]\fR" 4
 
355
.IX Item "--no-exec-counts[=symspec]"
 
356
.PD
 
357
The \fB\-Z\fR option causes \f(CW\*(C`gprof\*(C'\fR not to
 
358
print a tally of functions and the number of times each was called.
 
359
If \fIsymspec\fR is specified, print tally, but exclude matching symbols.
 
360
.ie n .IP """\-\-function\-ordering""" 4
 
361
.el .IP "\f(CW\-\-function\-ordering\fR" 4
 
362
.IX Item "--function-ordering"
 
363
The \fB\-\-function\-ordering\fR option causes \f(CW\*(C`gprof\*(C'\fR to print a
 
364
suggested function ordering for the program based on profiling data.
 
365
This option suggests an ordering which may improve paging, tlb and
 
366
cache behavior for the program on systems which support arbitrary
 
367
ordering of functions in an executable.
 
368
.Sp
 
369
The exact details of how to force the linker to place functions
 
370
in a particular order is system dependent and out of the scope of this
 
371
manual.
 
372
.ie n .IP """\-\-file\-ordering \f(CImap_file\f(CW""" 4
 
373
.el .IP "\f(CW\-\-file\-ordering \f(CImap_file\f(CW\fR" 4
 
374
.IX Item "--file-ordering map_file"
 
375
The \fB\-\-file\-ordering\fR option causes \f(CW\*(C`gprof\*(C'\fR to print a
 
376
suggested .o link line ordering for the program based on profiling data.
 
377
This option suggests an ordering which may improve paging, tlb and
 
378
cache behavior for the program on systems which do not support arbitrary
 
379
ordering of functions in an executable.
 
380
.Sp
 
381
Use of the \fB\-a\fR argument is highly recommended with this option.
 
382
.Sp
 
383
The \fImap_file\fR argument is a pathname to a file which provides
 
384
function name to object file mappings.  The format of the file is similar to
 
385
the output of the program \f(CW\*(C`nm\*(C'\fR.
 
386
.Sp
 
387
.Vb 8
 
388
\&        c-parse.o:00000000 T yyparse
 
389
\&        c-parse.o:00000004 C yyerrflag
 
390
\&        c-lang.o:00000000 T maybe_objc_method_name
 
391
\&        c-lang.o:00000000 T print_lang_statistics
 
392
\&        c-lang.o:00000000 T recognize_objc_keyword
 
393
\&        c-decl.o:00000000 T print_lang_identifier
 
394
\&        c-decl.o:00000000 T print_lang_type
 
395
\&        ...
 
396
.Ve
 
397
.Sp
 
398
To create a \fImap_file\fR with \s-1GNU\s0 \f(CW\*(C`nm\*(C'\fR, type a command like
 
399
\&\f(CW\*(C`nm \-\-extern\-only \-\-defined\-only \-v \-\-print\-file\-name program\-name\*(C'\fR.
 
400
.ie n .IP """\-T""" 4
 
401
.el .IP "\f(CW\-T\fR" 4
 
402
.IX Item "-T"
 
403
.PD 0
 
404
.ie n .IP """\-\-traditional""" 4
 
405
.el .IP "\f(CW\-\-traditional\fR" 4
 
406
.IX Item "--traditional"
 
407
.PD
 
408
The \fB\-T\fR option causes \f(CW\*(C`gprof\*(C'\fR to print its output in
 
409
``traditional'' \s-1BSD\s0 style.
 
410
.ie n .IP """\-w \f(CIwidth\f(CW""" 4
 
411
.el .IP "\f(CW\-w \f(CIwidth\f(CW\fR" 4
 
412
.IX Item "-w width"
 
413
.PD 0
 
414
.ie n .IP """\-\-width=\f(CIwidth\f(CW""" 4
 
415
.el .IP "\f(CW\-\-width=\f(CIwidth\f(CW\fR" 4
 
416
.IX Item "--width=width"
 
417
.PD
 
418
Sets width of output lines to \fIwidth\fR.
 
419
Currently only used when printing the function index at the bottom
 
420
of the call graph.
 
421
.ie n .IP """\-x""" 4
 
422
.el .IP "\f(CW\-x\fR" 4
 
423
.IX Item "-x"
 
424
.PD 0
 
425
.ie n .IP """\-\-all\-lines""" 4
 
426
.el .IP "\f(CW\-\-all\-lines\fR" 4
 
427
.IX Item "--all-lines"
 
428
.PD
 
429
This option affects annotated source output only.
 
430
By default, only the lines at the beginning of a basic-block
 
431
are annotated.  If this option is specified, every line in
 
432
a basic-block is annotated by repeating the annotation for the
 
433
first line.  This behavior is similar to \f(CW\*(C`tcov\*(C'\fR's \fB\-a\fR.
 
434
.ie n .IP """\-\-demangle[=\f(CIstyle\f(CW]""" 4
 
435
.el .IP "\f(CW\-\-demangle[=\f(CIstyle\f(CW]\fR" 4
 
436
.IX Item "--demangle[=style]"
 
437
.PD 0
 
438
.ie n .IP """\-\-no\-demangle""" 4
 
439
.el .IP "\f(CW\-\-no\-demangle\fR" 4
 
440
.IX Item "--no-demangle"
 
441
.PD
 
442
These options control whether \*(C+ symbol names should be demangled when
 
443
printing output.  The default is to demangle symbols.  The
 
444
\&\f(CW\*(C`\-\-no\-demangle\*(C'\fR option may be used to turn off demangling. Different 
 
445
compilers have different mangling styles.  The optional demangling style 
 
446
argument can be used to choose an appropriate demangling style for your 
 
447
compiler.
 
448
.Sh "Analysis Options"
 
449
.IX Subsection "Analysis Options"
 
450
.ie n .IP """\-a""" 4
 
451
.el .IP "\f(CW\-a\fR" 4
 
452
.IX Item "-a"
 
453
.PD 0
 
454
.ie n .IP """\-\-no\-static""" 4
 
455
.el .IP "\f(CW\-\-no\-static\fR" 4
 
456
.IX Item "--no-static"
 
457
.PD
 
458
The \fB\-a\fR option causes \f(CW\*(C`gprof\*(C'\fR to suppress the printing of
 
459
statically declared (private) functions.  (These are functions whose
 
460
names are not listed as global, and which are not visible outside the
 
461
file/function/block where they were defined.)  Time spent in these
 
462
functions, calls to/from them, etc, will all be attributed to the
 
463
function that was loaded directly before it in the executable file.
 
464
This option affects both the flat profile and the call graph.
 
465
.ie n .IP """\-c""" 4
 
466
.el .IP "\f(CW\-c\fR" 4
 
467
.IX Item "-c"
 
468
.PD 0
 
469
.ie n .IP """\-\-static\-call\-graph""" 4
 
470
.el .IP "\f(CW\-\-static\-call\-graph\fR" 4
 
471
.IX Item "--static-call-graph"
 
472
.PD
 
473
The \fB\-c\fR option causes the call graph of the program to be
 
474
augmented by a heuristic which examines the text space of the object
 
475
file and identifies function calls in the binary machine code.
 
476
Since normal call graph records are only generated when functions are
 
477
entered, this option identifies children that could have been called,
 
478
but never were.  Calls to functions that were not compiled with
 
479
profiling enabled are also identified, but only if symbol table
 
480
entries are present for them.
 
481
Calls to dynamic library routines are typically \fInot\fR found
 
482
by this option.
 
483
Parents or children identified via this heuristic
 
484
are indicated in the call graph with call counts of \fB0\fR.
 
485
.ie n .IP """\-D""" 4
 
486
.el .IP "\f(CW\-D\fR" 4
 
487
.IX Item "-D"
 
488
.PD 0
 
489
.ie n .IP """\-\-ignore\-non\-functions""" 4
 
490
.el .IP "\f(CW\-\-ignore\-non\-functions\fR" 4
 
491
.IX Item "--ignore-non-functions"
 
492
.PD
 
493
The \fB\-D\fR option causes \f(CW\*(C`gprof\*(C'\fR to ignore symbols which
 
494
are not known to be functions.  This option will give more accurate
 
495
profile data on systems where it is supported (Solaris and \s-1HPUX\s0 for
 
496
example).
 
497
.ie n .IP """\-k \f(CIfrom\f(CW/\f(CIto\f(CW""" 4
 
498
.el .IP "\f(CW\-k \f(CIfrom\f(CW/\f(CIto\f(CW\fR" 4
 
499
.IX Item "-k from/to"
 
500
The \fB\-k\fR option allows you to delete from the call graph any arcs from
 
501
symbols matching symspec \fIfrom\fR to those matching symspec \fIto\fR.
 
502
.ie n .IP """\-l""" 4
 
503
.el .IP "\f(CW\-l\fR" 4
 
504
.IX Item "-l"
 
505
.PD 0
 
506
.ie n .IP """\-\-line""" 4
 
507
.el .IP "\f(CW\-\-line\fR" 4
 
508
.IX Item "--line"
 
509
.PD
 
510
The \fB\-l\fR option enables line-by-line profiling, which causes
 
511
histogram hits to be charged to individual source code lines,
 
512
instead of functions.
 
513
If the program was compiled with basic-block counting enabled,
 
514
this option will also identify how many times each line of
 
515
code was executed.
 
516
While line-by-line profiling can help isolate where in a large function
 
517
a program is spending its time, it also significantly increases
 
518
the running time of \f(CW\*(C`gprof\*(C'\fR, and magnifies statistical
 
519
inaccuracies.
 
520
.ie n .IP """\-m \f(CInum\f(CW""" 4
 
521
.el .IP "\f(CW\-m \f(CInum\f(CW\fR" 4
 
522
.IX Item "-m num"
 
523
.PD 0
 
524
.ie n .IP """\-\-min\-count=\f(CInum\f(CW""" 4
 
525
.el .IP "\f(CW\-\-min\-count=\f(CInum\f(CW\fR" 4
 
526
.IX Item "--min-count=num"
 
527
.PD
 
528
This option affects execution count output only.
 
529
Symbols that are executed less than \fInum\fR times are suppressed.
 
530
.ie n .IP """\-n[\f(CIsymspec\f(CW]""" 4
 
531
.el .IP "\f(CW\-n[\f(CIsymspec\f(CW]\fR" 4
 
532
.IX Item "-n[symspec]"
 
533
.PD 0
 
534
.ie n .IP """\-\-time[=\f(CIsymspec\f(CW]""" 4
 
535
.el .IP "\f(CW\-\-time[=\f(CIsymspec\f(CW]\fR" 4
 
536
.IX Item "--time[=symspec]"
 
537
.PD
 
538
The \fB\-n\fR option causes \f(CW\*(C`gprof\*(C'\fR, in its call graph analysis,
 
539
to only propagate times for symbols matching \fIsymspec\fR.
 
540
.ie n .IP """\-N[\f(CIsymspec\f(CW]""" 4
 
541
.el .IP "\f(CW\-N[\f(CIsymspec\f(CW]\fR" 4
 
542
.IX Item "-N[symspec]"
 
543
.PD 0
 
544
.ie n .IP """\-\-no\-time[=\f(CIsymspec\f(CW]""" 4
 
545
.el .IP "\f(CW\-\-no\-time[=\f(CIsymspec\f(CW]\fR" 4
 
546
.IX Item "--no-time[=symspec]"
 
547
.PD
 
548
The \fB\-n\fR option causes \f(CW\*(C`gprof\*(C'\fR, in its call graph analysis,
 
549
not to propagate times for symbols matching \fIsymspec\fR.
 
550
.ie n .IP """\-z""" 4
 
551
.el .IP "\f(CW\-z\fR" 4
 
552
.IX Item "-z"
 
553
.PD 0
 
554
.ie n .IP """\-\-display\-unused\-functions""" 4
 
555
.el .IP "\f(CW\-\-display\-unused\-functions\fR" 4
 
556
.IX Item "--display-unused-functions"
 
557
.PD
 
558
If you give the \fB\-z\fR option, \f(CW\*(C`gprof\*(C'\fR will mention all
 
559
functions in the flat profile, even those that were never called, and
 
560
that had no time spent in them.  This is useful in conjunction with the
 
561
\&\fB\-c\fR option for discovering which routines were never called.
 
562
.Sh "Miscellaneous Options"
 
563
.IX Subsection "Miscellaneous Options"
 
564
.ie n .IP """\-d[\f(CInum\f(CW]""" 4
 
565
.el .IP "\f(CW\-d[\f(CInum\f(CW]\fR" 4
 
566
.IX Item "-d[num]"
 
567
.PD 0
 
568
.ie n .IP """\-\-debug[=\f(CInum\f(CW]""" 4
 
569
.el .IP "\f(CW\-\-debug[=\f(CInum\f(CW]\fR" 4
 
570
.IX Item "--debug[=num]"
 
571
.PD
 
572
The \fB\-d\fR \fInum\fR option specifies debugging options.
 
573
If \fInum\fR is not specified, enable all debugging.
 
574
.ie n .IP """\-O\f(CIname\f(CW""" 4
 
575
.el .IP "\f(CW\-O\f(CIname\f(CW\fR" 4
 
576
.IX Item "-Oname"
 
577
.PD 0
 
578
.ie n .IP """\-\-file\-format=\f(CIname\f(CW""" 4
 
579
.el .IP "\f(CW\-\-file\-format=\f(CIname\f(CW\fR" 4
 
580
.IX Item "--file-format=name"
 
581
.PD
 
582
Selects the format of the profile data files.  Recognized formats are
 
583
\&\fBauto\fR (the default), \fBbsd\fR, \fB4.4bsd\fR, \fBmagic\fR, and
 
584
\&\fBprof\fR (not yet supported).
 
585
.ie n .IP """\-s""" 4
 
586
.el .IP "\f(CW\-s\fR" 4
 
587
.IX Item "-s"
 
588
.PD 0
 
589
.ie n .IP """\-\-sum""" 4
 
590
.el .IP "\f(CW\-\-sum\fR" 4
 
591
.IX Item "--sum"
 
592
.PD
 
593
The \fB\-s\fR option causes \f(CW\*(C`gprof\*(C'\fR to summarize the information
 
594
in the profile data files it read in, and write out a profile data
 
595
file called \fIgmon.sum\fR, which contains all the information from
 
596
the profile data files that \f(CW\*(C`gprof\*(C'\fR read in.  The file \fIgmon.sum\fR
 
597
may be one of the specified input files; the effect of this is to
 
598
merge the data in the other input files into \fIgmon.sum\fR.
 
599
.Sp
 
600
Eventually you can run \f(CW\*(C`gprof\*(C'\fR again without \fB\-s\fR to analyze the
 
601
cumulative data in the file \fIgmon.sum\fR.
 
602
.ie n .IP """\-v""" 4
 
603
.el .IP "\f(CW\-v\fR" 4
 
604
.IX Item "-v"
 
605
.PD 0
 
606
.ie n .IP """\-\-version""" 4
 
607
.el .IP "\f(CW\-\-version\fR" 4
 
608
.IX Item "--version"
 
609
.PD
 
610
The \fB\-v\fR flag causes \f(CW\*(C`gprof\*(C'\fR to print the current version
 
611
number, and then exit.
 
612
.Sh "Deprecated Options"
 
613
.IX Subsection "Deprecated Options"
 
614
.RS 4
 
615
These options have been replaced with newer versions that use symspecs.
 
616
.RE
 
617
.ie n .IP """\-e \f(CIfunction_name\f(CW""" 4
 
618
.el .IP "\f(CW\-e \f(CIfunction_name\f(CW\fR" 4
 
619
.IX Item "-e function_name"
 
620
The \fB\-e\fR \fIfunction\fR option tells \f(CW\*(C`gprof\*(C'\fR to not print
 
621
information about the function \fIfunction_name\fR (and its
 
622
children...) in the call graph.  The function will still be listed
 
623
as a child of any functions that call it, but its index number will be
 
624
shown as \fB[not printed]\fR.  More than one \fB\-e\fR option may be
 
625
given; only one \fIfunction_name\fR may be indicated with each \fB\-e\fR
 
626
option. 
 
627
.ie n .IP """\-E \f(CIfunction_name\f(CW""" 4
 
628
.el .IP "\f(CW\-E \f(CIfunction_name\f(CW\fR" 4
 
629
.IX Item "-E function_name"
 
630
The \f(CW\*(C`\-E \f(CIfunction\f(CW\*(C'\fR option works like the \f(CW\*(C`\-e\*(C'\fR option, but
 
631
time spent in the function (and children who were not called from
 
632
anywhere else), will not be used to compute the percentages-of-time for
 
633
the call graph.  More than one \fB\-E\fR option may be given; only one
 
634
\&\fIfunction_name\fR may be indicated with each \fB\-E\fR option.
 
635
.ie n .IP """\-f \f(CIfunction_name\f(CW""" 4
 
636
.el .IP "\f(CW\-f \f(CIfunction_name\f(CW\fR" 4
 
637
.IX Item "-f function_name"
 
638
The \fB\-f\fR \fIfunction\fR option causes \f(CW\*(C`gprof\*(C'\fR to limit the
 
639
call graph to the function \fIfunction_name\fR and its children (and
 
640
their children...).  More than one \fB\-f\fR option may be given;
 
641
only one \fIfunction_name\fR may be indicated with each \fB\-f\fR
 
642
option.  
 
643
.ie n .IP """\-F \f(CIfunction_name\f(CW""" 4
 
644
.el .IP "\f(CW\-F \f(CIfunction_name\f(CW\fR" 4
 
645
.IX Item "-F function_name"
 
646
The \fB\-F\fR \fIfunction\fR option works like the \f(CW\*(C`\-f\*(C'\fR option, but
 
647
only time spent in the function and its children (and their
 
648
children...) will be used to determine total-time and
 
649
percentages-of-time for the call graph.  More than one \fB\-F\fR option
 
650
may be given; only one \fIfunction_name\fR may be indicated with each
 
651
\&\fB\-F\fR option.  The \fB\-F\fR option overrides the \fB\-E\fR option.
 
652
.SH "FILES"
 
653
.IX Header "FILES"
 
654
.ie n .IP """\f(CIa.out\f(CW""" 4
 
655
.el .IP "\f(CW\f(CIa.out\f(CW\fR" 4
 
656
.IX Item "a.out"
 
657
the namelist and text space.
 
658
.ie n .IP """\f(CIgmon.out\f(CW""" 4
 
659
.el .IP "\f(CW\f(CIgmon.out\f(CW\fR" 4
 
660
.IX Item "gmon.out"
 
661
dynamic call graph and profile.
 
662
.ie n .IP """\f(CIgmon.sum\f(CW""" 4
 
663
.el .IP "\f(CW\f(CIgmon.sum\f(CW\fR" 4
 
664
.IX Item "gmon.sum"
 
665
summarized dynamic call graph and profile.  
 
666
.SH "BUGS"
 
667
.IX Header "BUGS"
 
668
The granularity of the sampling is shown, but remains
 
669
statistical at best.
 
670
We assume that the time for each execution of a function
 
671
can be expressed by the total time for the function divided
 
672
by the number of times the function is called.
 
673
Thus the time propagated along the call graph arcs to the function's
 
674
parents is directly proportional to the number of times that
 
675
arc is traversed.
 
676
.PP
 
677
Parents that are not themselves profiled will have the time of
 
678
their profiled children propagated to them, but they will appear
 
679
to be spontaneously invoked in the call graph listing, and will
 
680
not have their time propagated further.
 
681
Similarly, signal catchers, even though profiled, will appear
 
682
to be spontaneous (although for more obscure reasons).
 
683
Any profiled children of signal catchers should have their times
 
684
propagated properly, unless the signal catcher was invoked during
 
685
the execution of the profiling routine, in which case all is lost.
 
686
.PP
 
687
The profiled program must call \f(CW\*(C`exit\*(C'\fR(2)
 
688
or return normally for the profiling information to be saved
 
689
in the \fIgmon.out\fR file.
 
690
.SH "SEE ALSO"
 
691
.IX Header "SEE ALSO"
 
692
\&\fImonitor\fR\|(3), \fIprofil\fR\|(2), \fIcc\fR\|(1), \fIprof\fR\|(1), and the Info entry for \fIgprof\fR.
 
693
.PP
 
694
``An Execution Profiler for Modular Programs'',
 
695
by S. Graham, P. Kessler, M. McKusick;
 
696
Software \- Practice and Experience,
 
697
Vol. 13, pp. 671\-685, 1983.
 
698
.PP
 
699
``gprof: A Call Graph Execution Profiler'',
 
700
by S. Graham, P. Kessler, M. McKusick;
 
701
Proceedings of the \s-1SIGPLAN\s0 '82 Symposium on Compiler Construction,
 
702
\&\s-1SIGPLAN\s0 Notices, Vol. 17, No  6, pp. 120\-126, June 1982.
 
703
.SH "COPYRIGHT"
 
704
.IX Header "COPYRIGHT"
 
705
Copyright (C) 1988, 92, 97, 98, 99, 2000, 2001, 2003 Free Software Foundation, Inc.
 
706
.PP
 
707
Permission is granted to copy, distribute and/or modify this document
 
708
under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1
 
709
or any later version published by the Free Software Foundation;
 
710
with no Invariant Sections, with no Front-Cover Texts, and with no
 
711
Back-Cover Texts.  A copy of the license is included in the
 
712
section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".