Next: , Previous: Program execution, Up: Profiling an Ada Program with gprof


8.2.2.3 Running gprof

The gprof tool is called as follow:

    $ gprof my_prog gmon.out

or simply:

    $  gprof my_prog

The complete form of the gprof command line is the following:

    $ gprof [switches] [executable [data-file]]

gprof supports numerous switches. The order of these switch does not matter. The full list of options can be found in the GNU Profiler User's Guide documentation that comes with this documentation.

The following is the subset of those switches that is most relevant:

--demangle[=`style'], --no-demangle
These options control whether symbol names should be demangled when printing output. The default is to demangle C++ symbols. The --no-demangle 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, in particular Ada symbols generated by GNAT can be demangled using --demangle=gnat.

-e `function_name'
The -e `function' option tells gprof not to print information about the function function_name (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 [not printed]. More than one -e option may be given; only one function_name may be indicated with each -e option.

-E `function_name'
The -E `function' option works like the -e option, but execution 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 -E option may be given; only one function_name may be indicated with each -E option.

-f `function_name'
The -f `function' option causes gprof to limit the call graph to the function function_name and its children (and their children...). More than one -f option may be given; only one function_name may be indicated with each -f option.

-F `function_name'
The -F `function' option works like the -f 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 -F option may be given; only one function_name may be indicated with each -F option. The -F option overrides the -E option.