为什么我不能在golang的pprof中看到自己的应用程序功能

时间:2016-02-01 19:52:29

标签: go profiling pprof

我正在尝试调试自己程序的性能特征,因此我正在遵循golang blog上的教程。但我有一个小问题我无法调查我自己的函数或调用生成的分析输出。我正在使用此命令构建我的二进制文件:

go build -ldflags "-s -extldflags -static" -a -installsuffix cgo -o bin/brains

当我使用go tool pprof检查结果时我只能

(pprof) top10 -cum
2.38mins of 5.25mins total (45.32%)
Dropped 125 nodes (cum <= 0.03mins)
Showing top 10 nodes out of 82 (cum >= 0.81mins)
      flat  flat%   sum%        cum   cum%
  0.33mins  6.24%  6.24%   4.82mins 91.69%  encoding/xml.(*printer).marshalStruct
  0.77mins 14.62% 20.86%   4.07mins 77.51%  [brains]
  0.04mins  0.79% 21.64%   1.92mins 36.50%  encoding/xml.(*printer).writeEnd
  0.12mins  2.24% 23.88%   1.47mins 28.06%  encoding/xml.(*Decoder).unmarshal
  0.31mins  5.83% 29.71%   1.27mins 24.14%  github.com/aws/aws-sdk-go/vendor/github.com/jmespath/go-jmespath.(*Parser).nud
  0.02mins  0.41% 30.12%   1.07mins 20.43%  golang.org/x/net/html.parseForeignContent
  0.52mins  9.89% 40.00%   0.98mins 18.64%  golang.org/x/net/html.render1
  0.15mins  2.76% 42.77%   0.95mins 18.01%  github.com/aws/aws-sdk-go/vendor/github.com/jmespath/go-jmespath.(*Parser).parseMultiSelectHash
  0.10mins  2.00% 44.77%   0.83mins 15.86%  golang.org/x/net/html.initialIM
  0.03mins  0.55% 45.32%   0.81mins 15.42%  golang.org/x/net/html.beforeHeadIM 

正如你可以看到[brains]包中花费了大量时间,但是我看不到像其他包那样的功能的任何细节! 我当然可能做了一些非常愚蠢的错误,所以如果有人注意到我的错误,如果你指出我就会非常感激:D

ps:我正在对Linux环境进行分析并对我的Macbook进行分析,但我认为这并不重要,因为二进制文件在两种环境中静态构建相同

谢谢,

尼尔斯

0 个答案:

没有答案