I’m using VS Code to run Go tests along with CPU/memory profiling:
Question
How can I download/save the graph as an image?
Tried
I downloaded the result as a *.gz
file:
Then I used these commands to convert the *.gz
file to an image. But I’m getting errors:
dot -Tpng -Gdpi=1024 profile.pb.gz > profile.pb.gz.png
Error: profile.pb.gz: syntax error in line 1 near '▼'
Also:
dot -Tpng profile.pb.gz -o profile.pb.gz.png
Error: profile.pb.gz: syntax error in line 1 near '▼'
2
Answers
These steps might work, but not been tried yet:
*.gz
file by VS Code UI.*.gz
file and get a*.pb
file.*.pb
file by this repository: https://github.com/google/pprofprofile.pb.gz contains (compressed) profiling data. It has nothing to do with Graphviz.
Go includes the pprof tool to extract information from this data in various formats, including PNG, GIF, or SVG encoded images:
Note that there is no need to gunzip the file.
See
go tool pprof -h
for more options.