Dies ist eine alte Version des Dokuments!
Both compiling an linking phase of GNU GCC must be telled to generate extra code to write profile information -pg
:
gcc -o foo foo.c -pg # or gcc -c foo.c -pg gcc -o foo foo.o -pg
What if external libs are used?
According to GLAP p.619 the profile data file gmon.out
is only written upon normal exit of the application, not eg on exit with SIGKILL. See also Terminal Ctrl characters
In order to exit gracefully for a programm with an infintite main loop, eg a signal handler for TERM could be installed. Link!
gprof foo gmon.out
Writes ACII to stdout