使用标志编译后:GCC 上的 -O0 -p -pg -Wall -c
和 MinGW 链接器上的 -p -pg
,用于显示的 eclipse 插件 gprof没有结果。之后,我使用 gprof my.exe gmon.out > prof.txt
进行了 cmd 调用,结果生成了一份仅包含函数调用次数的报告。
Flat profile:
Each sample counts as 0.01 seconds.
no time accumulated
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 16000 0.00 0.00 vector_norm
0.00 0.00 0.00 16 0.00 0.00 rbf_kernel
0.00 0.00 0.00 8 0.00 0.00 lubksb
我遇到过这个主题:gprof reports no time accumulated 。但我的程序正在以明确的方式终止。另外,gprof view show no data on MingW/Windows ,但我使用的是 32 位 GCC。我之前尝试过使用 Cygwin,结果相同。
我使用的是带有 CDT 版本 8.3.0.201402142303 的 eclipse Kepler 和带有 GCC 5.4.0 的 MinGW。
感谢您的帮助,提前谢谢您。
最佳答案
抱歉问这个问题,代码似乎比 gprof 测量的速度要快。
由于我的应用程序涉及经过多次迭代和进一步测试内核的神经网络训练,因此我并不怀疑快速代码可能会导致问题。我在主体中插入了一个长循环,并打印了 gprof 时间。
关于c - 报告显示使用 Eclipse CDT 的 gprof 为 "no time accumulated",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38481261/