I'm trying to get pprof working with Golang.
--text seems to work fine but most of other options does not work.
For instance with pdf:
root@ubuntu:/home/user/IdeaProjects/go_projects/src# go tool pprof --pdf ./src /tmp/profile578584736/cpu.pprof > out.pdf
sh: 1: dot: not found
root@ubuntu:/home/user/IdeaProjects/go_projects/src#
With gv:
root@ubuntu:/home/user/IdeaProjects/go_projects/src# go tool pprof --gv ./src /tmp/profile578584736/cpu.pprof
sh: 1: dot: not found
gv -scale 0
Can't exec "gv": No such file or directory at /usr/local/go/pkg/tool/linux_386/pprof line 719.
root@ubuntu:/home/user/IdeaProjects/go_projects/src#
Is there something that I need to change in Go to get it working?
pprof is a tool for visualization and analysis of profiling data. pprof reads a collection of profiling samples in profile. proto format and generates reports to visualize and help analyze the data. It can generate both text and graphical reports (through the use of the dot visualization package).
Pprof interprets and displays profiles of Go programs. Basic usage: go tool pprof binary profile. For detailed usage information: go tool pprof -h. For an example, see https://blog.golang.org/profiling-go-programs.
To check the CPU and memory usage and other profiles of a Go application at runtime, we can use `pprof` package. You can check for the following details at runtime based on the profile you chose: CPU. Memory/Heap.
For anyone on a Mac using homebrew that comes across this question:
brew install graphviz
You need dot
and gv
installed. I see you're using Ubuntu, just try apt-get install graphviz gv
Got a similar error on Windows 10. I fixed it by installing graphviz from here https://graphviz.org/download/. After that I restarted my IDE, issued the pdf and png commands and everything worked
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With