How can I profile a complete C++ build?
build-process, c++, eclipse, makefile, profiling
Solution
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.
Problem
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? P.S.: 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.