Node:Garbled profile, Next:, Previous:Profiled crash, Up:Profiling

13.3 Gprof produces garbled profile

Q: Whenever I compile my programs with -pg, the profile produced by Gprof shows that 100% of the run time is spent in a single function, and the rest of the code gets 0% of time. Huh??

A: This is due to a bug in the library shipped with DJGPP v2.02: the module which handles timers works incorrectly. (The same bug is responsible for problems with library functions setitimer and alarm.) The solution is to upgrade to DJGPP v2.03 where these bugs are solved. Relink your program with the v2.03 library, then rerun it, and Gprof will show reasonable results.