英文:
Go pprof not working properly
问题
我正在尝试让pprof与Golang一起工作。
--text 似乎可以正常工作,但大多数其他选项都无法正常工作。
例如,使用 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#
使用 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#
我需要在Go中进行一些更改才能使其正常工作吗?
英文:
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?
答案1
得分: 91
对于在 Mac 上使用 Homebrew 的任何人遇到这个问题:
brew install graphviz
英文:
For anyone on a Mac using homebrew that comes across this question:
brew install graphviz
答案2
得分: 64
你需要安装 dot
和 gv
。我看到你正在使用Ubuntu,只需尝试运行 apt-get install graphviz gv
。
英文:
You need dot
and gv
installed. I see you're using Ubuntu, just try apt-get install graphviz gv
答案3
得分: 1
在Windows 10上遇到了类似的错误。我通过从这里https://graphviz.org/download/安装graphviz来解决它。之后我重新启动了我的IDE,执行了pdf和png命令,一切都正常工作了。
英文:
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
答案4
得分: 0
Ubuntu的另一种选择
$ sudo apt install graphviz
英文:
An alternative option for Ubuntu
$ sudo apt install graphviz
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论