Skip to content

Confused about flamegraph generation #73

Open

Description

@waiting-for-dev

Hi,

I've been trying to generate a flamegraph with stackprof.

First, I've been following what it seems the recommended way, because it is documented in the README:

stackprof --flamegraph tmp/stackprof-cpu-myapp.dump > tmp/flamegraph
`stackprof --flamegraph-viewer=tmp/flamegraph`

However, this always resulted in a web page that got unresponsive due to what it seems excessive javascript processing. I had to increase interval option to unacceptable values to generate a very small flamegraph file which could be processed by the browser (and even that way the graphic was very small, unreadable).

Then, digging a bit I found out there is another way to generate the flamegraph, which, if I'm not wrong, uses a https://github.com/brendangregg/FlameGraph tool (which is included in stackprof in vendor directory):

stackprof --stackcollapse tmp/stackprof-cpu-myapp.dump > tmp/flamegraph
stackprof-flamegraph.pl flamegraph > tmp/flamegraph.svg
firefox tmp/flamegraph.svg

This solution, even if does not render any legend and it is just the svg without any js, works really well.

Do you think that, at least for now, this should be the recommended way? I don't mind submitting a request with an update to the README file.

Thanks for your work in this awesome gem :)

Activity

  1. tmm1 commented on Oct 19, 2016

    @tmm1
    Owner

    The JavaScript flamegraph is preferred, since its interactive and has more details. You should be able to zoom in and out.

    What browser are you using?

    @aroben Maybe your perf patches to flamegraph.js would help here?

  2. waiting-for-dev commented on Oct 19, 2016

    @waiting-for-dev
    Author

    Thanks for your response. I tried with both firefox and chrome in debian.

  3. aroben commented on Oct 19, 2016

    @aroben
    Collaborator

    I'm actually working on a branch right now that replaces the current SVG/D3 Flamegraph viewer with one based on <canvas>. It's far more responsive than the current viewer for large profiles. I'm hoping to get a PR opened up in the next day or two with the new implementation.

  4. waiting-for-dev commented on Oct 19, 2016

    @waiting-for-dev
    Author

    Very happy to hear that :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions