How can I create a complete assembly in C ++?

I am developing a C ++ application on Windows XP using Eclipse as my IDE and a Makefile-based build system (using special tools to create Make files). In addition, I use LZZ, which allows me to write a single file, which is then divided into a header and an implementation file. I am using the GCC 4 TDM port.

What tools or methods can I use to determine exactly how long each part of the assembly process takes, and why is this slow?

Of particular interest is:
  • How much time do you need to figure out to analyze Make files, find out dependencies, check timestamps, etc.
  • How long does it take Eclipse before and after assembly?
  • How much time does GCC spend on parsing and expanding headers?

PS: This is my home project, so expensive tools are not available to me, but can be documented here in any case, if they are especially relevant.

+6
c ++ eclipse profiling build-process makefile
source share
4 answers

Since Make and GCC are very verbose as to what they are doing, a very crude way to get a high-level overview of the time spent is to output the output through a script that marks each line:

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

(I use ActivePerl for this, but from what I am building, Strawberry Perl may now be the recommended version of Perl for Windows.)

Reformat or process timestamps as you wish.

For more information on GCC, use the --time-report option.

To find out how many extra Eclipse adds, use a stopwatch to create time from Eclipse and from the command line.

+6
source share

if you use boost, most of the time is spent on creating a template and subsequent optimization. You can tell GCC to report the time spent, -time-report (UNIX option, maybe something else on Windows GCC)

and if you are trying to speed up the compilation time, turn off optimization, -O0 (the last letter is zero, the first letter is capital o)

+1
source share

Try SparkBuild , a free gmake / nmake replacement that can generate an annotated build log with accurate time information for every build job. You can upload this file to SparkBuild Insight to get a graphical overview of what time is coming.

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

+1
source share

There is a version of GNU make called remake that provides profiling information.

0
source share

All Articles