google / pprof

pprof is a tool for visualization and analysis of profiling data
Apache License 2.0
7.83k stars 604 forks source link

[feature] Differential flamegraph #483

Open timpalpant opened 4 years ago

timpalpant commented 4 years ago

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.

nolanmar511 commented 4 years ago

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.

aalexand commented 4 years ago

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

mhansen commented 2 years ago

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