c++ g++ llvm-clang compiler profiling

前端 未结 2 1163
南旧
南旧 2020-12-30 06:22

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 ho

相关标签:
2条回答
  • 2020-12-30 06:46

    Try these command line options with g++

    -v -ftime-report

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

    0 讨论(0)
  • 2020-12-30 06:46

    For preprocessing line a bit longer suggestion:

    " 0.12 ( 4%) usr 0.06 (12%) sys 1.46 (27%) wall " - this line says, that preprocessing was to do small job on CPU itself (0.12), but is uses system calls rather heavy (0.06 or 50% of user CPU time) and the most time was wasted not on CPU (1.46 real time >> 0.18 s cpu time). So This time was wasted in waiting an I/O operation OR waiting for CPU on busy system. Was this run the only working program on the machine?

    For I/O you can do: add noatime to fs to lower number of I/O reqs, buy faster (in terms of lower seek time or higher IO rate) HDD, move clang sources to SSD or even RAM-drive (loop-device). And you can't do a defragment, because it is linux.

    For meaning of eash pass, use http://gcc.gnu.org/onlinedocs/gccint/Passes.html#Passes

    0 讨论(0)
提交回复
热议问题