0
votes

I have gprof working fine on a linux system. I am getting samples and also some call count information. So I added the attribute ((hot)) to some functions. Now they have disapeared from the gprof sample output, only my none hot functions are "sampled". The hot functions still appear in the call count information. How do I fix this ?

I suspect one of two things has happened. gprof filters on what it thinks is relevent addresses and the hot functions are now outside this range as they are now in the .text.hot section. Or, somehow, there is some confusion in the debug data for the hot functions and so gprof is ignoring them.

1
Have you looked at the assembly output (gcc option -S)? Is the debug info in the text.hot section somehow different or missing?Chris
I've tried to reproduce this using the normal gcc toolchain in Fedora 19, and attribute((hot)) does not change the gprof behavior in any way. Could you post details of your toolchain and also the flags you use to compile the program?Chris

1 Answers

1
votes

attribute((hot)) also makes it more likely that the functions are inlined, at least within the same source file. Call counts would only be increased if the non-inlined version of the function is called (probably from a different module). The functions would not show up in the samples, because only the call sites are known to the profiler.

You should be able to detect if this happened by checking your call counts. If they are much lower with attribute((hot)), inlining would be the cause.