简体   繁体   中英

Go pprof not working properly

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?

对于使用自制软件的 Mac 上遇到此问题的任何人:

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

Ubuntu 的另一种选择

$ sudo apt install graphviz

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM