Commit 2e0868b
committed
ui: add Heap Dump Explorer diff feature with palette-modulated flamegraph
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: I61f8e5e7f9988a89a7fd861b2e68ff99225685101 parent 840992f commit 2e0868b
52 files changed
Lines changed: 8300 additions & 552 deletions
File tree
- docs/heap_diff
- screenshots
- cross_trace
- tools/heap_dump_diff_test_app
- ui/src
- components
- plugins/com.android.HeapDumpExplorer
- baseline
- diff
- views
- diff
- overview
- test
- widgets
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
808 | 808 | | |
809 | 809 | | |
810 | 810 | | |
811 | | - | |
| 811 | + | |
812 | 812 | | |
813 | 813 | | |
814 | 814 | | |
| |||
23159 | 23159 | | |
23160 | 23160 | | |
23161 | 23161 | | |
23162 | | - | |
23163 | | - | |
| 23162 | + | |
| 23163 | + | |
23164 | 23164 | | |
23165 | 23165 | | |
23166 | 23166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
0 commit comments