DNS: ui: Heap Dump Explorer diffing#5826
Open
zezeozue wants to merge 1 commit into
Open
Conversation
151da1a to
17526b3
Compare
Member
|
Wow exciting stuff! I'd love to test this but CI build seems to be failing. Will take a look immediately after the bot gives me a build! |
…raph
Adds a baseline-vs-current diff mode to the Heap Dump Explorer with
per-tab diff views (Overview, Classes, Objects, Dominators, Bitmaps,
Strings, Arrays) and a same-trace flamegraph diff that paints each
node by Δ direction *while preserving the standard per-name palette
hue* — grew nodes saturate and darken, shrunk nodes lighten and
desaturate towards the background, unchanged nodes stay neutral, and
new nodes pop with a small saturation boost. The natural pprof-style
palette is intact so users see colour continuity between diff and
non-diff modes.
Both same-trace (two heap_graph snapshots in one .pftrace) and
cross-trace (separate primary + baseline .hprof or .pftrace files)
workflows are supported.
Changes vs. the upstream heap_diff branch (zezeozue/heap_diff):
- Fix engine-identity comparison in heap_dump_page.ts and
baseline/state.ts. Trace.engine returns a fresh per-access proxy via
createTraceProxy, so `getActiveBaseline()?.trace.engine === engine`
is always false and the same-trace flamegraph diff path never fired.
Use the stable `disposable === false` flag instead.
- Update header.ts to the new SegmentedButtons children-based API
(selectedValue + SegmentedButton vnodes) — the upstream branch was
written against the old `options:` prop and produced a runtime
error.
- Replace the absolute hsl(0, ...) / hsl(220, ...) red/blue diff
colouring with palette-modulated colours so each class keeps its
natural pprof-style hue and we only modulate saturation/lightness
to encode direction. Implemented in
ui/src/widgets/flamegraph.ts (new modulatePaletteScheme helper +
extended getColorSchemeFromHint signature) with the SQL emitting
'palette:DIR[:INTENSITY]' hints.
- Add tools/heap_dump_diff_test_app/HeapDumpDiffTest.java: a real
Java app that builds a deep, branchy Android-app-shaped object
graph (Application → ActivityManager → Activity → … → byte[]) and
captures two .hprof snapshots via HotSpotDiagnosticMXBean.dumpHeap
for the cross-trace diff workflow.
- Add tools/heap_dump_diff_test_app/build_rich_fixture.py: textproto
generator for the synthetic two-snapshot fixture used by the
same-trace flamegraph diff test.
- Add docs/heap_diff/{README.md,screenshots/}: end-to-end screenshots
of every diff tab and the primary-dump popup, captured against the
rich fixture and against real JVM hprofs (cross-trace screenshots
under cross_trace/).
Rebased onto current upstream/main so both the new
'Default to Heapdump Explorer' callout and the diff feature work
together.
Change-Id: I61f8e5e7f9988a89a7fd861b2e68ff9922568510
17526b3 to
2e0868b
Compare
🎨 Perfetto UI Builds
|
matteozanettii
approved these changes
May 12, 2026
matteozanettii
left a comment
There was a problem hiding this comment.
Suggestion: the checks may have failed due to the the file's size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a baseline-vs-current diff mode to the Heap Dump Explorer, introducing per-tab diff views (Overview, Classes, Objects, Dominators, Bitmaps, Strings, Arrays). This supports both same-trace workflows (multiple snapshots in one file) and cross-trace workflows (separate primary and baseline files).
A key feature is the same-trace flamegraph diff, which paints each node by its Δ direction while preserving the standard per-name palette hue. Grown nodes saturate and darken, shrunk nodes lighten and desaturate, unchanged nodes stay neutral, and new nodes receive a saturation boost. This ensures natural pprof-style color continuity between diff and non-diff modes rather than relying on absolute red/blue diff coloring.