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