gpt4 book ai didi

c++ - 分析 C++ 编译过程

转载 作者:IT老高 更新时间:2023-10-28 12:06:13 25 4
gpt4 key购买 nike

我倾向于编写相当大的模板化仅 header C++ 库,而我的用户通常会提示编译时间。想了想,我突然想到我不知道时间都去哪儿了。有没有一些简单的方法可以用常见的编译器来分析 C++ 编译过程,例如 GCC (g++), Intel C++ Compiler (icc) 和 XL C/C++ (xlC)?例如,是否有可能了解在 each of the phases of C++ compilation 中花费了多少时间? ?

最佳答案

对于 GCCdebugging options找出在 C++ 编译的每个阶段中花费了多少时间?

-QMakes the compiler print out each function name as it is compiled, and print some statistics about each pass when it finishes.

-ftime-reportMakes the compiler print some statistics about the time consumed by each pass when it finishes.

通行证在 GCCINT 9: Passes and Files of the Compiler 中进行了描述.

您可以在此处使用 -v -ftime-report 将单个源文件的 g++ 编译的输出发布到 discuss it . GCC mailing list 上可能会有一些帮助.


对于 GCC 以外的编译器(或 GCC 3.3.6 更古老的),请参阅其他答案中的其他选项。

关于c++ - 分析 C++ 编译过程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13559818/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com