build time profiling?

Dan Kegel dank@kegel.com
Sat Aug 7 23:47:00 GMT 2004


Troy wrote:
> I'm working on a project now that is a real rat's nest of templates 
> and unnecessary (or mostly unnecessary) #includes. As we start to
> try to disentangle things, it would be nice to see where to put the
> effort... e.g. which header files take the longest to compile, which get
> compiled most often. Generally a profile of what has taken how much time
> over *multiple* gcc runs. Otherwise one just greps a bit, sees which
> header files are included most often, makes some guesses about which
> templates are most costly and often used, that kind of thing. Not an 
> optimal method. 
> 
> This topic does not google well. "build time profiling" gets you a bunch
> of stuff about gcov and -pg.  ...

How 'bout compile everything with -E, concatenate all the source,
and grep '#' | sort | uniq -c ?
The most frequently occurring lines would indicate the files
that get included the most often, maybe you could look for ways
to not include those files.

Or maybe run a build under strace, and have it only look at 'open'
system calls, maybe.

- Dan

-- 
My technical stuff: http://kegel.com
My politics: see http://www.misleader.org for examples of why I'm for regime change



More information about the Gcc mailing list