Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 11 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
我结合使用了 gprof 和名为 gprof2dot 的脚本,它为您提供了调用图显示每个方法花费了多少时间。
请参阅关于 gprof 的文章。另请参阅:
使用 GProf 分析器优化 C/C++ 程序
下面是一个示例调用图,显示了每个方法所花费的时间(取自 gprof2dot 页面):
I've used a combination of gprof and a script called gprof2dot which gives you a call graph showing how much time is spent in each method.
See this article on gprof. Also take a look at:
Optimizing C/C++ programs using the GProf profiler
Here is an example call graph showing time spent in each method ( taken from the gprof2dot page):
我过去使用过 Intel 的 VTune,发现它非常有帮助。
http://software.intel.com/en-us/articles/intel- vtune/
I used Intels VTune in the past and found it very helpful.
http://software.intel.com/en-us/articles/intel-vtune/
看看
valgrind
。take a look at
valgrind
.您可以使用 Callgrind。现在它是 valgrind 项目的一部分。
它有非常好的 GUI 来查看结果:KCacheGrind
两者都适用于您的发行版。
You can use Callgrind. Now it is part of the valgrind project.
It has very nice GUI to review the results : KCacheGrind
Both are available for your distro.
我赞同 @RA 对英特尔 VTune 的推荐,因为值得一看。不要对
gprof
嗤之以鼻,它无处不在,而且是一个好的开始。您也许能够从调试器中获得您想要的信息——哪个是?如果您告诉我们您正在使用什么编译器,我们也许可以告诉您它有哪些功能可以帮助您。
I second @RA's recommendation of Intel VTune as worthy of looking at. Don't turn your nose up at
gprof
, it's ubiquitous and is a good start. You may be able to get the information you want from your debugger -- which is ?If you told us what compiler you are using, we might be able to tell you what features it has for helping you.
还有 TAU,尽管配置起来可能很痛苦,它非常强大。
There is also TAU, which although it can be a pain to configure, it is quite powerful.