Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Golang profiler cannot find source code

Tags:

profiling

go

I've included the net/http/pprof package in my code. I can then comfortably run the pprof profiler (on Debian):

go tool pprof http://localhost:9000/debug/pprof/profile

Commands such as top10 or even generating call graphs work as expected. However, as soon as I try to go into a function, it fails:

(pprof) list MyFunc
No source information for mypkg.MyFunc

My GOPATH is set to my project's directory. Do I need any special flags or environment variables while building my source code or while running pprof?

like image 975
Oliver Avatar asked May 03 '15 18:05

Oliver


1 Answers

Found the answer with the help of the golang-nuts people. I needed to specify the binary:

go tool pprof mybinary http://localhost:9000/debug/pprof/profile

This way the source code is found and can be listed with the "list" command.

like image 63
Oliver Avatar answered Sep 27 '22 21:09

Oliver