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