xref: /dflybsd-src/contrib/binutils-2.27/gprof/README (revision e656dc90e3d65d744d534af2f5ea88cf8101ebcf)
1*a9fa9459Szrj		README for GPROF
2*a9fa9459Szrj
3*a9fa9459SzrjThis is the GNU profiler.  It is distributed with other "binary
4*a9fa9459Szrjutilities" which should be in ../binutils.  See ../binutils/README for
5*a9fa9459Szrjmore general notes, including where to send bug reports.
6*a9fa9459Szrj
7*a9fa9459SzrjThis file documents the changes and new features available with this
8*a9fa9459Szrjversion of GNU gprof.
9*a9fa9459Szrj
10*a9fa9459Szrj* New Features
11*a9fa9459Szrj
12*a9fa9459Szrj o Long options
13*a9fa9459Szrj
14*a9fa9459Szrj o Supports generalized file format, without breaking backward compatibility:
15*a9fa9459Szrj   new file format supports basic-block execution counts and non-realtime
16*a9fa9459Szrj   histograms (see below)
17*a9fa9459Szrj
18*a9fa9459Szrj o Supports profiling at the line level: flat profiles, call-graph profiles,
19*a9fa9459Szrj   and execution-counts can all be displayed at a level that identifies
20*a9fa9459Szrj   individual lines rather than just functions
21*a9fa9459Szrj
22*a9fa9459Szrj o Test-coverage support (similar to Sun tcov program): source files
23*a9fa9459Szrj   can be annotated with the number of times a function was invoked
24*a9fa9459Szrj   or with the number of times each basic-block in a function was
25*a9fa9459Szrj   executed
26*a9fa9459Szrj
27*a9fa9459Szrj o Generalized histograms: not just execution-time, but arbitrary
28*a9fa9459Szrj   histograms are support (for example, performance counter based
29*a9fa9459Szrj   profiles)
30*a9fa9459Szrj
31*a9fa9459Szrj o Powerful mechanism to select data to be included/excluded from
32*a9fa9459Szrj   analysis and/or output
33*a9fa9459Szrj
34*a9fa9459Szrj o Support for DEC OSF/1 v3.0
35*a9fa9459Szrj
36*a9fa9459Szrj o Full cross-platform profiling support: gprof uses BFD to support
37*a9fa9459Szrj   arbitrary, non-native object file formats and non-native byte-orders
38*a9fa9459Szrj   (this feature has not been tested yet)
39*a9fa9459Szrj
40*a9fa9459Szrj o In the call-graph function index, static function names are now
41*a9fa9459Szrj   printed together with the filename in which the function was defined
42*a9fa9459Szrj   (required bfd_find_nearest_line() support and symbolic debugging
43*a9fa9459Szrj    information to be present in the executable file)
44*a9fa9459Szrj
45*a9fa9459Szrj o Major overhaul of source code (compiles cleanly with -Wall, etc.)
46*a9fa9459Szrj
47*a9fa9459Szrj* Supported Platforms
48*a9fa9459Szrj
49*a9fa9459SzrjThe current version is known to work on:
50*a9fa9459Szrj
51*a9fa9459Szrj o DEC OSF/1 v3.0
52*a9fa9459Szrj	All features supported.
53*a9fa9459Szrj
54*a9fa9459Szrj o SunOS 4.1.x
55*a9fa9459Szrj	All features supported.
56*a9fa9459Szrj
57*a9fa9459Szrj o Solaris 2.3
58*a9fa9459Szrj	Line-level profiling unsupported because bfd_find_nearest_line()
59*a9fa9459Szrj	is not fully implemented for Elf binaries.
60*a9fa9459Szrj
61*a9fa9459Szrj o HP-UX 9.01
62*a9fa9459Szrj	Line-level profiling unsupported because bfd_find_nearest_line()
63*a9fa9459Szrj	is not fully implemented for SOM binaries.
64*a9fa9459Szrj
65*a9fa9459Szrj* Detailed Description
66*a9fa9459Szrj
67*a9fa9459Szrj** User Interface Changes
68*a9fa9459Szrj
69*a9fa9459SzrjThe command-line interface is backwards compatible with earlier
70*a9fa9459Szrjversions of GNU gprof and Berkeley gprof.  The only exception is
71*a9fa9459Szrjthe option to delete arcs from the call graph.  The old syntax
72*a9fa9459Szrjwas:
73*a9fa9459Szrj
74*a9fa9459Szrj	-k fromname toname
75*a9fa9459Szrj
76*a9fa9459Szrjwhile the new syntax is:
77*a9fa9459Szrj
78*a9fa9459Szrj	-k fromname/toname
79*a9fa9459Szrj
80*a9fa9459SzrjThis change was necessary to be compatible with long-option parsing.
81*a9fa9459SzrjAlso, "fromname" and "toname" can now be arbitrary symspecs rather
82*a9fa9459Szrjthan just function names (see below for an explanation of symspecs).
83*a9fa9459SzrjFor example, option "-k gprof.c/" suppresses all arcs due to calls out
84*a9fa9459Szrjof file "gprof.c".
85*a9fa9459Szrj
86*a9fa9459Szrj*** Sym Specs
87*a9fa9459Szrj
88*a9fa9459SzrjIt is often necessary to apply gprof only to specific parts of a
89*a9fa9459Szrjprogram.  GNU gprof has a simple but powerful mechanism to achieve
90*a9fa9459Szrjthis.  So called {\em symspecs\/} provide the foundation for this
91*a9fa9459Szrjmechanism.  A symspec selects the parts of a profiled program to which
92*a9fa9459Szrjan operation should be applied to.  The syntax of a symspec is
93*a9fa9459Szrjsimple:
94*a9fa9459Szrj
95*a9fa9459Szrj	  filename_containing_a_dot
96*a9fa9459Szrj	| funcname_not_containing_a_dot
97*a9fa9459Szrj	| linenumber
98*a9fa9459Szrj	| ( [ any_filename ] `:' ( any_funcname | linenumber ) )
99*a9fa9459Szrj
100*a9fa9459SzrjHere are some examples:
101*a9fa9459Szrj
102*a9fa9459Szrj	main.c			Selects everything in file "main.c"---the
103*a9fa9459Szrj				dot in the string tells gprof to interpret
104*a9fa9459Szrj				the string as a filename, rather than as
105*a9fa9459Szrj				a function name.  To select a file whose
106*a9fa9459Szrj				name does contain a dot, a trailing colon
107*a9fa9459Szrj				should be specified.  For example, "odd:" is
108*a9fa9459Szrj				interpreted as the file named "odd".
109*a9fa9459Szrj
110*a9fa9459Szrj	main			Selects all functions named "main".  Notice
111*a9fa9459Szrj				that there may be multiple instances of the
112*a9fa9459Szrj				same function name because some of the
113*a9fa9459Szrj				definitions may be local (i.e., static).
114*a9fa9459Szrj				Unless a function name is unique in a program,
115*a9fa9459Szrj				you must use the colon notation explained
116*a9fa9459Szrj				below to specify a function from a specific
117*a9fa9459Szrj				source file.  Sometimes, functionnames contain
118*a9fa9459Szrj				dots.  In such cases, it is necessary to
119*a9fa9459Szrj				add a leading colon to the name.  For example,
120*a9fa9459Szrj				":.mul" selects function ".mul".
121*a9fa9459Szrj
122*a9fa9459Szrj	main.c:main		Selects function "main" in file "main.c".
123*a9fa9459Szrj
124*a9fa9459Szrj	main.c:134		Selects line 134 in file "main.c".
125*a9fa9459Szrj
126*a9fa9459SzrjIMPLEMENTATION NOTE: The source code uses the type sym_id for symspecs.
127*a9fa9459SzrjAt some point, this probably ought to be changed to "sym_spec" to make
128*a9fa9459Szrjreading the code easier.
129*a9fa9459Szrj
130*a9fa9459Szrj*** Long options
131*a9fa9459Szrj
132*a9fa9459SzrjGNU gprof now supports long options.  The following is a list of all
133*a9fa9459Szrjsupported options.  Options that are listed without description
134*a9fa9459Szrjoperate in the same manner as the corresponding option in older
135*a9fa9459Szrjversions of gprof.
136*a9fa9459Szrj
137*a9fa9459SzrjShort Form:	Long Form:
138*a9fa9459Szrj-----------	----------
139*a9fa9459Szrj-l		--line
140*a9fa9459Szrj			Request profiling at the line-level rather
141*a9fa9459Szrj			than just at the function level.  Source
142*a9fa9459Szrj			lines are identified by symbols of the form:
143*a9fa9459Szrj
144*a9fa9459Szrj				func (file:line)
145*a9fa9459Szrj
146*a9fa9459Szrj			where "func" is the function name, "file" is the
147*a9fa9459Szrj			file name and "line" is the line-number that
148*a9fa9459Szrj			corresponds to the line.
149*a9fa9459Szrj
150*a9fa9459Szrj			To work properly, the binary must contain symbolic
151*a9fa9459Szrj			debugging information.  This means that the source
152*a9fa9459Szrj			have to be translated with option "-g" specified.
153*a9fa9459Szrj			Functions for which there is no symbolic debugging
154*a9fa9459Szrj			information available are treated as if "--line"
155*a9fa9459Szrj			had not been specified.  However, the line number
156*a9fa9459Szrj			printed with such symbols is usually incorrect
157*a9fa9459Szrj			and should be ignored.
158*a9fa9459Szrj
159*a9fa9459Szrj-a		--no-static
160*a9fa9459Szrj-A[symspec]	--annotated-source[=symspec]
161*a9fa9459Szrj			Request output in the form of annotated source
162*a9fa9459Szrj			files.  If "symspec" is specified, print output only
163*a9fa9459Szrj			for symbols selected by "symspec".  If the option
164*a9fa9459Szrj			is specified multiple times, annotated output is
165*a9fa9459Szrj			generated for the union of all symspecs.
166*a9fa9459Szrj
167*a9fa9459Szrj			Examples:
168*a9fa9459Szrj
169*a9fa9459Szrj			  -A		Prints annotated source for all
170*a9fa9459Szrj					source files.
171*a9fa9459Szrj			  -Agprof.c	Prints annotated source for file
172*a9fa9459Szrj					gprof.c.
173*a9fa9459Szrj			  -Afoobar	Prints annotated source for files
174*a9fa9459Szrj					containing a function named "foobar".
175*a9fa9459Szrj					The entire file will be printed, but
176*a9fa9459Szrj					only the function itself will be
177*a9fa9459Szrj					annotated with profile data.
178*a9fa9459Szrj
179*a9fa9459Szrj-J[symspec]	--no-annotated-source[=symspec]
180*a9fa9459Szrj			Suppress annotated source output.  If specified
181*a9fa9459Szrj			without argument, annotated output is suppressed
182*a9fa9459Szrj			completely.  With an argument, annotated output
183*a9fa9459Szrj			is suppressed only for the symbols selected by
184*a9fa9459Szrj			"symspec".  If the option is specified multiple
185*a9fa9459Szrj			times, annotated output is suppressed for the
186*a9fa9459Szrj			union of all symspecs.  This option has lower
187*a9fa9459Szrj			precedence than --annotated-source
188*a9fa9459Szrj
189*a9fa9459Szrj-p[symspec]	--flat-profile[=symspec]
190*a9fa9459Szrj			Request output in the form of a flat profile
191*a9fa9459Szrj			(unless any other output-style option is specified,
192*a9fa9459Szrj			 this option is turned on by default).  If
193*a9fa9459Szrj			"symspec" is specified, include only symbols
194*a9fa9459Szrj			selected by "symspec" in flat profile.  If the
195*a9fa9459Szrj			option is specified multiple times, the flat
196*a9fa9459Szrj			profile includes symbols selected by the union
197*a9fa9459Szrj			of all symspecs.
198*a9fa9459Szrj
199*a9fa9459Szrj-P[symspec]	--no-flat-profile[=symspec]
200*a9fa9459Szrj			Suppress output in the flat profile.  If given
201*a9fa9459Szrj			without an argument, the flat profile is suppressed
202*a9fa9459Szrj			completely.  If "symspec" is specified, suppress
203*a9fa9459Szrj			the selected symbols in the flat profile.  If the
204*a9fa9459Szrj			option is specified multiple times, the union of
205*a9fa9459Szrj			the selected symbols is suppressed.  This option
206*a9fa9459Szrj			has lower precedence than --flat-profile.
207*a9fa9459Szrj
208*a9fa9459Szrj-q[symspec]	--graph[=symspec]
209*a9fa9459Szrj			Request output in the form of a call-graph
210*a9fa9459Szrj			(unless any other output-style option is specified,
211*a9fa9459Szrj			 this option is turned on by default).  If "symspec"
212*a9fa9459Szrj			is specified, include only symbols selected by
213*a9fa9459Szrj			"symspec" in the call-graph.  If the option is
214*a9fa9459Szrj			specified multiple times, the call-graph includes
215*a9fa9459Szrj			symbols selected by the union of all symspecs.
216*a9fa9459Szrj
217*a9fa9459Szrj-Q[symspec]	--no-graph[=symspec]
218*a9fa9459Szrj			Suppress output in the call-graph.  If given without
219*a9fa9459Szrj			an argument, the call-graph is suppressed completely.
220*a9fa9459Szrj			With a "symspec", suppress the selected symbols
221*a9fa9459Szrj			from the call-graph.  If the option is specified
222*a9fa9459Szrj			multiple times, the union of the selected symbols
223*a9fa9459Szrj			is suppressed.  This option has lower precedence
224*a9fa9459Szrj			than --graph.
225*a9fa9459Szrj
226*a9fa9459Szrj-C[symspec]	--exec-counts[=symspec]
227*a9fa9459Szrj			Request output in the form of execution counts.
228*a9fa9459Szrj			If "symspec" is present, include only symbols
229*a9fa9459Szrj			selected by "symspec" in the execution count
230*a9fa9459Szrj			listing.  If the option is specified multiple
231*a9fa9459Szrj			times, the execution count listing includes
232*a9fa9459Szrj			symbols selected by the union of all symspecs.
233*a9fa9459Szrj
234*a9fa9459Szrj-Z[symspec]	--no-exec-counts[=symspec]
235*a9fa9459Szrj			Suppress output in the execution count listing.
236*a9fa9459Szrj			If given without an argument, the listing is
237*a9fa9459Szrj			suppressed completely.  With a "symspec", suppress
238*a9fa9459Szrj			the selected symbols from the call-graph.  If the
239*a9fa9459Szrj			option is specified multiple times, the union of
240*a9fa9459Szrj			the selected symbols is suppressed.  This option
241*a9fa9459Szrj			has lower precedence than --exec-counts.
242*a9fa9459Szrj
243*a9fa9459Szrj-i		--file-info
244*a9fa9459Szrj			Print information about the profile files that
245*a9fa9459Szrj			are read.  The information consists of the
246*a9fa9459Szrj			number and types of records present in the
247*a9fa9459Szrj			profile file.  Currently, a profile file can
248*a9fa9459Szrj			contain any number and any combination of histogram,
249*a9fa9459Szrj			call-graph, or basic-block count records.
250*a9fa9459Szrj
251*a9fa9459Szrj-s		--sum
252*a9fa9459Szrj
253*a9fa9459Szrj-x		--all-lines
254*a9fa9459Szrj			This option affects annotated source output only.
255*a9fa9459Szrj			By default, only the lines at the beginning of
256*a9fa9459Szrj			a basic-block are annotated.  If this option is
257*a9fa9459Szrj			specified, every line in a basic-block is annotated
258*a9fa9459Szrj			by repeating the annotation for the first line.
259*a9fa9459Szrj			This option is identical to tcov's "-a".
260*a9fa9459Szrj
261*a9fa9459Szrj-I dirs		--directory-path=dirs
262*a9fa9459Szrj			This option affects annotated source output only.
263*a9fa9459Szrj			Specifies the list of directories to be searched
264*a9fa9459Szrj			for source files.  The argument "dirs" is a colon
265*a9fa9459Szrj			separated list of directories.  By default, gprof
266*a9fa9459Szrj			searches for source files relative to the current
267*a9fa9459Szrj			working directory only.
268*a9fa9459Szrj
269*a9fa9459Szrj-z		--display-unused-functions
270*a9fa9459Szrj
271*a9fa9459Szrj-m num		--min-count=num
272*a9fa9459Szrj			This option affects annotated source and execution
273*a9fa9459Szrj			count output only.  Symbols that are executed
274*a9fa9459Szrj			less than "num" times are suppressed.  For annotated
275*a9fa9459Szrj			source output, suppressed symbols are marked
276*a9fa9459Szrj			by five hash-marks (#####).  In an execution count
277*a9fa9459Szrj			output, suppressed symbols do not appear at all.
278*a9fa9459Szrj
279*a9fa9459Szrj-L		--print-path
280*a9fa9459Szrj			Normally, source filenames are printed with the path
281*a9fa9459Szrj			component suppressed.  With this option, gprof
282*a9fa9459Szrj			can be forced to print the full pathname of
283*a9fa9459Szrj			source filenames.  The full pathname is determined
284*a9fa9459Szrj			from symbolic debugging information in the image file
285*a9fa9459Szrj			and is relative to the directory in which the compiler
286*a9fa9459Szrj			was invoked.
287*a9fa9459Szrj
288*a9fa9459Szrj-y		--separate-files
289*a9fa9459Szrj			This option affects annotated source output only.
290*a9fa9459Szrj			Normally, gprof prints annotated source files
291*a9fa9459Szrj			to standard-output.  If this option is specified,
292*a9fa9459Szrj			annotated source for a file named "path/filename"
293*a9fa9459Szrj			is generated in the file "filename-ann".  That is,
294*a9fa9459Szrj			annotated output is {\em always\/} generated in
295*a9fa9459Szrj			gprof's current working directory.  Care has to
296*a9fa9459Szrj			be taken if a program consists of files that have
297*a9fa9459Szrj			identical filenames, but distinct paths.
298*a9fa9459Szrj
299*a9fa9459Szrj-c		--static-call-graph
300*a9fa9459Szrj
301*a9fa9459Szrj-t num		--table-length=num
302*a9fa9459Szrj			This option affects annotated source output only.
303*a9fa9459Szrj			After annotating a source file, gprof generates
304*a9fa9459Szrj			an execution count summary consisting of a table
305*a9fa9459Szrj			of lines with the top execution counts.  By
306*a9fa9459Szrj			default, this table is ten entries long.
307*a9fa9459Szrj			This option can be used to change the table length
308*a9fa9459Szrj			or, by specifying an argument value of 0, it can be
309*a9fa9459Szrj			suppressed completely.
310*a9fa9459Szrj
311*a9fa9459Szrj-n symspec	--time=symspec
312*a9fa9459Szrj			Only symbols selected by "symspec" are considered
313*a9fa9459Szrj			in total and percentage time computations.
314*a9fa9459Szrj			However, this option does not affect percentage time
315*a9fa9459Szrj			computation for the flat profile.
316*a9fa9459Szrj			If the option is specified multiple times, the union
317*a9fa9459Szrj			of all selected symbols is used in time computations.
318*a9fa9459Szrj
319*a9fa9459Szrj-N		--no-time=symspec
320*a9fa9459Szrj			Exclude the symbols selected by "symspec" from
321*a9fa9459Szrj			total and percentage time computations.
322*a9fa9459Szrj			However, this option does not affect percentage time
323*a9fa9459Szrj			computation for the flat profile.
324*a9fa9459Szrj			This option is ignored if any --time options are
325*a9fa9459Szrj			specified.
326*a9fa9459Szrj
327*a9fa9459Szrj-w num		--width=num
328*a9fa9459Szrj			Sets the output line width.  Currently, this option
329*a9fa9459Szrj			affects the printing of the call-graph function index
330*a9fa9459Szrj			only.
331*a9fa9459Szrj
332*a9fa9459Szrj-e		<no long form---for backwards compatibility only>
333*a9fa9459Szrj-E		<no long form---for backwards compatibility only>
334*a9fa9459Szrj-f		<no long form---for backwards compatibility only>
335*a9fa9459Szrj-F		<no long form---for backwards compatibility only>
336*a9fa9459Szrj-k		<no long form---for backwards compatibility only>
337*a9fa9459Szrj-b		--brief
338*a9fa9459Szrj-dnum		--debug[=num]
339*a9fa9459Szrj
340*a9fa9459Szrj-h		--help
341*a9fa9459Szrj			Prints a usage message.
342*a9fa9459Szrj
343*a9fa9459Szrj-O name		--file-format=name
344*a9fa9459Szrj			Selects the format of the profile data files.
345*a9fa9459Szrj			Recognized formats are "auto", "bsd", "magic",
346*a9fa9459Szrj			and "prof".  The last one is not yet supported.
347*a9fa9459Szrj			Format "auto" attempts to detect the file format
348*a9fa9459Szrj			automatically (this is the default behavior).
349*a9fa9459Szrj			It attempts to read the profile data files as
350*a9fa9459Szrj			"magic" files and if this fails, falls back to
351*a9fa9459Szrj			the "bsd" format.  "bsd" forces gprof to read
352*a9fa9459Szrj			the data files in the BSD format.  "magic" forces
353*a9fa9459Szrj			gprof to read the data files in the "magic" format.
354*a9fa9459Szrj
355*a9fa9459Szrj-T		--traditional
356*a9fa9459Szrj-v		--version
357*a9fa9459Szrj
358*a9fa9459Szrj** File Format Changes
359*a9fa9459Szrj
360*a9fa9459SzrjThe old BSD-derived format used for profile data does not contain a
361*a9fa9459Szrjmagic cookie that allows to check whether a data file really is a
362*a9fa9459Szrjgprof file.  Furthermore, it does not provide a version number, thus
363*a9fa9459Szrjrendering changes to the file format almost impossible.  GNU gprof
364*a9fa9459Szrjuses a new file format that provides these features.  For backward
365*a9fa9459Szrjcompatibility, GNU gprof continues to support the old BSD-derived
366*a9fa9459Szrjformat, but not all features are supported with it.  For example,
367*a9fa9459Szrjbasic-block execution counts cannot be accommodated by the old file
368*a9fa9459Szrjformat.
369*a9fa9459Szrj
370*a9fa9459SzrjThe new file format is defined in header file \file{gmon_out.h}.  It
371*a9fa9459Szrjconsists of a header containing the magic cookie and a version number,
372*a9fa9459Szrjas well as some spare bytes available for future extensions.  All data
373*a9fa9459Szrjin a profile data file is in the native format of the host on which
374*a9fa9459Szrjthe profile was collected.  GNU gprof adapts automatically to the
375*a9fa9459Szrjbyte-order in use.
376*a9fa9459Szrj
377*a9fa9459SzrjIn the new file format, the header is followed by a sequence of
378*a9fa9459Szrjrecords.  Currently, there are three different record types: histogram
379*a9fa9459Szrjrecords, call-graph arc records, and basic-block execution count
380*a9fa9459Szrjrecords.  Each file can contain any number of each record type.  When
381*a9fa9459Szrjreading a file, GNU gprof will ensure records of the same type are
382*a9fa9459Szrjcompatible with each other and compute the union of all records.  For
383*a9fa9459Szrjexample, for basic-block execution counts, the union is simply the sum
384*a9fa9459Szrjof all execution counts for each basic-block.
385*a9fa9459Szrj
386*a9fa9459Szrj*** Histogram Records
387*a9fa9459Szrj
388*a9fa9459SzrjHistogram records consist of a header that is followed by an array of
389*a9fa9459Szrjbins.  The header contains the text-segment range that the histogram
390*a9fa9459Szrjspans, the size of the histogram in bytes (unlike in the old BSD
391*a9fa9459Szrjformat, this does not include the size of the header), the rate of the
392*a9fa9459Szrjprofiling clock, and the physical dimension that the bin counts
393*a9fa9459Szrjrepresent after being scaled by the profiling clock rate.  The
394*a9fa9459Szrjphysical dimension is specified in two parts: a long name of up to 15
395*a9fa9459Szrjcharacters and a single character abbreviation.  For example, a
396*a9fa9459Szrjhistogram representing real-time would specify the long name as
397*a9fa9459Szrj"seconds" and the abbreviation as "s".  This feature is useful for
398*a9fa9459Szrjarchitectures that support performance monitor hardware (which,
399*a9fa9459Szrjfortunately, is becoming increasingly common).  For example, under DEC
400*a9fa9459SzrjOSF/1, the "uprofile" command can be used to produce a histogram of,
401*a9fa9459Szrjsay, instruction cache misses.  In this case, the dimension in the
402*a9fa9459Szrjhistogram header could be set to "i-cache misses" and the abbreviation
403*a9fa9459Szrjcould be set to "1" (because it is simply a count, not a physical
404*a9fa9459Szrjdimension).  Also, the profiling rate would have to be set to 1 in
405*a9fa9459Szrjthis case.
406*a9fa9459Szrj
407*a9fa9459SzrjHistogram bins are 16-bit numbers and each bin represent an equal
408*a9fa9459Szrjamount of text-space.  For example, if the text-segment is one
409*a9fa9459Szrjthousand bytes long and if there are ten bins in the histogram, each
410*a9fa9459Szrjbin represents one hundred bytes.
411*a9fa9459Szrj
412*a9fa9459Szrj
413*a9fa9459Szrj*** Call-Graph Records
414*a9fa9459Szrj
415*a9fa9459SzrjCall-graph records have a format that is identical to the one used in
416*a9fa9459Szrjthe BSD-derived file format.  It consists of an arc in the call graph
417*a9fa9459Szrjand a count indicating the number of times the arc was traversed
418*a9fa9459Szrjduring program execution.  Arcs are specified by a pair of addresses:
419*a9fa9459Szrjthe first must be within caller's function and the second must be
420*a9fa9459Szrjwithin the callee's function.  When performing profiling at the
421*a9fa9459Szrjfunction level, these addresses can point anywhere within the
422*a9fa9459Szrjrespective function.  However, when profiling at the line-level, it is
423*a9fa9459Szrjbetter if the addresses are as close to the call-site/entry-point as
424*a9fa9459Szrjpossible.  This will ensure that the line-level call-graph is able to
425*a9fa9459Szrjidentify exactly which line of source code performed calls to a
426*a9fa9459Szrjfunction.
427*a9fa9459Szrj
428*a9fa9459Szrj*** Basic-Block Execution Count Records
429*a9fa9459Szrj
430*a9fa9459SzrjBasic-block execution count records consist of a header followed by a
431*a9fa9459Szrjsequence of address/count pairs.  The header simply specifies the
432*a9fa9459Szrjlength of the sequence.  In an address/count pair, the address
433*a9fa9459Szrjidentifies a basic-block and the count specifies the number of times
434*a9fa9459Szrjthat basic-block was executed.  Any address within the basic-address can
435*a9fa9459Szrjbe used.
436*a9fa9459Szrj
437*a9fa9459SzrjIMPLEMENTATION NOTE: gcc -a can be used to instrument a program to
438*a9fa9459Szrjrecord basic-block execution counts.  However, the __bb_exit_func()
439*a9fa9459Szrjthat is currently present in libgcc2.c does not generate a gmon.out
440*a9fa9459Szrjfile in a suitable format.  This should be fixed for future releases
441*a9fa9459Szrjof gcc.  In the meantime, contact davidm@cs.arizona.edu for a version
442*a9fa9459Szrjof __bb_exit_func() to is appropriate.
443*a9fa9459Szrj
444*a9fa9459SzrjCopyright (C) 2012-2016 Free Software Foundation, Inc.
445*a9fa9459Szrj
446*a9fa9459SzrjCopying and distribution of this file, with or without modification,
447*a9fa9459Szrjare permitted in any medium without royalty provided the copyright
448*a9fa9459Szrjnotice and this notice are preserved.
449