计算SCons中的构建时间

use*_*525 5 time scons

我有一个包含二进制文件和一组依赖的静态库的项目。我正在尝试建立每个库所花费的时间而没有成功。

我曾尝试使用它AddPreAction()/AddPostAction()来计算经过的时间,但是AddPreAction()一旦库所依赖的所有源文件都已编译(即有意义),就会被调用。

有一个与此问题有关的帖子:

如何测量scons构建的每个组件的构建时间?

但是我宁愿寻找一种更优雅的解决方案,而不是覆盖一些环境变量,然后不得不解析输出以计算时间。

提前致谢。

Bra*_*ady 5

您可以使用--debug=timeSCons 命令行选项获取有关构建各个不同方面的计时信息,如SCons 手册页中所述

这是摘录,您可以在上面提供的链接中阅读其余部分:

--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...
Run Code Online (Sandbox Code Playgroud)