我使用 GNU gprof 2.15.94.0.2.2 对我的 C++ 程序进行性能分析,该程序具有较大的调用周期。我希望在调用图输出中看到类似下面的内容 gprof's documentation indicates :
index % time self children called name
----------------------------------------
1.77 0 1/1 main [2]
[3] 91.71 1.77 0 1+5 <cycle 1 as a whole> [3]
1.02 0 3 b <cycle 1> [4]
0.75 0 2 a <cycle 1> [5]
0 0 6/6 c [6]
----------------------------------------
但是,我的 <cycle as a whole>
都没有条目列出了所有来电者。他们都是这样的:
index % time self children called name
----------------------------------------------
[8] 65.6 259.55 5342.63 9334767+60122608 <cycle 2 as a whole> [8]
133.28 2051.45 12043564+74015448 foo <cycle 2> [14]
18.90 976.38 2379645 bar <cycle 2> [21]
...
-----------------------------------------------
由于我的周期很大,很难通过周期中的各个函数跟踪调用者。
谁能告诉我为什么循环调用者在输出中丢失,以及如何让它们出现?
最佳答案
您的应用程序是否使用多线程? gprof 根本不适用于线程。否则,您很可能遇到了 gprof 中的错误。它漏洞百出且已过时。最好使用 oprofile 或 valgrind 之类的东西。
关于c++ - 为什么循环摘要在 gprof 的调用图输出中没有任何调用者?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/838425/