c++ g++ llvm-clang 编译器分析

c++ g++ llvm-clang compiler profiling(c++ g++ llvm-clang 编译器分析)

本文介绍了c++ g++ llvm-clang 编译器分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请注意,我的问题不是:我如何告诉我的编译器在开启分析的情况下进行编译.

Note, my question is not: how do I tell my compiler to compile with profiling on.

我想配置我的编译过程.对于每个文件,我想知道程序的每一行花费了多少时间.

I want to profile my compiles process. For each file, I'd like to know how much time is spent on each line of the program.

我正在处理一个项目,有些文件的编译时间很长,我正在尝试找出原因.

I'm working on a project, some files have huge compile times, I'm trying to figure out why.

有没有办法用 g++ 或 llvm-clang 做到这一点?

Is there anyway to do this with g++ or llvm-clang?

谢谢!

-v -ftime-report 的输出(什么意思)?

Output of -v -ftime-report (what oes it mean)?

下面是解析器"还是扩展"模板的使用?

In the following, is "parser" or "expand" the use of templates?

Execution times (seconds)
  callgraph construction:   0.06 ( 2%) usr   0.00 ( 0%) sys   0.09 ( 2%) wall    3181 kB ( 1%) ggc
  callgraph optimization:   0.05 ( 2%) usr   0.00 ( 0%) sys   0.05 ( 1%) wall    5243 kB ( 2%) ggc
  cfg cleanup           :   0.02 ( 1%) usr   0.00 ( 0%) sys   0.02 ( 0%) wall      11 kB ( 0%) ggc
  df live regs          :   0.01 ( 0%) usr   0.00 ( 0%) sys   0.01 ( 0%) wall       0 kB ( 0%) ggc
  df reg dead/unused notes:   0.03 ( 1%) usr   0.00 ( 0%) sys   0.03 ( 1%) wall    1993 kB ( 1%) ggc
  register information  :   0.04 ( 1%) usr   0.00 ( 0%) sys   0.04 ( 1%) wall       0 kB ( 0%) ggc
  alias analysis        :   0.01 ( 0%) usr   0.00 ( 0%) sys   0.01 ( 0%) wall     450 kB ( 0%) ggc
  rebuild jump labels   :   0.03 ( 1%) usr   0.00 ( 0%) sys   0.03 ( 1%) wall       0 kB ( 0%) ggc
  preprocessing         :   0.12 ( 4%) usr   0.06 (12%) sys   1.46 (27%) wall    2752 kB ( 1%) ggc
  parser                :   0.67 (21%) usr   0.15 (29%) sys   0.89 (16%) wall   91749 kB (36%) ggc
  name lookup           :   0.15 ( 5%) usr   0.12 (24%) sys   0.24 ( 4%) wall   14384 kB ( 6%) ggc
  inline heuristics     :   0.03 ( 1%) usr   0.00 ( 0%) sys   0.03 ( 1%) wall       0 kB ( 0%) ggc
  tree gimplify         :   0.06 ( 2%) usr   0.01 ( 2%) sys   0.09 ( 2%) wall   15992 kB ( 6%) ggc
  tree eh               :   0.02 ( 1%) usr   0.01 ( 2%) sys   0.03 ( 1%) wall    4405 kB ( 2%) ggc
  tree CFG construction :   0.01 ( 0%) usr   0.01 ( 2%) sys   0.03 ( 1%) wall    6636 kB ( 3%) ggc
  tree CFG cleanup      :   0.02 ( 1%) usr   0.01 ( 2%) sys   0.02 ( 0%) wall      15 kB ( 0%) ggc
  tree find ref. vars   :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.00 ( 0%) wall    1870 kB ( 1%) ggc
  tree SSA rewrite      :   0.01 ( 0%) usr   0.00 ( 0%) sys   0.01 ( 0%) wall    2357 kB ( 1%) ggc
  tree SSA other        :   0.00 ( 0%) usr   0.01 ( 2%) sys   0.00 ( 0%) wall      37 kB ( 0%) ggc
  tree operand scan     :   0.01 ( 0%) usr   0.04 ( 8%) sys   0.06 ( 1%) wall    6340 kB ( 2%) ggc
  tree SSA to normal    :   0.05 ( 2%) usr   0.00 ( 0%) sys   0.05 ( 1%) wall      95 kB ( 0%) ggc
  dominance computation :   0.04 ( 1%) usr   0.00 ( 0%) sys   0.04 ( 1%) wall       0 kB ( 0%) ggc
  expand                :   0.60 (18%) usr   0.03 ( 6%) sys   0.71 (13%) wall   45557 kB (18%) ggc
  varconst              :   0.02 ( 1%) usr   0.00 ( 0%) sys   0.02 ( 0%) wall    3532 kB ( 1%) ggc
  jump                  :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.00 ( 0%) wall    1745 kB ( 1%) ggc
  mode switching        :   0.01 ( 0%) usr   0.00 ( 0%) sys   0.01 ( 0%) wall       0 kB ( 0%) ggc
  integrated RA         :   0.35 (11%) usr   0.00 ( 0%) sys   0.35 ( 6%) wall    5259 kB ( 2%) ggc
  reload                :   0.29 ( 9%) usr   0.01 ( 2%) sys   0.31 ( 6%) wall    6490 kB ( 3%) ggc
  thread pro- & epilogue:   0.10 ( 3%) usr   0.01 ( 2%) sys   0.13 ( 2%) wall    4832 kB ( 2%) ggc
  final                 :   0.19 ( 6%) usr   0.01 ( 2%) sys   0.21 ( 4%) wall    2985 kB ( 1%) ggc
  symout                :   0.25 ( 8%) usr   0.01 ( 2%) sys   0.26 ( 5%) wall   27322 kB (11%) ggc
  TOTAL                 :   3.25             0.51             5.49             256741 kB

推荐答案

用 g++ 试试这些命令行选项

Try these command line options with g++

-v -ftime-报告

-v -ftime-report

这应该会为您提供有关编译过程的更多信息.罪魁祸首通常是模板.

That should give you more information on the compiling process. The culprit is usually templates though.

这篇关于c++ g++ llvm-clang 编译器分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:c++ g++ llvm-clang 编译器分析