剖析C ++编译过程 [英] Profiling the C++ compilation process

查看:147
本文介绍了剖析C ++编译过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我倾向于编写相当大的模板化头文件C ++库,我的用户通常抱怨编译时间。在考虑了这件事之后,我发现,我不知道时间在哪里。 是否有一些简单的方法来配置C ++编译过程与常见的编译器,如g ++,icc和xlC?例如,是否有可能了解在 C ++编译的每个阶段花费多少时间 gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html\">调试选项以找到在C ++编译的每个阶段花费多少时间?



并在每次通过完成后打印一些统计数据。



-ftime-report
使编译器打印一些关于每个通过完成时消耗的时间的统计信息。


通行证在 GCCINT 9:编译器的传递和文件



您可以将 -v - ftime-report 此处讨论。您可以在GCC 邮寄名单中寻求帮助。






对于非GCC 的编译器(或GCC 比3.3.6 )查看此主题中的其他选项。


I tend to write rather large templated header-only C++ libraries and my users commonly complain about compilation times. After thinking about the matter, it occurred to me that I have no idea where the time is going. Is there some simple way to profile the C++ compilation process with common compilers, such as g++, icc, and xlC? For instance, is it possible to get an idea of how much time is spent within each of the phases of C++ compilation?

解决方案

For GCC there are debugging options to find how much time is spent within each of the phases of C++ compilation?

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

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

Passes are described in GCCINT 9: Passes and Files of the Compiler.

You can post output of g++ compilation of single source file with -v -ftime-report here to discuss it. There could be some help on the GCC mailing list.


For compilers other than GCC (or GCC more ancient than 3.3.6) see the other options in this thread.

这篇关于剖析C ++编译过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆