HP-UX Reference (11i v2 03/08) - 1 User Commands A-M (vol 1)
g
gprof(1) gprof(1)
{
printf("Hello world\n");
a();
}
$ cc -G main.c -L. -ltest
$ export LD_PROFILE=a.out:libtest.so
$ export LD_PROFILEBUCKET_SIZE=16
$ ./a.out
hello world
Iina
$ unset LD_PROFILE
$ unset LD_PROFILEBUCKET_SIZE
$ ls gmon.out
gmon.out
$ gprof
WARNINGS
Beware of quantization errors. The granularity of the sampling is shown, but remains statistical at best.
It is assumed 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 parents of that function is directly proportional to the number of times that arc is traversed.
Parents that are not profiled have the time of their profiled children propagated to them, but they appear
to be spontaneously invoked in the call graph listing, and do not have their time propagated further.
Similarly, signal catchers, even though profiled, 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.
DEPENDENCIES
gprof cannot be used with dynamically linked executables (built with ld -A in pre-HP-UX 10.20
releases).
AUTHOR
gprof was developed by the University of California, Berkeley.
FILES
a.out* Default object file.
gmon.out* Default dynamic call graph and profile.
gmon.sum* Summarized dynamic call graph and profile.
/usr/lib/gprof.callg*
Call graph description.
/usr/lib/gprof.flat*
Flat profile description.
/usr/lib/hpux32/libgprof.so gprof
32-bit shared library profiler on Itanium-based sys-
tem.
/usr/lib/hpux64/libgprof.so gprof 64-bit shared library profiler on Itanium-based sys-
tem.
/usr/lib/libgprof.sl gprof 32-bit shared library profiler on PA-RISC.
/usr/lib/pa20_64/libgprof.sl gprof 64-bit shared library profiler on PA-RISC.
SEE ALSO
aCC(1), cc(1), cc_bundled(1), f90(1), ld(1), prof(1), exit(2), sprofil(2), crt0(3), smonitor(3C).
gprof: A Call Graph Execution Profiler; Graham, S.L., Kessler, P.B., McKusick, M.K.
Proceedings of the SIGPLAN ’82 Symposium on Compiler Construction ; SIGPLAN Notices; Vol. 17, No. 6,
pp. 120-126, June 1982.
HP-UX Linker and Libraries Online User’s Guide (See the
ld +help option).
HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 1−−343