calculate build elapsed time in SCons

scons, time

Solution

You can get timing information on various different aspects of the build using the `--debug=time` SCons command line option, as documented in the SCons man pages

Here's an excerpt, you can read the rest in the link provided above:

--debug=time
Prints various time profiling information: the time spent executing each 
individual build command; the total build time (time SCons ran from 
beginning to end); the total time spent reading and executing SConscript 
files; the total time spent SCons itself spend running (that is, not 
counting reading and executing SConscript files); and both the total 
time spent executing all build commands and the elapsed wall-clock 
time spent executing those build commands...

Problem

I have a project that consists of a binary and a set of static libraries it depends on. I'm trying to get the elapsed time for building each library without success. I have tried to use `AddPreAction()/AddPostAction()` for calculating the elapsed time but `AddPreAction()` is called once all the source files the library depends on have been compiled (which makes sense). There is a post related to this issue: How can I measure the build time for each component of a scons build? But I would prefer to look for a more elegant solution rather than overriding some environment variables and then have to parse the output in order to calculate the times. Thanks in advance.

Original source

Related problems