Right now, I profile Go applications using go tool pprof like this:
go tool pprof http://localhost:8080/debug/pprof/profile
I want to use the pprof tool on an arbitrary Go process which is running a http server on an unknown port. The only information I have about the process is its PID. I need to do one of two things:
- Get the Go processes port number from its PID.
- Profile the running process directly. For example, something like
go tool pprof 10303
where the PID is 10303.
Would either of these work?