I'm using VS Code to run Go tests along with CPU/memory profiling:
How can I download/save the graph as an image?
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 '▼'
profile.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:
$ go tool pprof -png profile.pb.gz > foo.png
$ file foo.png
foo.png: PNG image data, 1164 x 1344, 8-bit/color RGB, non-interlaced
Note that there is no need to gunzip the file.
See go tool pprof -h
for more options.