skip to Main Content

I’m using VS Code to run Go tests along with CPU/memory profiling:

Screenshot

Question

How can I download/save the graph as an image?

Tried

I downloaded the result as a *.gz file:

Screenshot: *.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


  1. Chosen as BEST ANSWER

    These steps might work, but not been tried yet:

    1. Download a *.gz file by VS Code UI.
    2. Extract the *.gz file and get a *.pb file.
    3. Work with the *.pb file by this repository: https://github.com/google/pprof

  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search