请阅读【嵌入式开发学习必备专栏 之 ARM GCC 编译专栏】
文章目录
-
- GCC 编译时间统计
GCC 编译时间统计
如果你想要统计 GCC 编译过程中各个阶段的时间,可以使用 GCC 的
gcc -o myprogram myprogram.c -ftime-report
[02:19:31] (*^~^*) ~/sam$ gcc -o myprogram myprogram.c -ftime-report Time variable usr sys wall GGC phase setup : 0.00 ( 0%) 0.00 ( 0%) 0.00 ( 0%) 1298k ( 68%) phase opt and generate : 0.00 ( 0%) 0.00 ( 0%) 0.01 (100%) 57k ( 3%) initialize rtl : 0.00 ( 0%) 0.00 ( 0%) 0.01 (100%) 12k ( 1%) TOTAL
这将编译
请注意,
另一个相关的 GCC 选项是
gcc -o myprogram myprogram.c -ftime-report -Q
[02:21:04] (*^~^*) ~/sam$ gcc -o myprogram myprogram.c -ftime-report -Q main Analyzing compilation unit Performing interprocedural optimizations <*free_lang_data> {heap 964k} <visibility> {heap 964k} <build_ssa_passes> {heap 964k} <opt_local_passes> {heap 964k} <remove_symbols> {heap 964k} <targetclone> {heap 964k} <free-fnsummary> {heap 964k}Streaming LTO <whole-program> {heap 964k} <fnsummary> {heap 964k} <inline> {heap 964k} <modref> {heap 964k} <free-fnsummary> {heap 964k} <single-use> {heap 964k} <comdats> {heap 964k}Assembling functions: <simdclone> {heap 964k} main Time variable usr sys wall GGC phase setup : 0.00 ( 0%) 0.00 ( 0%) 0.00 ( 0%) 1298k ( 68%) phase parsing : 0.00 ( 0%) 0.00 ( 0%) 0.01 (100%) 531k ( 28%) lexical analysis : 0.00 ( 0%) 0.00 ( 0%) 0.01 (100%) 0 ( 0%) TOTAL : 0.00 0.00 0.01 1897k