This is the mail archive of the
mailing list for the GCC project.
Re: line-by-line profiling
"Neal D. Becker" wrote:
> Any way to get line-by-line timing info? I see only how to get
> execution count from gcov, I'm really looking for profile of execution
gcc -pg -g and gprof -l works fine for me (well, using C, not C++).
Beware of large statistical differences when using the default profiling
timer though, as it is quite coarse for line-by-line profiling use, at least
on Linux. And you get to see the "profiling lag" (e.g., the line _after_ a
line with, say, an integer division gets a big time percentage; not the line
itself). Using a good hardware performance counter mechanism is much preferable.
Oh, and gprof -l is utterly slow.