GProf's sampling inaccuracies

Segher Boessenkool segher@kernel.crashing.org
Wed Jun 20 15:54:00 GMT 2007


> 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.


Segher



More information about the Binutils mailing list