我有一个项目,它由一个二进制文件和一组它所依赖的静态库组成。我正在尝试获取构建每个库所用的时间,但没有成功。
我曾尝试使用 AddPreAction()/AddPostAction()
用于计算耗时,但 AddPreAction()
一旦库所依赖的所有源文件都被编译(这是有道理的),就会调用它。
有一篇与此问题相关的帖子:
How can I measure the build time for each component of a scons build?
但我更愿意寻找更优雅的解决方案,而不是覆盖一些环境变量,然后必须解析输出以计算时间。
提前致谢。
最佳答案
您可以使用 --debug=time
获取有关构建各个不同方面的计时信息。 SCons 命令行选项,如 SCons man pages 中所述
这是摘录,您可以在上面提供的链接中阅读其余部分:
--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...
关于time - 以 SCons 计算构建耗时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15044345/