I have recently encountered a gross inaccuracy in gprof that I can't explain. Yes, I know gprof uses a sampling technique so I should not expect a high level of precision, but the results I am getting clearly reflect a more fundamental issue.
The program in question has been compiled with -pg for all source code files. The time command reports 20 seconds of user time (which is consistent with personal observation) but the gprof output accounts for only about 6 seconds of the execution time. I have eliminated all IO from the program, and the results remain consistent. Gprof is sampling the program every 10 ms, so in the observed 20 seconds of execution time, it should be taking 2000 samples, which should be enough to avoid any grows inconsistencies. Any ideas would be appreciated. Jon