我 gprof
用来计算每个函数在执行程序期间花费的时间。
上周我注意到当 CPU 使用率达到 100% 时,程序甚至无法启动!
- 代码运行了将近一天,没有任何改变。
- 在某些情况下,CPU 使用率达到 100% 是不可避免的,特别是当我想在使用最大资源的同时对系统施加压力并测试程序时,借助“
stress
”工具:http://weather.ou .edu/~apw/projects/stress/
我已阅读主题:
并阅读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
.
但是由于线程已关闭,因此非建设性的,我想知道这是否是遵循的好方向
提前致谢
PS在使用谷歌搜索时,我在问问题时没有找到相关的东西
“为什么当 cpu 达到 100% 时 gprof 不起作用”
提前致谢