views:

112

answers:

3

Hi,

I'm developing an application in C++ on Windows XP, using Eclipse as my IDE, and a Makefile-based build system (with custom tools to generate the Makefiles). In addition, I'm using LZZ, which allows me to write a single file, which then gets split into a header and an implementation file. I'm using TDM's port of GCC 4.

What tools or techniques could I use to determine exactly how much time each part of the build process takes, and why it is slow?

Of particular interest would be:

  • How much time does make need to figure out to parse the Makefiles, figure out the dependencies, check the timestamps, etc?
  • How much time does Eclipse need before and after the build?
  • How much time does GCC spend on parsing system and boost headers?

Thanks!

Carl

PS. This is my home project, so expensive tools are out of reach for me, but could be documented here anyway if they are particularly relevant.

+1  A: 

if you are using boost, most likely most of time is spent in template instantiation and subsequent optimization. You can tell GCC to report time spent, -time-report (UNIX option, might be something else on Windows GCC)

and if you are trying to speed up your compilation time, disable optimization, -O0 (last letter is number zero, first letter is capital o)

aaa
+4  A: 

Since Make and GCC are very verbose about what they're doing, a very crude way to get a high-level overview of time spent is to pipe make's output through a script that timestamps each line:

make | perl -MTime::HiRes -pe "printf '%.5f ', Time::HiRes::time()"

(I'm using ActivePerl to do this, but from what I gather, Strawberry Perl may now be the recommended Perl version for Windows.)

Reformat or process the timestamps to your liking.

To get more details about GCC in particular, use the --time-report option.

To find out how much overhead Eclipse adds, use a stopwatch to time builds from Eclipse and from the command line.

Josh Kelley
+1  A: 

Try SparkBuild, a free gmake/nmake replacement that can generate an annotated build log with precise timing information for every job in the build. You can load that file into SparkBuild Insight to get a graphical overview of where the time goes.

See this blog for an example of how to use it.

Eric Melski