如何解释Google perf工具中的地址CPU分析器 [英] How to interpret addresses in Google perf tools CPU profiler

查看:295
本文介绍了如何解释Google perf工具中的地址CPU分析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的C ++程序消耗了大量的CPU,更多的是它运行。我使用Google Performance Tools分析CPU使用情况,这是我得到的:

 (pprof)top 
:1343 samples
1330 99.0%99.0%1330 99.0%0x0000000801dcb11c
7 0.5%99.6%7 0.5%0x0000000801dcb11e
4 0.3%99.9%4 0.3%program :: threadWorker
1 0.1%99.9%1 0.1%0x0000000801dcb110
1 0.1%100.0%1 0.1%0x00007ffffffffcc0

但是,这里显示的5个进程中只有1个是实际的函数名;其余都是地址。我如何知道这些地址是什么? (当然,我对上面显示的第一个地址感兴趣)



编辑:这是我运行分析器的方法:

  env CPUPROFILE = prof.out ./a.out 
[kill程序]

pprof ./a.out prof.out

此外,我通过代码检查找到根本原因。

解决方案

这是可能你避免了


$ b




> $ google-pprof executable /tmp/executable.hprof --text |少

,可以看到函数名称很好。或者,当您运行google-pprof?


时,那些方法是否在您的路径中的某些共享库中

My C++ program is consuming a lot of CPU, and more so as it runs. I used Google Performance Tools to profile CPU usage, and this is what I got:

(pprof) top
Total: 1343 samples
    1330  99.0%  99.0%     1330  99.0% 0x0000000801dcb11c
       7   0.5%  99.6%        7   0.5% 0x0000000801dcb11e
       4   0.3%  99.9%        4   0.3% program::threadWorker
       1   0.1%  99.9%        1   0.1% 0x0000000801dcb110
       1   0.1% 100.0%        1   0.1% 0x00007fffffffffc0

However, only 1 out of the 5 processes shown here is an actual function name; the rest are addresses. How can I find out what these addresses pertain to? (Of course, I am most interested in the first address shown above)

Edit: This is how I ran the profiler:

env CPUPROFILE=prof.out ./a.out
[kill program]

pprof ./a.out prof.out

Also, I found the root cause by code inspection. But it would still be nice to have the profiler pinpoint the culprit function rather than an address.

解决方案

Is it possible you haven't specified the executable when loading the results in google-pprof?

I run it as:

$ google-pprof executable /tmp/executable.hprof --text | less

and can see the function names just fine. Or that those methods are in some shared library not in your path when you run google-pprof?

这篇关于如何解释Google perf工具中的地址CPU分析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆