【发布时间】:2013-06-04 10:16:17
【问题描述】:
我正在使用gprof 计算每个函数在执行我的程序期间所花费的时间。
上周我注意到当 CPU 使用率达到 100% 时,程序甚至无法启动!
- 代码运行了将近一天,没有任何变化。
- 在某些情况下达到 100% 的 CPU 使用率是不可避免的,特别是当我想在“
stress”工具的帮助下对我的系统施加压力并在它使用最大资源量的同时测试程序时:@ 987654321@
我已阅读该主题:
并阅读 Mike Dunlavey 的 回复:
如果问题没有那么本地化呢?那些不重要吗? 不要对从未声称过的 gprof 寄予厚望。它 只是一种测量工具,而且仅限于 CPU 密集型操作。
还有 Norman Ramsey 的回复获得高分:
Valgrind has an instruction-count profiler with a very nice visualizer called KCacheGrind. As Mike Dunlavey recommends, Valgrind counts the fraction of instructions for which a procedure is live on the stack, although I'm sorry to say it appears to become confused in the presence of mutual recursion. But the visualizer is very nice and light years ahead of gprof.
但是由于线程已关闭,因为非建设性的,我想知道这是否是遵循的好方向
提前致谢
附:在使用谷歌搜索时,我在提出诸如
之类的问题时没有找到相关内容“为什么当 cpu 达到 100 % 时 gprof 不起作用”
提前致谢
【问题讨论】: