GProf's sampling inaccuracies

Angus angus@uducat.com
Wed Jun 20 19:33:00 GMT 2007


On Wednesday 20 June 2007 11:54, Segher Boessenkool wrote:
> > I'm profiling my C++ program and there are results that don't make a
> > lot of
> > sense to me. It seems that some functions are taking much more time
> > than they
> > look like they should. The best example is this one that does only one
> > thing,
> > and that thing is an integer compare. Using different data, I can get
> > the
> > flat profile to consistently report an average of about 275 self
> > nanoseconds
> > per call. All that time just to compare two integers?
>
> Use -pg only in the final link, so you don't get mcount()
> implanted into every function.  You won't have a call count
> or a call graph, but you do get a much more accurate time
> profile in return.

	Unfortunately, everytime I tired running gprof on the debug version of the 
program which only does profiling at link-time, I got "gprof: gmon.out file 
is missing call-graph data".
	For some strange reason the optimized version (that is, built from the 
"optimized" profile in KDevelop) didn't give me this trouble. However, the 
execution time for CompareReferences() went up 70%. God help me if that's 
more accurate!



More information about the Binutils mailing list