Why can't I see my own application functions i

2019-07-08 02:24发布

I'm trying to debug the performance characterics of my own program so I'm following the tutorial on the golang blog. But I have 1 small issues I can't investigate the my own functions or call in the resulting profiling output. I'm using this command to build my binary:

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

And when I use go tool pprof to examine the result I can only

(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 

As you can see a large amount of time is spend in the [brains] package, but I can't see any details of which functions like I do see for other packages! I probably doing something very stupid wrong of course so if somebody notices my mistake I would be very thankful if you point it out to me :D

ps: I'm doing the profiling on a linux environment and the analysis on my Macbook, but I think it shouldn't matter since the binary is statically build the same for both environments

Thanks,

Niels

0条回答
登录 后发表回答