[英]Build profiling: Can CMake/ninja produce a log of compile time for each compilation unit?
I'm trying to profile the build time of my project so I can see what's taking the most time.我正在尝试分析我的项目的构建时间,以便我可以看到花费最多的时间。 This seems like it should be easy... if I had every
clang
command listed in a file I could time each one of them and sort by time to find the compilations that take the longest, then I could go in and see which of those compilation units are surprising and try to figure out why they are so slow.这似乎应该很容易......如果我在一个文件中列出了每个
clang
命令,我可以对每个命令计时并按时间排序以找到耗时最长的编译,然后我可以 go 并查看其中哪些编译单元令人惊讶,并试图弄清楚它们为什么这么慢。
Googling gets me nowhere on this.谷歌搜索让我无处可去。 Clearly this is possible and would be useful.
显然,这是可能的,而且很有用。
So, either:所以,要么:
or或者
clang
commands it wants to run?clang
命令的列表?CXX_COMPILER_LAUNCHER
?CXX_COMPILER_LAUNCHER
? To get the list of compile commands use compile_commands.json .要获取编译命令列表,请使用compile_commands.json 。
Try using ninjatracing tool for getting build profile in Chrome's about:tracing format.尝试使用ninjatracing工具以 Chrome 的 about:tracing 格式获取构建配置文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.