dongmei9508 2014-03-05 08:31
浏览 369
已采纳

为什么`go pprof`工具显示地址而不是函数名称?

$ go tool pprof pgears.go profilefile.prof
addr2line: crackhdr: unknown header type
Welcome to pprof!  For help, type 'help'.
(pprof) top
Total: 8 samples
       5  62.5%  62.5%        5  62.5% 0000000000028a8b
       1  12.5%  75.0%        1  12.5% 000000000002295c
       1  12.5%  87.5%        1  12.5% 000000000009375a
       1  12.5% 100.0%        1  12.5% 00000000000d278a
       0   0.0% 100.0%        1  12.5% 000000000000252a
       0   0.0% 100.0%        1  12.5% 000000000000259d
       0   0.0% 100.0%        2  25.0% 0000000000017d9e
       0   0.0% 100.0%        2  25.0% 000000000001a2bf
       0   0.0% 100.0%        6  75.0% 000000000001b630
       0   0.0% 100.0%        1  12.5% 0000000000045401
(pprof)

Why go tool pprof shows addresses instead of function names? from http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html or http://blog.golang.org/profiling-go-programs We know it must be function name.

Or how can I change the byte information to function name?

Operation System: Mac OS 10.9.2
Go Version: go1.2 darwin/amd64

  • 写回答

2条回答 默认 最新

  • doujia9833 2014-03-05 09:52
    关注

    The first argument to pprof must be a binary, not a source file.

    So you must compile the binary:

    $ go build -o ppears
    

    and use it as the input to pprof:

    $ go tool pprof pgears
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 运筹学中在线排序的时间在线排序的在线LPT算法
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧