gcc source to instruct gprof to report block times?

David Mathog mathog@mendel.bio.caltech.edu
Wed Mar 24 20:57:00 GMT 2004


Is there a # or other directive in gcc that signals
gprof to sum and report the times for a block of lines
within a function?

That is, put something like this in the source code:

#define gprof_block block1
/* many many lines of C code */
#undef  gprof_block

#define gprof_block block2
/* many many lines of C code */
#undef  gprof_block

compile with -pg, run gprof, and then output of gprof
would then have entries for block1 and block2,
showing how much time was spent in each block of lines?

When there are a couple of hundred lines per block
it can be difficult to figure out how much total time is spent
in logical block 1 vs. logical block 2, since the only method
provided seems to be to add up the times for all the lines
in each block.  Doing that seems a sure way to end up with
unreliable numbers due to rounding and truncation errors.

Thanks,

David Mathog
mathog@caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech



More information about the Gcc-help mailing list