Hi, On Sun, 21 Feb 2010, Jon Turner wrote:
> I have recently encountered a gross inaccuracy in gprof that > I can't explain. Yes, I know gprof uses a sampling technique This is incorrect. Code compiled with -pg will call mcount on each function entry. If there are many calls (compared to other computations) the mcount overhead might become fairly large. > 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. As others have mentioned, code compiled without -pg or in shared libraries (independend of being compiled with -pg) won't be in the profile. That might be the other reason of inconsistencies. Ciao, Michael.