922 lines
24 KiB
HTML
922 lines
24 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of GPROF</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>GPROF</H1>
|
|
Section: GNU (1)<BR>Updated: 2021-01-21<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
gprof - display call graph profile data
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
gprof [ -[abcDhilLrsTvwxyz] ] [ -[ACeEfFJnNOpPqQRStZ][<I>name</I>] ]
|
|
<BR> [ -I <I>dirs</I> ] [ -d[<I>num</I>] ] [ -k <I>from/to</I> ]
|
|
<BR> [ -m <I>min-count</I> ] [ -R <I>map_file</I> ] [ -t <I>table-length</I> ]
|
|
<BR> [ --[no-]annotated-source[=<I>name</I>] ]
|
|
<BR> [ --[no-]exec-counts[=<I>name</I>] ]
|
|
<BR> [ --[no-]flat-profile[=<I>name</I>] ] [ --[no-]graph[=<I>name</I>] ]
|
|
<BR> [ --[no-]time=<I>name</I>] [ --all-lines ] [ --brief ]
|
|
<BR> [ --debug[=<I>level</I>] ] [ --function-ordering ]
|
|
<BR> [ --file-ordering <I>map_file</I> ] [ --directory-path=<I>dirs</I> ]
|
|
<BR> [ --display-unused-functions ] [ --file-format=<I>name</I> ]
|
|
<BR> [ --file-info ] [ --help ] [ --line ] [ --inline-file-names ]
|
|
<BR> [ --min-count=<I>n</I> ] [ --no-static ] [ --print-path ]
|
|
<BR> [ --separate-files ] [ --static-call-graph ] [ --sum ]
|
|
<BR> [ --table-length=<I>len</I> ] [ --traditional ] [ --version ]
|
|
<BR> [ --width=<I>n</I> ] [ --ignore-non-functions ]
|
|
<BR> [ --demangle[=<I></I><FONT SIZE="-1"><I>STYLE</I></FONT><I></I>] ] [ --no-demangle ]
|
|
<BR> [--external-symbol-table=name]
|
|
<BR> [ <I>image-file</I> ] [ <I>profile-file</I> ... ]
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
<TT>"gprof"</TT> produces an execution profile of C, Pascal, or Fortran77
|
|
programs. The effect of called routines is incorporated in the profile
|
|
of each caller. The profile data is taken from the call graph profile file
|
|
(<I>gmon.out</I> default) which is created by programs
|
|
that are compiled with the <B>-pg</B> option of
|
|
<TT>"cc"</TT>, <TT>"pc"</TT>, and <TT>"f77"</TT>.
|
|
The <B>-pg</B> option also links in versions of the library routines
|
|
that are compiled for profiling. <TT>"Gprof"</TT> reads the given object
|
|
file (the default is <TT>"a.out"</TT>) and establishes the relation between
|
|
its symbol table and the call graph profile from <I>gmon.out</I>.
|
|
If more than one profile file is specified, the <TT>"gprof"</TT>
|
|
output shows the sum of the profile information in the given profile files.
|
|
<P>
|
|
|
|
If you use gcc 2.95.x or 3.0 to compile your binaries, you may need
|
|
to add the <B>-fprofile-arcs</B> to the compile command line in order
|
|
for the call graphs to be properly stored in gmon.out.
|
|
<P>
|
|
|
|
<TT>"Gprof"</TT> calculates the amount of time spent in each routine.
|
|
Next, these times are propagated along the edges of the call graph.
|
|
Cycles are discovered, and calls into a cycle are made to share the time
|
|
of the cycle.
|
|
<P>
|
|
|
|
Several forms of output are available from the analysis.
|
|
<P>
|
|
|
|
The <I>flat profile</I> shows how much time your program spent in each function,
|
|
and how many times that function was called. If you simply want to know
|
|
which functions burn most of the cycles, it is stated concisely here.
|
|
<P>
|
|
|
|
The <I>call graph</I> shows, for each function, which functions called it, which
|
|
other functions it called, and how many times. There is also an estimate
|
|
of how much time was spent in the subroutines of each function. This can
|
|
suggest places where you might try to eliminate function calls that use a
|
|
lot of time.
|
|
<P>
|
|
|
|
The <I>annotated source</I> listing is a copy of the program's
|
|
source code, labeled with the number of times each line of the
|
|
program was executed.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
|
|
|
|
These options specify which of several output formats
|
|
<TT>"gprof"</TT> should produce.
|
|
<P>
|
|
|
|
Many of these options take an optional <I>symspec</I> to specify
|
|
functions to be included or excluded. These options can be
|
|
specified multiple times, with different symspecs, to include
|
|
or exclude sets of symbols.
|
|
<P>
|
|
|
|
Specifying any of these options overrides the default (<B>-p -q</B>),
|
|
which prints a flat profile and call graph analysis
|
|
for all functions.
|
|
<DL COMPACT>
|
|
<DT id="1">"-A[<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="2">"--annotated-source[=<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-A</B> option causes <TT>"gprof"</TT> to print annotated source code.
|
|
If <I>symspec</I> is specified, print output only for matching symbols.
|
|
<DT id="3">"-b"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="4">"--brief"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
If the <B>-b</B> option is given, <TT>"gprof"</TT> doesn't print the
|
|
verbose blurbs that try to explain the meaning of all of the fields in
|
|
the tables. This is useful if you intend to print out the output, or
|
|
are tired of seeing the blurbs.
|
|
<DT id="5">"-C[<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="6">"--exec-counts[=<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-C</B> option causes <TT>"gprof"</TT> to
|
|
print a tally of functions and the number of times each was called.
|
|
If <I>symspec</I> is specified, print tally only for matching symbols.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
If the profile data file contains basic-block count records, specifying
|
|
the <B>-l</B> option, along with <B>-C</B>, will cause basic-block
|
|
execution counts to be tallied and displayed.
|
|
<DT id="7">"-i"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="8">"--file-info"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-i</B> option causes <TT>"gprof"</TT> to display summary information
|
|
about the profile data file(s) and then exit. The number of histogram,
|
|
call graph, and basic-block count records is displayed.
|
|
<DT id="9">"-I <I>dirs</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="10">"--directory-path=<I>dirs</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-I</B> option specifies a list of search directories in
|
|
which to find source files. Environment variable <I></I><FONT SIZE="-1"><I>GPROF_PATH</I></FONT><I></I>
|
|
can also be used to convey this information.
|
|
Used mostly for annotated source output.
|
|
<DT id="11">"-J[<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="12">"--no-annotated-source[=<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-J</B> option causes <TT>"gprof"</TT> not to
|
|
print annotated source code.
|
|
If <I>symspec</I> is specified, <TT>"gprof"</TT> prints annotated source,
|
|
but excludes matching symbols.
|
|
<DT id="13">"-L"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="14">"--print-path"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
Normally, source filenames are printed with the path
|
|
component suppressed. The <B>-L</B> option causes <TT>"gprof"</TT>
|
|
to print the full pathname of
|
|
source filenames, which is determined
|
|
from symbolic debugging information in the image file
|
|
and is relative to the directory in which the compiler
|
|
was invoked.
|
|
<DT id="15">"-p[<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="16">"--flat-profile[=<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-p</B> option causes <TT>"gprof"</TT> to print a flat profile.
|
|
If <I>symspec</I> is specified, print flat profile only for matching symbols.
|
|
<DT id="17">"-P[<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="18">"--no-flat-profile[=<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-P</B> option causes <TT>"gprof"</TT> to suppress printing a flat profile.
|
|
If <I>symspec</I> is specified, <TT>"gprof"</TT> prints a flat profile,
|
|
but excludes matching symbols.
|
|
<DT id="19">"-q[<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="20">"--graph[=<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-q</B> option causes <TT>"gprof"</TT> to print the call graph analysis.
|
|
If <I>symspec</I> is specified, print call graph only for matching symbols
|
|
and their children.
|
|
<DT id="21">"-Q[<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="22">"--no-graph[=<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-Q</B> option causes <TT>"gprof"</TT> to suppress printing the
|
|
call graph.
|
|
If <I>symspec</I> is specified, <TT>"gprof"</TT> prints a call graph,
|
|
but excludes matching symbols.
|
|
<DT id="23">"-t"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="24">"--table-length=<I>num</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-t</B> option causes the <I>num</I> most active source lines in
|
|
each source file to be listed when source annotation is enabled. The
|
|
default is 10.
|
|
<DT id="25">"-y"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="26">"--separate-files"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
This option affects annotated source output only.
|
|
Normally, <TT>"gprof"</TT> prints annotated source files
|
|
to standard-output. If this option is specified,
|
|
annotated source for a file named <I>path/filename</I>
|
|
is generated in the file <I>filename-ann</I>. If the underlying
|
|
file system would truncate <I>filename-ann</I> so that it
|
|
overwrites the original <I>filename</I>, <TT>"gprof"</TT> generates
|
|
annotated source in the file <I>filename.ann</I> instead (if the
|
|
original file name has an extension, that extension is <I>replaced</I>
|
|
with <I>.ann</I>).
|
|
<DT id="27">"-Z[<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="28">"--no-exec-counts[=<I>symspec</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-Z</B> option causes <TT>"gprof"</TT> not to
|
|
print a tally of functions and the number of times each was called.
|
|
If <I>symspec</I> is specified, print tally, but exclude matching symbols.
|
|
<DT id="29">"-r"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="30">"--function-ordering"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>--function-ordering</B> option causes <TT>"gprof"</TT> to print a
|
|
suggested function ordering for the program based on profiling data.
|
|
This option suggests an ordering which may improve paging, tlb and
|
|
cache behavior for the program on systems which support arbitrary
|
|
ordering of functions in an executable.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
The exact details of how to force the linker to place functions
|
|
in a particular order is system dependent and out of the scope of this
|
|
manual.
|
|
<DT id="31">"-R <I>map_file</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="32">"--file-ordering <I>map_file</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>--file-ordering</B> option causes <TT>"gprof"</TT> to print a
|
|
suggested .o link line ordering for the program based on profiling data.
|
|
This option suggests an ordering which may improve paging, tlb and
|
|
cache behavior for the program on systems which do not support arbitrary
|
|
ordering of functions in an executable.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Use of the <B>-a</B> argument is highly recommended with this option.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
The <I>map_file</I> argument is a pathname to a file which provides
|
|
function name to object file mappings. The format of the file is similar to
|
|
the output of the program <TT>"nm"</TT>.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
c-parse.o:00000000 T yyparse
|
|
c-parse.o:00000004 C yyerrflag
|
|
c-lang.o:00000000 T maybe_objc_method_name
|
|
c-lang.o:00000000 T print_lang_statistics
|
|
c-lang.o:00000000 T recognize_objc_keyword
|
|
c-decl.o:00000000 T print_lang_identifier
|
|
c-decl.o:00000000 T print_lang_type
|
|
...
|
|
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
|
|
To create a <I>map_file</I> with <FONT SIZE="-1">GNU</FONT> <TT>"nm"</TT>, type a command like
|
|
<TT>"nm --extern-only --defined-only -v --print-file-name program-name"</TT>.
|
|
<DT id="33">"-T"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="34">"--traditional"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-T</B> option causes <TT>"gprof"</TT> to print its output in
|
|
``traditional'' <FONT SIZE="-1">BSD</FONT> style.
|
|
<DT id="35">"-w <I>width</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="36">"--width=<I>width</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
Sets width of output lines to <I>width</I>.
|
|
Currently only used when printing the function index at the bottom
|
|
of the call graph.
|
|
<DT id="37">"-x"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="38">"--all-lines"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
This option affects annotated source output only.
|
|
By default, only the lines at the beginning of a basic-block
|
|
are annotated. If this option is specified, every line in
|
|
a basic-block is annotated by repeating the annotation for the
|
|
first line. This behavior is similar to <TT>"tcov"</TT>'s <B>-a</B>.
|
|
<DT id="39">"--demangle[=<I>style</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="40">"--no-demangle"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
These options control whether C<FONT SIZE="-2">++</FONT> symbol names should be demangled when
|
|
printing output. The default is to demangle symbols. The
|
|
<TT>"--no-demangle"</TT> option may be used to turn off demangling. Different
|
|
compilers have different mangling styles. The optional demangling style
|
|
argument can be used to choose an appropriate demangling style for your
|
|
compiler.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Analysis Options</H3>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="41">"-a"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="42">"--no-static"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-a</B> option causes <TT>"gprof"</TT> to suppress the printing of
|
|
statically declared (private) functions. (These are functions whose
|
|
names are not listed as global, and which are not visible outside the
|
|
file/function/block where they were defined.) Time spent in these
|
|
functions, calls to/from them, etc., will all be attributed to the
|
|
function that was loaded directly before it in the executable file.
|
|
This option affects both the flat profile and the call graph.
|
|
<DT id="43">"-c"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="44">"--static-call-graph"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-c</B> option causes the call graph of the program to be
|
|
augmented by a heuristic which examines the text space of the object
|
|
file and identifies function calls in the binary machine code.
|
|
Since normal call graph records are only generated when functions are
|
|
entered, this option identifies children that could have been called,
|
|
but never were. Calls to functions that were not compiled with
|
|
profiling enabled are also identified, but only if symbol table
|
|
entries are present for them.
|
|
Calls to dynamic library routines are typically <I>not</I> found
|
|
by this option.
|
|
Parents or children identified via this heuristic
|
|
are indicated in the call graph with call counts of <B>0</B>.
|
|
<DT id="45">"-D"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="46">"--ignore-non-functions"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-D</B> option causes <TT>"gprof"</TT> to ignore symbols which
|
|
are not known to be functions. This option will give more accurate
|
|
profile data on systems where it is supported (Solaris and <FONT SIZE="-1">HPUX</FONT> for
|
|
example).
|
|
<DT id="47">"-k <I>from</I>/<I>to</I>"<DD>
|
|
|
|
|
|
|
|
|
|
The <B>-k</B> option allows you to delete from the call graph any arcs from
|
|
symbols matching symspec <I>from</I> to those matching symspec <I>to</I>.
|
|
<DT id="48">"-l"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="49">"--line"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-l</B> option enables line-by-line profiling, which causes
|
|
histogram hits to be charged to individual source code lines,
|
|
instead of functions. This feature only works with programs compiled
|
|
by older versions of the <TT>"gcc"</TT> compiler. Newer versions of
|
|
<TT>"gcc"</TT> are designed to work with the <TT>"gcov"</TT> tool instead.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
If the program was compiled with basic-block counting enabled,
|
|
this option will also identify how many times each line of
|
|
code was executed.
|
|
While line-by-line profiling can help isolate where in a large function
|
|
a program is spending its time, it also significantly increases
|
|
the running time of <TT>"gprof"</TT>, and magnifies statistical
|
|
inaccuracies.
|
|
<DT id="50">"--inline-file-names"<DD>
|
|
|
|
|
|
|
|
|
|
This option causes <TT>"gprof"</TT> to print the source file after each
|
|
symbol in both the flat profile and the call graph. The full path to the
|
|
file is printed if used with the <B>-L</B> option.
|
|
<DT id="51">"-m <I>num</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="52">"--min-count=<I>num</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
This option affects execution count output only.
|
|
Symbols that are executed less than <I>num</I> times are suppressed.
|
|
<DT id="53">"-n<I>symspec</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="54">"--time=<I>symspec</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-n</B> option causes <TT>"gprof"</TT>, in its call graph analysis,
|
|
to only propagate times for symbols matching <I>symspec</I>.
|
|
<DT id="55">"-N<I>symspec</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="56">"--no-time=<I>symspec</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-n</B> option causes <TT>"gprof"</TT>, in its call graph analysis,
|
|
not to propagate times for symbols matching <I>symspec</I>.
|
|
<DT id="57">"-S<I>filename</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="58">"--external-symbol-table=<I>filename</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-S</B> option causes <TT>"gprof"</TT> to read an external symbol table
|
|
file, such as <I>/proc/kallsyms</I>, rather than read the symbol table
|
|
from the given object file (the default is <TT>"a.out"</TT>). This is useful
|
|
for profiling kernel modules.
|
|
<DT id="59">"-z"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="60">"--display-unused-functions"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
If you give the <B>-z</B> option, <TT>"gprof"</TT> will mention all
|
|
functions in the flat profile, even those that were never called, and
|
|
that had no time spent in them. This is useful in conjunction with the
|
|
<B>-c</B> option for discovering which routines were never called.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Miscellaneous Options</H3>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="61">"-d[<I>num</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="62">"--debug[=<I>num</I>]"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-d</B> <I>num</I> option specifies debugging options.
|
|
If <I>num</I> is not specified, enable all debugging.
|
|
<DT id="63">"-h"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="64">"--help"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-h</B> option prints command line usage.
|
|
<DT id="65">"-O<I>name</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="66">"--file-format=<I>name</I>"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
Selects the format of the profile data files. Recognized formats are
|
|
<B>auto</B> (the default), <B>bsd</B>, <B>4.4bsd</B>, <B>magic</B>, and
|
|
<B>prof</B> (not yet supported).
|
|
<DT id="67">"-s"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="68">"--sum"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-s</B> option causes <TT>"gprof"</TT> to summarize the information
|
|
in the profile data files it read in, and write out a profile data
|
|
file called <I>gmon.sum</I>, which contains all the information from
|
|
the profile data files that <TT>"gprof"</TT> read in. The file <I>gmon.sum</I>
|
|
may be one of the specified input files; the effect of this is to
|
|
merge the data in the other input files into <I>gmon.sum</I>.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Eventually you can run <TT>"gprof"</TT> again without <B>-s</B> to analyze the
|
|
cumulative data in the file <I>gmon.sum</I>.
|
|
<DT id="69">"-v"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="70">"--version"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
The <B>-v</B> flag causes <TT>"gprof"</TT> to print the current version
|
|
number, and then exit.
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Deprecated Options</H3>
|
|
|
|
|
|
|
|
These options have been replaced with newer versions that use symspecs.
|
|
<DL COMPACT>
|
|
<DT id="71">"-e <I>function_name</I>"<DD>
|
|
|
|
|
|
|
|
|
|
The <B>-e</B> <I>function</I> option tells <TT>"gprof"</TT> to not print
|
|
information about the function <I>function_name</I> (and its
|
|
children...) in the call graph. The function will still be listed
|
|
as a child of any functions that call it, but its index number will be
|
|
shown as <B>[not printed]</B>. More than one <B>-e</B> option may be
|
|
given; only one <I>function_name</I> may be indicated with each <B>-e</B>
|
|
option.
|
|
<DT id="72">"-E <I>function_name</I>"<DD>
|
|
|
|
|
|
|
|
|
|
The <TT>"-E </TT>function<TT>"</TT> option works like the <TT>"-e"</TT> option, but
|
|
time spent in the function (and children who were not called from
|
|
anywhere else), will not be used to compute the percentages-of-time for
|
|
the call graph. More than one <B>-E</B> option may be given; only one
|
|
<I>function_name</I> may be indicated with each <B>-E</B> option.
|
|
<DT id="73">"-f <I>function_name</I>"<DD>
|
|
|
|
|
|
|
|
|
|
The <B>-f</B> <I>function</I> option causes <TT>"gprof"</TT> to limit the
|
|
call graph to the function <I>function_name</I> and its children (and
|
|
their children...). More than one <B>-f</B> option may be given;
|
|
only one <I>function_name</I> may be indicated with each <B>-f</B>
|
|
option.
|
|
<DT id="74">"-F <I>function_name</I>"<DD>
|
|
|
|
|
|
|
|
|
|
The <B>-F</B> <I>function</I> option works like the <TT>"-f"</TT> option, but
|
|
only time spent in the function and its children (and their
|
|
children...) will be used to determine total-time and
|
|
percentages-of-time for the call graph. More than one <B>-F</B> option
|
|
may be given; only one <I>function_name</I> may be indicated with each
|
|
<B>-F</B> option. The <B>-F</B> option overrides the <B>-E</B> option.
|
|
</DL>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>FILES</H2>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="75">"<I>a.out</I>"<DD>
|
|
|
|
|
|
|
|
|
|
the namelist and text space.
|
|
<DT id="76">"<I>gmon.out</I>"<DD>
|
|
|
|
|
|
|
|
|
|
dynamic call graph and profile.
|
|
<DT id="77">"<I>gmon.sum</I>"<DD>
|
|
|
|
|
|
|
|
|
|
summarized dynamic call graph and profile.
|
|
</DL>
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
|
|
|
|
The granularity of the sampling is shown, but remains
|
|
statistical at best.
|
|
We assume that the time for each execution of a function
|
|
can be expressed by the total time for the function divided
|
|
by the number of times the function is called.
|
|
Thus the time propagated along the call graph arcs to the function's
|
|
parents is directly proportional to the number of times that
|
|
arc is traversed.
|
|
<P>
|
|
|
|
Parents that are not themselves profiled will have the time of
|
|
their profiled children propagated to them, but they will appear
|
|
to be spontaneously invoked in the call graph listing, and will
|
|
not have their time propagated further.
|
|
Similarly, signal catchers, even though profiled, will appear
|
|
to be spontaneous (although for more obscure reasons).
|
|
Any profiled children of signal catchers should have their times
|
|
propagated properly, unless the signal catcher was invoked during
|
|
the execution of the profiling routine, in which case all is lost.
|
|
<P>
|
|
|
|
The profiled program must call <TT>"exit"</TT>(2)
|
|
or return normally for the profiling information to be saved
|
|
in the <I>gmon.out</I> file.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+cc">cc</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+prof">prof</A></B>(1), and the Info entry for <I>gprof</I>.
|
|
<P>
|
|
|
|
``An Execution Profiler for Modular Programs'',
|
|
by S. Graham, P. Kessler, M. McKusick;
|
|
Software - Practice and Experience,
|
|
Vol. 13, pp. 671-685, 1983.
|
|
<P>
|
|
|
|
``gprof: A Call Graph Execution Profiler'',
|
|
by S. Graham, P. Kessler, M. McKusick;
|
|
Proceedings of the <FONT SIZE="-1">SIGPLAN</FONT> '82 Symposium on Compiler Construction,
|
|
<FONT SIZE="-1">SIGPLAN</FONT> Notices, Vol. 17, No 6, pp. 120-126, June 1982.
|
|
<A NAME="lbAL"> </A>
|
|
<H2>COPYRIGHT</H2>
|
|
|
|
|
|
|
|
Copyright (c) 1988-2020 Free Software Foundation, Inc.
|
|
<P>
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
under the terms of the <FONT SIZE="-1">GNU</FONT> Free Documentation License, Version 1.3
|
|
or any later version published by the Free Software Foundation;
|
|
with no Invariant Sections, with no Front-Cover Texts, and with no
|
|
Back-Cover Texts. A copy of the license is included in the
|
|
section entitled ``<FONT SIZE="-1">GNU</FONT> Free Documentation License''.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="78"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="79"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="80"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="81"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DL>
|
|
<DT id="82"><A HREF="#lbAF">Analysis Options</A><DD>
|
|
<DT id="83"><A HREF="#lbAG">Miscellaneous Options</A><DD>
|
|
<DT id="84"><A HREF="#lbAH">Deprecated Options</A><DD>
|
|
</DL>
|
|
<DT id="85"><A HREF="#lbAI">FILES</A><DD>
|
|
<DT id="86"><A HREF="#lbAJ">BUGS</A><DD>
|
|
<DT id="87"><A HREF="#lbAK">SEE ALSO</A><DD>
|
|
<DT id="88"><A HREF="#lbAL">COPYRIGHT</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:15 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|