pprof icon indicating copy to clipboard operation
pprof copied to clipboard

[feature] Differential flamegraph

Open timpalpant opened this issue 4 years ago • 3 comments

What version of pprof are you using?

master (236ed259b199815a270edb9f8702bd0102e2e8fa)

What operating system and processor architecture are you using?

OS X 10.14, x86_64

What did you do?

I was hoping to visualize the differences between two profiles as a differential flamegraph with something like:

go run github.com/google/pprof -http localhost:8080 -diff_base A.pb.gz B.pb.gz

What did you expect to see?

A flamegraph with colors that indicate relative changes between the two profiles.

What did you see instead?

Nothing, the flamegraph view errors out with TypeError: null is not an object (evaluating 'd.c') in flamegraph:6021.

The other view types (e.g. Top, Graph, Peek) seem to work and display percent differences/colors. I haven't looked into how difficult it would be but am interested if you would consider a patch to this effect.

timpalpant avatar Sep 19 '19 21:09 timpalpant

This is a good feature request. It's a bit tricky for two reasons.

First, pprof represents profile comparison by subtracting one profile from the other; flame graphs don't really work with negative values -- to show the diff, one would have to take pprof's profile representation, separate out the samples in the main and diff profile, and then create the flame graph showing the profile comparison using the separated main and diff profile.

Next, pprof's wed UI does not currently have tests (https://github.com/google/pprof/issues/208). Since any change to show diffs in the flame graph would likely involve large changes to the web UI, it would be nice to get continuous testing for the web UI set up first.

nolanmar511 avatar Sep 19 '19 22:09 nolanmar511

We don't plan to work on the feature any time soon, volunteers are welcome :)

aalexand avatar Nov 22 '19 19:11 aalexand

Perhaps we could solve this by outputting folded stacks format, then using FlameGraph toolkit's profile diffing: #658

mhansen avatar Oct 09 '21 22:10 mhansen