在GO中进行性能分析 – 无符号

huangapple go评论81阅读模式
英文:

Profiling in GO - No symbols

问题

我正在尝试使用这里描述的过程来分析一个GO程序:

http://blog.golang.org/2011/06/profiling-go-programs.html

然而,pprof在输出中显示的是地址而不是函数名:

(pprof) top10
总共:2113个样本
     298  14.1%  14.1%      298  14.1% 0000000000464d34
     179   8.5%  22.6%      179   8.5% 0000000000418e83
     157   7.4%  30.0%      157   7.4% 0000000000418e60
     112   5.3%  35.3%      112   5.3% 0000000000403293
     101   4.8%  40.1%      101   4.8% 0000000000464d4f
      83   3.9%  44.0%       83   3.9% 000000000040329c
      77   3.6%  47.7%       77   3.6% 0000000000418e7a
      62   2.9%  50.6%       62   2.9% 0000000000456a38
      37   1.8%  52.3%       37   1.8% 0000000000418e41
      37   1.8%  54.1%       37   1.8% 0000000000435f57

有人遇到过这个问题并找到了解决方法吗?

这里提到了一个6prof工具,可以用来替代上述过程。有人知道它是否仍在维护,并且在哪里可以找到它吗?

我在Win7 64位上使用go1.0.2。

谢谢!

英文:

I'm trying to profile a GO program using the procedure described here:

http://blog.golang.org/2011/06/profiling-go-programs.html
.

However pprof shows addresses instead of function names in output:

(pprof) top10
Total: 2113 samples
     298  14.1%  14.1%      298  14.1% 0000000000464d34
     179   8.5%  22.6%      179   8.5% 0000000000418e83
     157   7.4%  30.0%      157   7.4% 0000000000418e60
     112   5.3%  35.3%      112   5.3% 0000000000403293
     101   4.8%  40.1%      101   4.8% 0000000000464d4f
      83   3.9%  44.0%       83   3.9% 000000000040329c
      77   3.6%  47.7%       77   3.6% 0000000000418e7a
      62   2.9%  50.6%       62   2.9% 0000000000456a38
      37   1.8%  52.3%       37   1.8% 0000000000418e41
      37   1.8%  54.1%       37   1.8% 0000000000435f57

Has anyone experienced that and found a fix?

There is a mention here of a 6prof tool to be used in alternative to the procedure described above. Does anyone know if it's still maintained and where to find it?

I'm using go1.0.2 on Win7 64.

Thanks!

答案1

得分: 2

我修复了Perl脚本,使其在Windows下工作。

详细信息请参阅:http://exneehilo.blogspot.com.au/2012/07/profiling-go-with-pprof-under-windows.html

英文:

I fixed the perl script to work under Windows.

Details here: http://exneehilo.blogspot.com.au/2012/07/profiling-go-with-pprof-under-windows.html

答案2

得分: 0

我自己还没有检查过,但据我记得,pprof脚本的问题是它使用了标准(mingw)版本的nm,而不是Go特定的nm。Go发行版有自己的nm程序:

C:>go tool nm
usage: nm [-aghnsTu] file ...
go tool nm: exit status 1

C:>

它可以理解所有Go二进制格式,而mingw附带的nm程序则不行。在pprof perl脚本中查找nm_commands变量。它列出了几个可能的候选项,但没有一个是你想要的。如果你将其更改为指向Go的nm,应该可以工作。

请随时在这里报告错误http://code.google.com/p/go/issues。我认为它曾经可以工作,因为nm_commands中列出了6nm,但Go的nm已经被重命名为nm并移出了用户路径。

Alex

英文:

I haven't checked it myself, but as far as I remember, the problem with pprof script is that it uses standard (mingw) version of nm, instead of Go specific nm. Go distro has its own nm program:

C:>go tool nm
usage: nm [-aghnsTu] file ...
go tool nm: exit status 1

C:>

that understands all Go binary formats, while nm program that comes with mingw does not. Look inside pprof perl script for nm_commands variable. It lists couple of possible candidates, but none of them is what you want. If you change that to point to Go nm instead, it should work.

Feel free to report bug here http://code.google.com/p/go/issues. I think it used to work, because 6nm is listed in nm_commands, but Go nm has been renamed to just nm and moved out of user PATH.

Alex

答案3

得分: 0

我遇到了类似的问题。

解决方法是在实际构建应用程序时。所以当我使用"go build test_app.go"构建,然后运行"./test_app",然后我得到了正确的包含函数名称的分析文件。

英文:

I had similar problem.

Solution was in actual building application. So when I build with "go build test_app.go" and than run "./test_app" And after that I got right profiling file with function names in it.

huangapple
  • 本文由 发表于 2012年7月24日 22:49:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/11633468.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定