@nimblesite/lsp-profiler-ui 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/out/src/bind-host.d.ts +3 -0
- package/out/src/bind-host.js +52 -0
- package/out/src/bind-host.js.map +1 -0
- package/out/src/context-keys.d.ts +4 -0
- package/out/src/context-keys.js +54 -0
- package/out/src/context-keys.js.map +1 -0
- package/out/src/dap-evaluate.d.ts +84 -0
- package/out/src/dap-evaluate.js +442 -0
- package/out/src/dap-evaluate.js.map +1 -0
- package/out/src/dap-output.d.ts +50 -0
- package/out/src/dap-output.js +177 -0
- package/out/src/dap-output.js.map +1 -0
- package/out/src/debug/adapter-resolution.d.ts +56 -0
- package/out/src/debug/adapter-resolution.js +112 -0
- package/out/src/debug/adapter-resolution.js.map +1 -0
- package/out/src/debug/dap-messages.d.ts +18 -0
- package/out/src/debug/dap-messages.js +71 -0
- package/out/src/debug/dap-messages.js.map +1 -0
- package/out/src/debug/index.d.ts +7 -0
- package/out/src/debug/index.js +27 -0
- package/out/src/debug/index.js.map +1 -0
- package/out/src/debug/launch-config.d.ts +42 -0
- package/out/src/debug/launch-config.js +73 -0
- package/out/src/debug/launch-config.js.map +1 -0
- package/out/src/debug/launch-lifecycle.d.ts +29 -0
- package/out/src/debug/launch-lifecycle.js +40 -0
- package/out/src/debug/launch-lifecycle.js.map +1 -0
- package/out/src/debug/poll.d.ts +25 -0
- package/out/src/debug/poll.js +70 -0
- package/out/src/debug/poll.js.map +1 -0
- package/out/src/debug/profiling.d.ts +34 -0
- package/out/src/debug/profiling.js +81 -0
- package/out/src/debug/profiling.js.map +1 -0
- package/out/src/debug/testing/assertions.d.ts +27 -0
- package/out/src/debug/testing/assertions.js +111 -0
- package/out/src/debug/testing/assertions.js.map +1 -0
- package/out/src/debug/testing/dap-client.d.ts +86 -0
- package/out/src/debug/testing/dap-client.js +204 -0
- package/out/src/debug/testing/dap-client.js.map +1 -0
- package/out/src/debug/testing/index.d.ts +7 -0
- package/out/src/debug/testing/index.js +31 -0
- package/out/src/debug/testing/index.js.map +1 -0
- package/out/src/debug/testing/vscode-harness.d.ts +44 -0
- package/out/src/debug/testing/vscode-harness.js +81 -0
- package/out/src/debug/testing/vscode-harness.js.map +1 -0
- package/out/src/debug/ui-stubs.d.ts +26 -0
- package/out/src/debug/ui-stubs.js +88 -0
- package/out/src/debug/ui-stubs.js.map +1 -0
- package/out/src/debug-link-setup.d.ts +4 -0
- package/out/src/debug-link-setup.js +19 -0
- package/out/src/debug-link-setup.js.map +1 -0
- package/out/src/debug-link-view.d.ts +4 -0
- package/out/src/debug-link-view.js +49 -0
- package/out/src/debug-link-view.js.map +1 -0
- package/out/src/debug-link.d.ts +6 -0
- package/out/src/debug-link.js +95 -0
- package/out/src/debug-link.js.map +1 -0
- package/out/src/debug-selection.d.ts +14 -0
- package/out/src/debug-selection.js +33 -0
- package/out/src/debug-selection.js.map +1 -0
- package/out/src/debuggee-pause.d.ts +11 -0
- package/out/src/debuggee-pause.js +109 -0
- package/out/src/debuggee-pause.js.map +1 -0
- package/out/src/editor-path-key.d.ts +52 -0
- package/out/src/editor-path-key.js +105 -0
- package/out/src/editor-path-key.js.map +1 -0
- package/out/src/failure.d.ts +5 -0
- package/out/src/failure.js +53 -0
- package/out/src/failure.js.map +1 -0
- package/out/src/file-log-sink.d.ts +20 -0
- package/out/src/file-log-sink.js +74 -0
- package/out/src/file-log-sink.js.map +1 -0
- package/out/src/flame-html.d.ts +8 -0
- package/out/src/flame-html.js +104 -0
- package/out/src/flame-html.js.map +1 -0
- package/out/src/flame-model.d.ts +93 -0
- package/out/src/flame-model.js +242 -0
- package/out/src/flame-model.js.map +1 -0
- package/out/src/flame-script-helpers.d.ts +26 -0
- package/out/src/flame-script-helpers.js +71 -0
- package/out/src/flame-script-helpers.js.map +1 -0
- package/out/src/flame-script.d.ts +1 -0
- package/out/src/flame-script.js +332 -0
- package/out/src/flame-script.js.map +1 -0
- package/out/src/flame-time-order.d.ts +14 -0
- package/out/src/flame-time-order.js +112 -0
- package/out/src/flame-time-order.js.map +1 -0
- package/out/src/flamegraph-artifact.d.ts +9 -0
- package/out/src/flamegraph-artifact.js +45 -0
- package/out/src/flamegraph-artifact.js.map +1 -0
- package/out/src/host.d.ts +31 -0
- package/out/src/host.js +6 -0
- package/out/src/host.js.map +1 -0
- package/out/src/ids.d.ts +27 -0
- package/out/src/ids.js +63 -0
- package/out/src/ids.js.map +1 -0
- package/out/src/index.d.ts +42 -0
- package/out/src/index.js +98 -0
- package/out/src/index.js.map +1 -0
- package/out/src/logger.d.ts +50 -0
- package/out/src/logger.js +86 -0
- package/out/src/logger.js.map +1 -0
- package/out/src/memory-autopilot.d.ts +64 -0
- package/out/src/memory-autopilot.js +306 -0
- package/out/src/memory-autopilot.js.map +1 -0
- package/out/src/memory-capture-ids.d.ts +17 -0
- package/out/src/memory-capture-ids.js +45 -0
- package/out/src/memory-capture-ids.js.map +1 -0
- package/out/src/memory-capture-ingest.d.ts +15 -0
- package/out/src/memory-capture-ingest.js +84 -0
- package/out/src/memory-capture-ingest.js.map +1 -0
- package/out/src/memory-capture-legs.d.ts +4 -0
- package/out/src/memory-capture-legs.js +55 -0
- package/out/src/memory-capture-legs.js.map +1 -0
- package/out/src/memory-capture-present.d.ts +32 -0
- package/out/src/memory-capture-present.js +71 -0
- package/out/src/memory-capture-present.js.map +1 -0
- package/out/src/memory-capture-roundtrip.d.ts +17 -0
- package/out/src/memory-capture-roundtrip.js +75 -0
- package/out/src/memory-capture-roundtrip.js.map +1 -0
- package/out/src/memory-capture-state.d.ts +23 -0
- package/out/src/memory-capture-state.js +89 -0
- package/out/src/memory-capture-state.js.map +1 -0
- package/out/src/memory-capture-types.d.ts +28 -0
- package/out/src/memory-capture-types.js +70 -0
- package/out/src/memory-capture-types.js.map +1 -0
- package/out/src/memory-capture.d.ts +24 -0
- package/out/src/memory-capture.js +51 -0
- package/out/src/memory-capture.js.map +1 -0
- package/out/src/memory-dashboard-html.d.ts +3 -0
- package/out/src/memory-dashboard-html.js +327 -0
- package/out/src/memory-dashboard-html.js.map +1 -0
- package/out/src/memory-dashboard-mapping.d.ts +34 -0
- package/out/src/memory-dashboard-mapping.js +135 -0
- package/out/src/memory-dashboard-mapping.js.map +1 -0
- package/out/src/memory-dashboard.d.ts +82 -0
- package/out/src/memory-dashboard.js +142 -0
- package/out/src/memory-dashboard.js.map +1 -0
- package/out/src/memory-decorations.d.ts +61 -0
- package/out/src/memory-decorations.js +247 -0
- package/out/src/memory-decorations.js.map +1 -0
- package/out/src/memory-finalize.d.ts +25 -0
- package/out/src/memory-finalize.js +207 -0
- package/out/src/memory-finalize.js.map +1 -0
- package/out/src/memory-guidance.d.ts +14 -0
- package/out/src/memory-guidance.js +36 -0
- package/out/src/memory-guidance.js.map +1 -0
- package/out/src/memory-inspect-commands.d.ts +20 -0
- package/out/src/memory-inspect-commands.js +114 -0
- package/out/src/memory-inspect-commands.js.map +1 -0
- package/out/src/memory-launch-direct.d.ts +12 -0
- package/out/src/memory-launch-direct.js +74 -0
- package/out/src/memory-launch-direct.js.map +1 -0
- package/out/src/memory-launch.d.ts +4 -0
- package/out/src/memory-launch.js +92 -0
- package/out/src/memory-launch.js.map +1 -0
- package/out/src/memory-leak-offer.d.ts +18 -0
- package/out/src/memory-leak-offer.js +51 -0
- package/out/src/memory-leak-offer.js.map +1 -0
- package/out/src/memory-profiler.d.ts +27 -0
- package/out/src/memory-profiler.js +71 -0
- package/out/src/memory-profiler.js.map +1 -0
- package/out/src/memory-ref-graph.d.ts +62 -0
- package/out/src/memory-ref-graph.js +248 -0
- package/out/src/memory-ref-graph.js.map +1 -0
- package/out/src/memory-ref-picker.d.ts +21 -0
- package/out/src/memory-ref-picker.js +103 -0
- package/out/src/memory-ref-picker.js.map +1 -0
- package/out/src/memory-registration.d.ts +4 -0
- package/out/src/memory-registration.js +63 -0
- package/out/src/memory-registration.js.map +1 -0
- package/out/src/memory-start-core.d.ts +8 -0
- package/out/src/memory-start-core.js +165 -0
- package/out/src/memory-start-core.js.map +1 -0
- package/out/src/memory-start-stop-commands.d.ts +10 -0
- package/out/src/memory-start-stop-commands.js +75 -0
- package/out/src/memory-start-stop-commands.js.map +1 -0
- package/out/src/memory-start.d.ts +6 -0
- package/out/src/memory-start.js +13 -0
- package/out/src/memory-start.js.map +1 -0
- package/out/src/memory-status.d.ts +24 -0
- package/out/src/memory-status.js +135 -0
- package/out/src/memory-status.js.map +1 -0
- package/out/src/palette-vscode.d.ts +2 -0
- package/out/src/palette-vscode.js +50 -0
- package/out/src/palette-vscode.js.map +1 -0
- package/out/src/palette.d.ts +70 -0
- package/out/src/palette.js +150 -0
- package/out/src/palette.js.map +1 -0
- package/out/src/process-bind-panel.d.ts +11 -0
- package/out/src/process-bind-panel.js +65 -0
- package/out/src/process-bind-panel.js.map +1 -0
- package/out/src/process-commands.d.ts +5 -0
- package/out/src/process-commands.js +112 -0
- package/out/src/process-commands.js.map +1 -0
- package/out/src/process-context-keys.d.ts +11 -0
- package/out/src/process-context-keys.js +48 -0
- package/out/src/process-context-keys.js.map +1 -0
- package/out/src/process-decoration.d.ts +18 -0
- package/out/src/process-decoration.js +76 -0
- package/out/src/process-decoration.js.map +1 -0
- package/out/src/process-explorer-rows.d.ts +59 -0
- package/out/src/process-explorer-rows.js +47 -0
- package/out/src/process-explorer-rows.js.map +1 -0
- package/out/src/process-explorer.d.ts +66 -0
- package/out/src/process-explorer.js +241 -0
- package/out/src/process-explorer.js.map +1 -0
- package/out/src/process-group-item.d.ts +8 -0
- package/out/src/process-group-item.js +55 -0
- package/out/src/process-group-item.js.map +1 -0
- package/out/src/process-launch-item.d.ts +12 -0
- package/out/src/process-launch-item.js +57 -0
- package/out/src/process-launch-item.js.map +1 -0
- package/out/src/process-launch.d.ts +47 -0
- package/out/src/process-launch.js +205 -0
- package/out/src/process-launch.js.map +1 -0
- package/out/src/process-message-item.d.ts +10 -0
- package/out/src/process-message-item.js +53 -0
- package/out/src/process-message-item.js.map +1 -0
- package/out/src/process-poll.d.ts +26 -0
- package/out/src/process-poll.js +125 -0
- package/out/src/process-poll.js.map +1 -0
- package/out/src/process-reactivity.d.ts +55 -0
- package/out/src/process-reactivity.js +188 -0
- package/out/src/process-reactivity.js.map +1 -0
- package/out/src/process-registration.d.ts +11 -0
- package/out/src/process-registration.js +55 -0
- package/out/src/process-registration.js.map +1 -0
- package/out/src/process-tree-item.d.ts +18 -0
- package/out/src/process-tree-item.js +219 -0
- package/out/src/process-tree-item.js.map +1 -0
- package/out/src/processes-state.d.ts +75 -0
- package/out/src/processes-state.js +76 -0
- package/out/src/processes-state.js.map +1 -0
- package/out/src/profile-on-launch.d.ts +4 -0
- package/out/src/profile-on-launch.js +16 -0
- package/out/src/profile-on-launch.js.map +1 -0
- package/out/src/profile-server.d.ts +24 -0
- package/out/src/profile-server.js +170 -0
- package/out/src/profile-server.js.map +1 -0
- package/out/src/profiler-attach.d.ts +19 -0
- package/out/src/profiler-attach.js +129 -0
- package/out/src/profiler-attach.js.map +1 -0
- package/out/src/profiler-commands.d.ts +8 -0
- package/out/src/profiler-commands.js +110 -0
- package/out/src/profiler-commands.js.map +1 -0
- package/out/src/profiler-decorations.d.ts +74 -0
- package/out/src/profiler-decorations.js +237 -0
- package/out/src/profiler-decorations.js.map +1 -0
- package/out/src/profiler-dispose.d.ts +6 -0
- package/out/src/profiler-dispose.js +20 -0
- package/out/src/profiler-dispose.js.map +1 -0
- package/out/src/profiler-flamegraph-html.d.ts +61 -0
- package/out/src/profiler-flamegraph-html.js +366 -0
- package/out/src/profiler-flamegraph-html.js.map +1 -0
- package/out/src/profiler-format.d.ts +10 -0
- package/out/src/profiler-format.js +28 -0
- package/out/src/profiler-format.js.map +1 -0
- package/out/src/profiler-launch-cooperative.d.ts +16 -0
- package/out/src/profiler-launch-cooperative.js +167 -0
- package/out/src/profiler-launch-cooperative.js.map +1 -0
- package/out/src/profiler-launch.d.ts +29 -0
- package/out/src/profiler-launch.js +123 -0
- package/out/src/profiler-launch.js.map +1 -0
- package/out/src/profiler-results.d.ts +22 -0
- package/out/src/profiler-results.js +104 -0
- package/out/src/profiler-results.js.map +1 -0
- package/out/src/profiler-session-core.d.ts +42 -0
- package/out/src/profiler-session-core.js +116 -0
- package/out/src/profiler-session-core.js.map +1 -0
- package/out/src/profiler-state.d.ts +87 -0
- package/out/src/profiler-state.js +83 -0
- package/out/src/profiler-state.js.map +1 -0
- package/out/src/profiler-status.d.ts +38 -0
- package/out/src/profiler-status.js +163 -0
- package/out/src/profiler-status.js.map +1 -0
- package/out/src/profiler-styles.d.ts +21 -0
- package/out/src/profiler-styles.js +160 -0
- package/out/src/profiler-styles.js.map +1 -0
- package/out/src/profiler-webview.d.ts +95 -0
- package/out/src/profiler-webview.js +243 -0
- package/out/src/profiler-webview.js.map +1 -0
- package/out/src/profiler.d.ts +23 -0
- package/out/src/profiler.js +113 -0
- package/out/src/profiler.js.map +1 -0
- package/out/src/progress-ops.d.ts +24 -0
- package/out/src/progress-ops.js +135 -0
- package/out/src/progress-ops.js.map +1 -0
- package/out/src/reactive-refresh.d.ts +24 -0
- package/out/src/reactive-refresh.js +33 -0
- package/out/src/reactive-refresh.js.map +1 -0
- package/out/src/sample-summary.d.ts +39 -0
- package/out/src/sample-summary.js +32 -0
- package/out/src/sample-summary.js.map +1 -0
- package/out/src/sampled-view.d.ts +15 -0
- package/out/src/sampled-view.js +56 -0
- package/out/src/sampled-view.js.map +1 -0
- package/out/src/server-command.d.ts +4 -0
- package/out/src/server-command.js +14 -0
- package/out/src/server-command.js.map +1 -0
- package/out/src/settings.d.ts +1 -0
- package/out/src/settings.js +22 -0
- package/out/src/settings.js.map +1 -0
- package/out/src/store.d.ts +34 -0
- package/out/src/store.js +64 -0
- package/out/src/store.js.map +1 -0
- package/out/src/testing/cpu-capture-assertions.d.ts +8 -0
- package/out/src/testing/cpu-capture-assertions.js +71 -0
- package/out/src/testing/cpu-capture-assertions.js.map +1 -0
- package/out/src/testing/cpu-capture-contract.d.ts +8 -0
- package/out/src/testing/cpu-capture-contract.js +123 -0
- package/out/src/testing/cpu-capture-contract.js.map +1 -0
- package/out/src/testing/webview-contract-helpers.d.ts +24 -0
- package/out/src/testing/webview-contract-helpers.js +125 -0
- package/out/src/testing/webview-contract-helpers.js.map +1 -0
- package/out/src/testing/webview-contract-leak.d.ts +2 -0
- package/out/src/testing/webview-contract-leak.js +80 -0
- package/out/src/testing/webview-contract-leak.js.map +1 -0
- package/out/src/testing/webview-contract-memory.d.ts +5 -0
- package/out/src/testing/webview-contract-memory.js +221 -0
- package/out/src/testing/webview-contract-memory.js.map +1 -0
- package/out/src/testing/webview-contract-palette.d.ts +6 -0
- package/out/src/testing/webview-contract-palette.js +121 -0
- package/out/src/testing/webview-contract-palette.js.map +1 -0
- package/out/src/testing/webview-contract-panel.d.ts +7 -0
- package/out/src/testing/webview-contract-panel.js +100 -0
- package/out/src/testing/webview-contract-panel.js.map +1 -0
- package/out/src/testing/webview-contract-results.d.ts +6 -0
- package/out/src/testing/webview-contract-results.js +136 -0
- package/out/src/testing/webview-contract-results.js.map +1 -0
- package/out/src/testing/webview-contract.d.ts +18 -0
- package/out/src/testing/webview-contract.js +23 -0
- package/out/src/testing/webview-contract.js.map +1 -0
- package/out/src/timeouts.d.ts +21 -0
- package/out/src/timeouts.js +30 -0
- package/out/src/timeouts.js.map +1 -0
- package/out/src/trace-actions.d.ts +33 -0
- package/out/src/trace-actions.js +135 -0
- package/out/src/trace-actions.js.map +1 -0
- package/out/src/unknown-shape.d.ts +58 -0
- package/out/src/unknown-shape.js +110 -0
- package/out/src/unknown-shape.js.map +1 -0
- package/out/src/wire-adapters.d.ts +18 -0
- package/out/src/wire-adapters.js +160 -0
- package/out/src/wire-adapters.js.map +1 -0
- package/out/src/wire-generated.d.ts +760 -0
- package/out/src/wire-generated.js +38 -0
- package/out/src/wire-generated.js.map +1 -0
- package/package.json +53 -4
- package/scripts/contributions.mjs +187 -0
- package/README.md +0 -3
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildMemoryDashboardHtml = buildMemoryDashboardHtml;
|
|
4
|
+
// Implements [PROF-UI-MEMORY]. Dashboard document rendering.
|
|
5
|
+
const ids_1 = require("./ids");
|
|
6
|
+
const profiler_webview_1 = require("./profiler-webview");
|
|
7
|
+
const profiler_styles_1 = require("./profiler-styles");
|
|
8
|
+
// ── HTML builder ──────────────────────────────────────────────────────────
|
|
9
|
+
/** Build the complete dashboard HTML (exported as an e2e seam). */
|
|
10
|
+
function buildMemoryDashboardHtml(snapshot, diff) {
|
|
11
|
+
return (0, profiler_webview_1.buildWebviewDocument)({
|
|
12
|
+
title: `${(0, ids_1.brand)()} Memory Dashboard`,
|
|
13
|
+
css: buildDashboardHeadCss(),
|
|
14
|
+
body: buildDashboardBodyHtml(snapshot.heapProfilePath !== ""),
|
|
15
|
+
script: buildDashboardScriptTag(snapshot, diff),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/** The timeline, the heat mode toggle, the allocation table and the leak list. */
|
|
19
|
+
const DASHBOARD_SECTIONS_HTML = `
|
|
20
|
+
<h2>Memory Timeline</h2>
|
|
21
|
+
<div class="timeline-container">
|
|
22
|
+
<canvas class="timeline-canvas" id="timeline-canvas"></canvas>
|
|
23
|
+
<div class="crosshair-label" id="crosshair-label"></div>
|
|
24
|
+
</div>
|
|
25
|
+
<h2>Heat Map Mode</h2>
|
|
26
|
+
<div class="toggle-row">
|
|
27
|
+
<button class="toggle-btn active-mem" id="btn-mem">Memory</button>
|
|
28
|
+
<button class="toggle-btn" id="btn-cpu">CPU</button>
|
|
29
|
+
</div>
|
|
30
|
+
<h2>Top Allocations</h2>
|
|
31
|
+
<table class="data-table">
|
|
32
|
+
<thead><tr><th>Location</th><th>Size</th><th>Objects</th><th></th></tr></thead>
|
|
33
|
+
<tbody id="alloc-body"></tbody>
|
|
34
|
+
</table>
|
|
35
|
+
<div class="leak-section" id="leak-section">
|
|
36
|
+
<h2>Suspected Leaks</h2>
|
|
37
|
+
<div id="leak-list"></div>
|
|
38
|
+
</div>`;
|
|
39
|
+
// ── CSS fragments ─────────────────────────────────────────────────────────
|
|
40
|
+
/** The dashboard's layout: timeline, toggles, the allocation table and leak rows. */
|
|
41
|
+
const DASHBOARD_LAYOUT_CSS = `
|
|
42
|
+
.timeline-container { background:var(--prof-surface); border:1px solid var(--prof-border);
|
|
43
|
+
border-radius:8px; padding:12px; margin-bottom:20px; position:relative; }
|
|
44
|
+
.timeline-canvas { width:100%; height:200px; display:block; }
|
|
45
|
+
.crosshair-label { position:absolute; display:none; background:var(--prof-surface);
|
|
46
|
+
border:1px solid var(--prof-border); border-radius:4px; padding:4px 8px;
|
|
47
|
+
font-size:11px; font-family:'JetBrains Mono',monospace; pointer-events:none;
|
|
48
|
+
white-space:nowrap; z-index:5; }
|
|
49
|
+
.toggle-row { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }
|
|
50
|
+
.data-table { table-layout:fixed; }
|
|
51
|
+
.data-table td:first-child { overflow-wrap:anywhere; }
|
|
52
|
+
.data-table th:nth-child(2) { width:90px; }
|
|
53
|
+
.data-table th:nth-child(3) { width:80px; }
|
|
54
|
+
.data-table th:last-child { width:160px; }
|
|
55
|
+
.data-table td:nth-child(2), .data-table td:nth-child(3) { white-space:nowrap; }
|
|
56
|
+
.data-table td.alloc-site { color:var(--prof-text-secondary); font-size:12px; }
|
|
57
|
+
.data-table td.alloc-size { font-weight:500; }
|
|
58
|
+
@media (max-width:600px) {
|
|
59
|
+
.data-table th:last-child, .data-table td:last-child { display:none; }
|
|
60
|
+
}
|
|
61
|
+
#generation-sizes { font-size:13px; white-space:pre-line; }
|
|
62
|
+
.toggle-btn { background:var(--prof-surface); border:1px solid var(--prof-border);
|
|
63
|
+
border-radius:6px; padding:6px 14px; color:var(--prof-text); font-size:12px;
|
|
64
|
+
font-family:'Space Grotesk',-apple-system,sans-serif; cursor:pointer;
|
|
65
|
+
transition:border-color 120ms ease, color 120ms ease; }
|
|
66
|
+
.leak-section { margin-top:20px; }
|
|
67
|
+
.leak-row { display:flex; align-items:center; gap:10px; padding:10px 12px;
|
|
68
|
+
background:var(--prof-surface); border:1px solid var(--prof-border);
|
|
69
|
+
border-radius:6px; margin-bottom:8px; cursor:pointer;
|
|
70
|
+
transition:border-color 120ms ease; }
|
|
71
|
+
.leak-info { flex:1; font-size:13px; font-family:'JetBrains Mono',monospace; }
|
|
72
|
+
.leak-info .leak-file { color:var(--prof-text-secondary); font-size:12px; }
|
|
73
|
+
.leak-info .leak-reason { font-family:'Space Grotesk',-apple-system,sans-serif;
|
|
74
|
+
font-size:11px; color:var(--prof-text-secondary); margin-top:2px; }
|
|
75
|
+
.empty-state { color:var(--prof-text-secondary); font-size:13px;
|
|
76
|
+
padding:16px; text-align:center; }`;
|
|
77
|
+
/** Every accent the dashboard draws, from the host palette ([PROF-UI-PALETTE]). */
|
|
78
|
+
const DASHBOARD_ACCENT_CSS = `
|
|
79
|
+
.toggle-btn:hover { border-color:var(--prof-mem-hot); color:var(--prof-mem-hot); }
|
|
80
|
+
.toggle-btn.active-mem { border-color:var(--prof-mem-critical); color:var(--prof-mem-critical); }
|
|
81
|
+
.toggle-btn.active-cpu { border-color:var(--prof-critical); color:var(--prof-critical); }
|
|
82
|
+
.bar.mem-critical { background:var(--prof-mem-critical); }
|
|
83
|
+
.bar.mem-hot { background:var(--prof-mem-hot); }
|
|
84
|
+
.bar.mem-warm { background:var(--prof-mem-warm); }
|
|
85
|
+
.bar.mem-base { background:var(--prof-mem-cool); }
|
|
86
|
+
.bar.critical { background:var(--prof-critical); }
|
|
87
|
+
.bar.hot { background:var(--prof-hot); }
|
|
88
|
+
.bar.warm { background:var(--prof-warm); }
|
|
89
|
+
.bar.cool { background:var(--prof-cool); }
|
|
90
|
+
.leak-row:hover { border-color:var(--prof-mem-leak); }
|
|
91
|
+
.badge { font-size:10px; font-weight:600; text-transform:uppercase;
|
|
92
|
+
letter-spacing:0.06em; padding:2px 8px; border-radius:4px; flex-shrink:0; }
|
|
93
|
+
.badge.definite { background:color-mix(in srgb, var(--prof-mem-leak) 20%, transparent); color:var(--prof-mem-leak); border:1px solid var(--prof-mem-leak); }
|
|
94
|
+
.badge.high { background:color-mix(in srgb, var(--prof-mem-leak) 10%, transparent); color:var(--prof-mem-leak); border:1px dashed var(--prof-mem-leak); }
|
|
95
|
+
.badge.medium { background:color-mix(in srgb, var(--prof-warm) 15%, transparent); color:var(--prof-warm); border:1px solid var(--prof-warm); }
|
|
96
|
+
.badge.low { background:color-mix(in srgb, var(--prof-text-secondary) 15%, transparent); color:var(--prof-text-secondary); border:1px solid var(--prof-text-secondary); }
|
|
97
|
+
.leak-info .leak-growth { color:var(--prof-mem-leak); font-weight:500; }`;
|
|
98
|
+
const SUMMARY_CARDS_HTML = `
|
|
99
|
+
<div class="summary-cards">
|
|
100
|
+
<div class="card"><div class="label">Current Memory</div>
|
|
101
|
+
<div class="value mem" id="current-mem">0</div></div>
|
|
102
|
+
<div class="card"><div class="label">Peak Memory</div>
|
|
103
|
+
<div class="value mem" id="peak-mem">0</div></div>
|
|
104
|
+
<div class="card"><div class="label">GC Objects</div>
|
|
105
|
+
<div class="value" id="gc-objects">0</div></div>
|
|
106
|
+
<div class="card"><div class="label">GC Counts</div>
|
|
107
|
+
<div class="value" id="gc-counts">\u2014</div></div>
|
|
108
|
+
<div class="card" id="generation-card" hidden><div class="label">Generation sizes</div>
|
|
109
|
+
<div class="value" id="generation-sizes"></div></div>
|
|
110
|
+
</div>`;
|
|
111
|
+
// ── Dashboard script fragments ────────────────────────────────────────────
|
|
112
|
+
const SUMMARY_SCRIPT = `
|
|
113
|
+
document.getElementById('current-mem').textContent = formatBytes(currentMemory);
|
|
114
|
+
document.getElementById('peak-mem').textContent = formatBytes(peakMemory);
|
|
115
|
+
document.getElementById('gc-objects').textContent = gcObjects>=1000?(gcObjects/1000).toFixed(1)+'K':String(gcObjects);
|
|
116
|
+
document.getElementById('generation-card').hidden = generationSizes.length === 0;
|
|
117
|
+
document.getElementById('generation-sizes').textContent = generationSizes.map(region => region.name + ': ' + formatBytes(region.size)).join('\\n');
|
|
118
|
+
document.getElementById('gc-counts').textContent = gcCounts.length>0?gcCounts.join(' / '):'\\u2014';`;
|
|
119
|
+
const TIMELINE_SETUP_SCRIPT = `
|
|
120
|
+
const tlCanvas = document.getElementById('timeline-canvas');
|
|
121
|
+
const tlCtx = tlCanvas.getContext('2d');
|
|
122
|
+
const chLabel = document.getElementById('crosshair-label');
|
|
123
|
+
function drawBezierLine(pts, xOf, yOf, key) {
|
|
124
|
+
tlCtx.beginPath(); tlCtx.moveTo(xOf(pts[0].timestamp),yOf(pts[0][key]));
|
|
125
|
+
for(let i=1;i<pts.length;i++){
|
|
126
|
+
const px=xOf(pts[i-1].timestamp),py=yOf(pts[i-1][key]);
|
|
127
|
+
const cx=xOf(pts[i].timestamp),cy=yOf(pts[i][key]);
|
|
128
|
+
tlCtx.bezierCurveTo((px+cx)/2,py,(px+cx)/2,cy,cx,cy);
|
|
129
|
+
}
|
|
130
|
+
}`;
|
|
131
|
+
const TIMELINE_DRAW_SCRIPT = `
|
|
132
|
+
function renderTimeline() {
|
|
133
|
+
const ctr=tlCanvas.parentElement, w=ctr.clientWidth-24, h=200;
|
|
134
|
+
tlCanvas.width=w*devicePixelRatio; tlCanvas.height=h*devicePixelRatio;
|
|
135
|
+
tlCanvas.style.width=w+'px'; tlCanvas.style.height=h+'px';
|
|
136
|
+
tlCtx.setTransform(devicePixelRatio,0,0,devicePixelRatio,0,0);
|
|
137
|
+
if(timeline.length<2){
|
|
138
|
+
tlCtx.fillStyle=cssVar('--prof-text-secondary');tlCtx.font='13px "Space Grotesk",-apple-system,sans-serif';
|
|
139
|
+
tlCtx.textAlign='center';tlCtx.textBaseline='middle';
|
|
140
|
+
tlCtx.fillText('Take multiple snapshots to see the timeline',w/2,h/2); return;
|
|
141
|
+
}
|
|
142
|
+
const pL=60,pR=16,pT=16,pB=32,pW=w-pL-pR,pH=h-pT-pB;
|
|
143
|
+
const t0=timeline[0].timestamp,t1=timeline[timeline.length-1].timestamp,tR=t1-t0||1;
|
|
144
|
+
let mMax=0; for(const p of timeline){if(p.currentMemory>mMax)mMax=p.currentMemory;if(p.peakMemory>mMax)mMax=p.peakMemory;}
|
|
145
|
+
if(mMax===0)mMax=1;
|
|
146
|
+
function xOf(t){return pL+((t-t0)/tR)*pW;} function yOf(m){return pT+pH-(m/mMax)*pH;}
|
|
147
|
+
drawTimelineGrid(pL,pT,pW,pH,mMax,xOf,t0);drawTimelineArea(xOf,yOf,pT,pH);
|
|
148
|
+
drawTimelineLines(xOf,yOf);drawTimelinePoints(xOf,yOf);detectLeakGrowth(pL,pW,pT);
|
|
149
|
+
tlCanvas._geo={pL,pR,pT,pB,pW,pH,t0,t1,tR,mMax,xOf,yOf};
|
|
150
|
+
}
|
|
151
|
+
function drawTimelineGrid(pL,pT,pW,pH,mMax,xOf,t0){
|
|
152
|
+
tlCtx.strokeStyle=cssVar('--prof-border');tlCtx.lineWidth=1;
|
|
153
|
+
for(let i=0;i<=4;i++){
|
|
154
|
+
const y=pT+(pH/4)*i;tlCtx.beginPath();tlCtx.moveTo(pL,y);tlCtx.lineTo(pL+pW,y);tlCtx.stroke();
|
|
155
|
+
tlCtx.fillStyle=cssVar('--prof-text-secondary');tlCtx.font='10px "JetBrains Mono",monospace';
|
|
156
|
+
tlCtx.textAlign='right';tlCtx.textBaseline='middle';tlCtx.fillText(formatBytes(mMax*(1-i/4)),pL-6,y);
|
|
157
|
+
}
|
|
158
|
+
tlCtx.textAlign='center';tlCtx.textBaseline='top';
|
|
159
|
+
const step=Math.max(1,Math.floor(timeline.length/6));
|
|
160
|
+
for(let i=0;i<timeline.length;i+=step){
|
|
161
|
+
const p=timeline[i],el=p.timestamp-t0;
|
|
162
|
+
tlCtx.fillText(el<60?el.toFixed(0)+'s':(el/60).toFixed(1)+'m',xOf(p.timestamp),pT+pH+6);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function drawTimelineArea(xOf,yOf,pT,pH){
|
|
166
|
+
drawBezierLine(timeline,xOf,yOf,'currentMemory');
|
|
167
|
+
tlCtx.lineTo(xOf(timeline[timeline.length-1].timestamp),pT+pH);
|
|
168
|
+
tlCtx.lineTo(xOf(timeline[0].timestamp),pT+pH);tlCtx.closePath();
|
|
169
|
+
const grad=tlCtx.createLinearGradient(0,pT,0,pT+pH);
|
|
170
|
+
const mem=cssVar('--prof-mem-critical');grad.addColorStop(0,mem+'30');grad.addColorStop(1,mem+'05');
|
|
171
|
+
tlCtx.fillStyle=grad;tlCtx.fill();
|
|
172
|
+
}
|
|
173
|
+
function drawTimelineLines(xOf,yOf){
|
|
174
|
+
drawBezierLine(timeline,xOf,yOf,'currentMemory');
|
|
175
|
+
tlCtx.strokeStyle=cssVar('--prof-mem-critical');tlCtx.lineWidth=2;tlCtx.stroke();
|
|
176
|
+
tlCtx.beginPath();tlCtx.setLineDash([4,4]);
|
|
177
|
+
for(let i=0;i<timeline.length;i++) tlCtx.lineTo(xOf(timeline[i].timestamp),yOf(timeline[i].peakMemory));
|
|
178
|
+
tlCtx.strokeStyle=cssVar('--prof-mem-hot')+'60';tlCtx.lineWidth=1;tlCtx.stroke();tlCtx.setLineDash([]);
|
|
179
|
+
}
|
|
180
|
+
function drawTimelinePoints(xOf,yOf){
|
|
181
|
+
for(const p of timeline){tlCtx.beginPath();tlCtx.arc(xOf(p.timestamp),yOf(p.currentMemory),3,0,Math.PI*2);tlCtx.fillStyle=cssVar('--prof-mem-critical');tlCtx.fill();}
|
|
182
|
+
}
|
|
183
|
+
function detectLeakGrowth(pL,pW,pT){
|
|
184
|
+
if(timeline.length<3) return;
|
|
185
|
+
let gc=0;for(let i=1;i<timeline.length;i++)if(timeline[i].currentMemory>timeline[i-1].currentMemory)gc++;
|
|
186
|
+
if(gc>=timeline.length-1){tlCtx.fillStyle=cssVar('--prof-mem-leak');tlCtx.font='600 11px "Space Grotesk",-apple-system,sans-serif';
|
|
187
|
+
tlCtx.textAlign='right';tlCtx.textBaseline='top';tlCtx.fillText('STEADY GROWTH \\u2014 possible leak',pL+pW,pT+4);}
|
|
188
|
+
}`;
|
|
189
|
+
const TIMELINE_CROSSHAIR_SCRIPT = `
|
|
190
|
+
tlCanvas.addEventListener('mousemove',(e)=>{
|
|
191
|
+
const g=tlCanvas._geo;if(!g||timeline.length<2)return;
|
|
192
|
+
const r=tlCanvas.getBoundingClientRect(),mx=e.clientX-r.left;
|
|
193
|
+
let ci=0,cd=Infinity;
|
|
194
|
+
for(let i=0;i<timeline.length;i++){const d=Math.abs(g.xOf(timeline[i].timestamp)-mx);if(d<cd){cd=d;ci=i;}}
|
|
195
|
+
const p=timeline[ci];chLabel.style.display='block';
|
|
196
|
+
chLabel.style.left=(mx+12)+'px';chLabel.style.top='12px';
|
|
197
|
+
chLabel.textContent=formatBytes(p.currentMemory)+' (peak: '+formatBytes(p.peakMemory)+')';
|
|
198
|
+
});
|
|
199
|
+
tlCanvas.addEventListener('mouseleave',()=>{chLabel.style.display='none';});`;
|
|
200
|
+
const TOGGLE_SCRIPT = `
|
|
201
|
+
let heatMode='memory';
|
|
202
|
+
document.getElementById('btn-mem').addEventListener('click',()=>{
|
|
203
|
+
heatMode='memory';
|
|
204
|
+
document.getElementById('btn-mem').className='toggle-btn active-mem';
|
|
205
|
+
document.getElementById('btn-cpu').className='toggle-btn';
|
|
206
|
+
renderAllocs();
|
|
207
|
+
});
|
|
208
|
+
document.getElementById('btn-cpu').addEventListener('click',()=>{
|
|
209
|
+
heatMode='cpu';
|
|
210
|
+
document.getElementById('btn-cpu').className='toggle-btn active-cpu';
|
|
211
|
+
document.getElementById('btn-mem').className='toggle-btn';
|
|
212
|
+
renderAllocs();
|
|
213
|
+
});`;
|
|
214
|
+
/**
|
|
215
|
+
* The action buttons post their command back to the extension — the empty
|
|
216
|
+
* states say "take more snapshots", so the dashboard must let the user do it
|
|
217
|
+
* right there ([PROF-UI-MEMORY], #263).
|
|
218
|
+
*/
|
|
219
|
+
const ACTIONS_SCRIPT = `
|
|
220
|
+
document.getElementById('btn-take-snapshot').addEventListener('click',()=>{
|
|
221
|
+
vscode.postMessage({type:'takeSnapshot'});
|
|
222
|
+
});
|
|
223
|
+
document.getElementById('btn-compare').addEventListener('click',()=>{
|
|
224
|
+
vscode.postMessage({type:'compareSnapshots'});
|
|
225
|
+
});
|
|
226
|
+
const heapBtn=document.getElementById('btn-open-heapprofile');
|
|
227
|
+
if(heapBtn){heapBtn.addEventListener('click',()=>{
|
|
228
|
+
vscode.postMessage({type:'openHeapProfile',file:heapProfileFile});
|
|
229
|
+
});}
|
|
230
|
+
const speedscopeBtn=document.getElementById('btn-open-speedscope');
|
|
231
|
+
if(speedscopeBtn){speedscopeBtn.addEventListener('click',()=>{
|
|
232
|
+
vscode.postMessage({type:'openSpeedscope',file:heapProfileFile});
|
|
233
|
+
});}`;
|
|
234
|
+
const ALLOC_SCRIPT = `
|
|
235
|
+
function memBarCls(sz,mx){const r=sz/Math.max(mx,1);if(r>=.5)return'mem-critical';if(r>=.2)return'mem-hot';if(r>=.05)return'mem-warm';return'mem-base';}
|
|
236
|
+
function cpuBarCls(i,t){const r=(t-i)/t;if(r>=.8)return'critical';if(r>=.5)return'hot';if(r>=.2)return'warm';return'cool';}
|
|
237
|
+
function siteLabel(a){const at=a.file?escapeHtml(basename(a.file))+':'+a.line:'';return a.typeName?escapeHtml(a.typeName)+(at?' · '+at:''):at;}
|
|
238
|
+
function renderAllocs(){
|
|
239
|
+
const body=document.getElementById('alloc-body');body.innerHTML='';
|
|
240
|
+
if(!allocations.length){body.innerHTML='<tr><td colspan="4" class="empty-state">No allocations above threshold</td></tr>';return;}
|
|
241
|
+
const mx=allocations[0].size;
|
|
242
|
+
for(let i=0;i<allocations.length;i++){
|
|
243
|
+
const a=allocations[i],tr=document.createElement('tr');
|
|
244
|
+
tr.onclick=()=>vscode.postMessage({type:'navigateToSource',file:a.file,line:a.line});
|
|
245
|
+
const bw=Math.max(4,(a.size/mx)*140);
|
|
246
|
+
const bc=heatMode==='memory'?memBarCls(a.size,mx):cpuBarCls(i,allocations.length);
|
|
247
|
+
tr.innerHTML='<td class="alloc-site">'+siteLabel(a)+'</td>'
|
|
248
|
+
+'<td class="alloc-size">'+formatBytes(a.size)+'</td><td>'+a.count+'</td>'
|
|
249
|
+
+'<td class="bar-cell"><div class="bar '+bc+'" style="width:'+bw+'px"></div></td>';
|
|
250
|
+
body.appendChild(tr);
|
|
251
|
+
}
|
|
252
|
+
}`;
|
|
253
|
+
const LEAK_SCRIPT = `
|
|
254
|
+
function renderLeaks(){
|
|
255
|
+
const list=document.getElementById('leak-list');
|
|
256
|
+
if(!leaks.length){list.innerHTML='<div class="empty-state">No suspected leaks detected. Take more snapshots to enable diff analysis.</div>';return;}
|
|
257
|
+
list.innerHTML='';
|
|
258
|
+
for(const lk of leaks){
|
|
259
|
+
const row=document.createElement('div');row.className='leak-row';
|
|
260
|
+
row.onclick=()=>vscode.postMessage({type:'navigateToSource',file:lk.file,line:lk.line});
|
|
261
|
+
row.innerHTML='<span class="badge '+lk.confidence+'">'+lk.confidence+'</span>'
|
|
262
|
+
+'<div class="leak-info"><div class="leak-file">'+siteLabel(lk)+'</div>'
|
|
263
|
+
+'<div class="leak-growth">+'+formatBytes(lk.sizeGrowth)+' ('+lk.countGrowth+' objects)</div>'
|
|
264
|
+
+'<div class="leak-reason">'+escapeHtml(lk.reason)+'</div></div>';
|
|
265
|
+
list.appendChild(row);
|
|
266
|
+
}
|
|
267
|
+
}`;
|
|
268
|
+
const TIMELINE_SCRIPT = [TIMELINE_SETUP_SCRIPT, TIMELINE_DRAW_SCRIPT, TIMELINE_CROSSHAIR_SCRIPT].join("\n");
|
|
269
|
+
function buildDashboardHeadCss() {
|
|
270
|
+
return `${profiler_styles_1.PROFILER_CSS_VARS}${profiler_styles_1.PROFILER_CSS_RESET}
|
|
271
|
+
body { padding: 16px; overflow-y: auto; }
|
|
272
|
+
h1 .accent { color: var(--prof-mem-critical); }
|
|
273
|
+
.card .value.mem { color: var(--prof-mem-critical); }
|
|
274
|
+
${profiler_styles_1.PROFILER_CSS_HEADING}${profiler_styles_1.PROFILER_CSS_CARDS}${profiler_styles_1.PROFILER_CSS_TABLE}${DASHBOARD_LAYOUT_CSS}${DASHBOARD_ACCENT_CSS}`;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The raw V8 `.heapprofile` opens on demand rather than by default
|
|
278
|
+
* ([PROF-CPU-START]): in the built-in viewer or in speedscope.app ([PROF-UI-WEBVIEW]).
|
|
279
|
+
*/
|
|
280
|
+
function heapProfileButtonsHtml(hasHeapProfile) {
|
|
281
|
+
return hasHeapProfile
|
|
282
|
+
? `
|
|
283
|
+
<button class="toggle-btn" id="btn-open-heapprofile" title="Open the raw .heapprofile in the built-in trace viewer">Open Heap Profile in VS Code Viewer</button>
|
|
284
|
+
<button class="toggle-btn" id="btn-open-speedscope" title="Open speedscope.app with the heap profile loaded automatically">Open in Speedscope (external)</button>`
|
|
285
|
+
: "";
|
|
286
|
+
}
|
|
287
|
+
function buildDashboardBodyHtml(hasHeapProfile) {
|
|
288
|
+
return `
|
|
289
|
+
${(0, profiler_styles_1.brandHeading)((0, ids_1.brand)(), "MEMORY")}
|
|
290
|
+
<div class="toggle-row">
|
|
291
|
+
<button class="toggle-btn" id="btn-take-snapshot">Take Snapshot</button>
|
|
292
|
+
<button class="toggle-btn" id="btn-compare">Compare Snapshots</button>${heapProfileButtonsHtml(hasHeapProfile)}
|
|
293
|
+
</div>
|
|
294
|
+
${SUMMARY_CARDS_HTML}${DASHBOARD_SECTIONS_HTML}`;
|
|
295
|
+
}
|
|
296
|
+
function buildDashboardScriptTag(snapshot, diff) {
|
|
297
|
+
return `
|
|
298
|
+
const vscode = globalThis.profilerVsCodeApi || (globalThis.profilerVsCodeApi = acquireVsCodeApi());
|
|
299
|
+
${dashboardDataScript(snapshot, diff)}
|
|
300
|
+
${profiler_styles_1.PROFILER_JS_UTILS}
|
|
301
|
+
${SUMMARY_SCRIPT}
|
|
302
|
+
${TIMELINE_SCRIPT}
|
|
303
|
+
${TOGGLE_SCRIPT}
|
|
304
|
+
${ACTIONS_SCRIPT}
|
|
305
|
+
${ALLOC_SCRIPT}
|
|
306
|
+
${LEAK_SCRIPT}
|
|
307
|
+
renderTimeline(); renderAllocs(); renderLeaks();
|
|
308
|
+
window.addEventListener('resize',()=>{renderTimeline();});`;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* The snapshot and diff as script constants. Allocation paths and leak reasons
|
|
312
|
+
* come from the profiled program, so they are embedded such that they can never
|
|
313
|
+
* close the inline <script> ([PROF-UI-WEBVIEW]).
|
|
314
|
+
*/
|
|
315
|
+
function dashboardDataScript(snapshot, diff) {
|
|
316
|
+
return `
|
|
317
|
+
const allocations = ${(0, profiler_webview_1.embedJson)(snapshot.topAllocations)};
|
|
318
|
+
const timeline = ${(0, profiler_webview_1.embedJson)(snapshot.timeline)};
|
|
319
|
+
const leaks = ${(0, profiler_webview_1.embedJson)(diff?.suspectedLeaks ?? [])};
|
|
320
|
+
const gcCounts = ${(0, profiler_webview_1.embedJson)(snapshot.gcCounts)};
|
|
321
|
+
const generationSizes = ${(0, profiler_webview_1.embedJson)(snapshot.generationSizes ?? [])};
|
|
322
|
+
const heapProfileFile = ${(0, profiler_webview_1.embedJson)(snapshot.heapProfilePath)};
|
|
323
|
+
const currentMemory = ${(0, profiler_webview_1.embedJson)(snapshot.currentMemory)};
|
|
324
|
+
const peakMemory = ${(0, profiler_webview_1.embedJson)(snapshot.peakMemory)};
|
|
325
|
+
const gcObjects = ${(0, profiler_webview_1.embedJson)(snapshot.gcObjects)};`;
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=memory-dashboard-html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-dashboard-html.js","sourceRoot":"","sources":["../../src/memory-dashboard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,CAAC;4BACrC,IAAA,4BAAS,EAAC,QAAQ,CAAC,aAAa,CAAC;yBACpC,IAAA,4BAAS,EAAC,QAAQ,CAAC,UAAU,CAAC;wBAC/B,IAAA,4BAAS,EAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mapping from raw `<prefix>.lspProfiler.memory.ingest` results to the dashboard's
|
|
3
|
+
* strongly typed shapes. Pure converters — no VS Code APIs, no state.
|
|
4
|
+
* Extracted from memory-profiler.ts to satisfy the 500 LOC file limit.
|
|
5
|
+
*/
|
|
6
|
+
import type { MemoryDashboardSnapshot, MemoryDiffData } from "./memory-dashboard";
|
|
7
|
+
import type { MemoryDiffResult, MemorySnapshotResult } from "./memory-decorations";
|
|
8
|
+
/** A tagged ingest result returned by `<prefix>.lspProfiler.memory.ingest`. */
|
|
9
|
+
export interface MemoryIngestResult {
|
|
10
|
+
kind: "snapshot" | "diff" | "gc" | "refs" | "objects" | "ack";
|
|
11
|
+
[field: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
/** Coerce an `unknown` JSON field to a string (never an object stringification). */
|
|
14
|
+
export declare function asString(value: unknown, fallback?: string): string;
|
|
15
|
+
/** A leak confidence grade, or `"low"` when the server sent something else. */
|
|
16
|
+
export declare function toConfidence(value: string): MemoryDiffData["suspectedLeaks"][number]["confidence"];
|
|
17
|
+
/** Coerce an `unknown` JSON field to a finite number. */
|
|
18
|
+
export declare function asNumber(value: unknown, fallback?: number): number;
|
|
19
|
+
/**
|
|
20
|
+
* Decode the decoration-facing snapshot shape from a raw ingest result.
|
|
21
|
+
*
|
|
22
|
+
* `MemoryIngestResult` is an index-signature bag, so it structurally overlaps
|
|
23
|
+
* `MemorySnapshotResult` without actually guaranteeing any of its fields.
|
|
24
|
+
* Building the value field by field means a server that stops sending
|
|
25
|
+
* `topAllocations` yields an empty list rather than an `undefined` the
|
|
26
|
+
* decorations layer would iterate.
|
|
27
|
+
*/
|
|
28
|
+
export declare function toSnapshotResult(result: MemoryIngestResult): MemorySnapshotResult;
|
|
29
|
+
/** Decode the decoration-facing diff shape from a raw ingest result. */
|
|
30
|
+
export declare function toDiffResult(result: MemoryIngestResult): MemoryDiffResult;
|
|
31
|
+
/** Map an ingest snapshot result to the dashboard's snapshot shape. */
|
|
32
|
+
export declare function toDashboardSnapshot(result: MemoryIngestResult): MemoryDashboardSnapshot;
|
|
33
|
+
/** Map an ingest diff result to the dashboard's diff shape (lowercasing confidence). */
|
|
34
|
+
export declare function toDashboardDiff(result: MemoryIngestResult): MemoryDiffData;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Mapping from raw `<prefix>.lspProfiler.memory.ingest` results to the dashboard's
|
|
5
|
+
* strongly typed shapes. Pure converters — no VS Code APIs, no state.
|
|
6
|
+
* Extracted from memory-profiler.ts to satisfy the 500 LOC file limit.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.asString = asString;
|
|
10
|
+
exports.toConfidence = toConfidence;
|
|
11
|
+
exports.asNumber = asNumber;
|
|
12
|
+
exports.toSnapshotResult = toSnapshotResult;
|
|
13
|
+
exports.toDiffResult = toDiffResult;
|
|
14
|
+
exports.toDashboardSnapshot = toDashboardSnapshot;
|
|
15
|
+
exports.toDashboardDiff = toDashboardDiff;
|
|
16
|
+
const unknown_shape_1 = require("./unknown-shape");
|
|
17
|
+
/** Coerce an `unknown` JSON field to a string (never an object stringification). */
|
|
18
|
+
function asString(value, fallback = "") {
|
|
19
|
+
return typeof value === "string" ? value : fallback;
|
|
20
|
+
}
|
|
21
|
+
/** The four leak-confidence grades the dashboard renders badges for. */
|
|
22
|
+
const CONFIDENCE_GRADES = ["definite", "high", "medium", "low"];
|
|
23
|
+
/** A leak confidence grade, or `"low"` when the server sent something else. */
|
|
24
|
+
function toConfidence(value) {
|
|
25
|
+
const lowered = value.toLowerCase();
|
|
26
|
+
return CONFIDENCE_GRADES.find((grade) => grade === lowered) ?? "low";
|
|
27
|
+
}
|
|
28
|
+
/** Coerce an `unknown` JSON field to a finite number. */
|
|
29
|
+
function asNumber(value, fallback = 0) {
|
|
30
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
31
|
+
}
|
|
32
|
+
/** The four `LeakConfidence` grades the LSP reports, uppercase on the wire. */
|
|
33
|
+
const LEAK_CONFIDENCES = ["LOW", "MEDIUM", "HIGH", "DEFINITE"];
|
|
34
|
+
/** A wire leak-confidence grade, or `"LOW"` when the server sent something else. */
|
|
35
|
+
function toLeakConfidence(value) {
|
|
36
|
+
const upper = value.toUpperCase();
|
|
37
|
+
return LEAK_CONFIDENCES.find((grade) => grade === upper) ?? "LOW";
|
|
38
|
+
}
|
|
39
|
+
/** Read one allocation entry, defaulting its counts; an absent location stays absent. */
|
|
40
|
+
function toAllocation(raw) {
|
|
41
|
+
return {
|
|
42
|
+
...locationFields(raw),
|
|
43
|
+
size: asNumber(raw.size),
|
|
44
|
+
count: asNumber(raw.count),
|
|
45
|
+
...typeNameField(raw),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** The site's file and 1-based line, or neither when the runtime located none. */
|
|
49
|
+
function locationFields(raw) {
|
|
50
|
+
const file = asString(raw.file);
|
|
51
|
+
const line = asNumber(raw.line);
|
|
52
|
+
return file === "" || line < 1 ? {} : { file, line };
|
|
53
|
+
}
|
|
54
|
+
/** The runtime-reported type name, present only when the runtime named one. */
|
|
55
|
+
function typeNameField(raw) {
|
|
56
|
+
const typeName = asString(raw.typeName);
|
|
57
|
+
return typeName === "" ? {} : { typeName };
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Decode the decoration-facing snapshot shape from a raw ingest result.
|
|
61
|
+
*
|
|
62
|
+
* `MemoryIngestResult` is an index-signature bag, so it structurally overlaps
|
|
63
|
+
* `MemorySnapshotResult` without actually guaranteeing any of its fields.
|
|
64
|
+
* Building the value field by field means a server that stops sending
|
|
65
|
+
* `topAllocations` yields an empty list rather than an `undefined` the
|
|
66
|
+
* decorations layer would iterate.
|
|
67
|
+
*/
|
|
68
|
+
function toSnapshotResult(result) {
|
|
69
|
+
return {
|
|
70
|
+
memorySessionId: asString(result.memorySessionId),
|
|
71
|
+
snapshotId: asString(result.snapshotId),
|
|
72
|
+
currentMemory: asNumber(result.currentMemory),
|
|
73
|
+
peakMemory: asNumber(result.peakMemory),
|
|
74
|
+
topAllocations: (0, unknown_shape_1.recordArrayField)(result, "topAllocations").map((allocation) => toAllocation(allocation)),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Decode the decoration-facing diff shape from a raw ingest result. */
|
|
78
|
+
function toDiffResult(result) {
|
|
79
|
+
return {
|
|
80
|
+
totalGrowth: asNumber(result.totalGrowth),
|
|
81
|
+
totalFreed: asNumber(result.totalFreed),
|
|
82
|
+
netGrowth: asNumber(result.netGrowth),
|
|
83
|
+
suspectedLeaks: (0, unknown_shape_1.recordArrayField)(result, "suspectedLeaks").map((leak) => ({
|
|
84
|
+
file: asString(leak.file),
|
|
85
|
+
line: asNumber(leak.line),
|
|
86
|
+
sizeGrowth: asNumber(leak.sizeGrowth),
|
|
87
|
+
countGrowth: asNumber(leak.countGrowth),
|
|
88
|
+
currentSize: asNumber(leak.currentSize),
|
|
89
|
+
confidence: toLeakConfidence(asString(leak.confidence, "LOW")),
|
|
90
|
+
reason: asString(leak.reason),
|
|
91
|
+
typeName: asString(leak.typeName),
|
|
92
|
+
})),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** Map an ingest snapshot result to the dashboard's snapshot shape. */
|
|
96
|
+
function toDashboardSnapshot(result) {
|
|
97
|
+
return {
|
|
98
|
+
memorySessionId: asString(result.memorySessionId),
|
|
99
|
+
snapshotId: asString(result.snapshotId),
|
|
100
|
+
currentMemory: asNumber(result.currentMemory),
|
|
101
|
+
peakMemory: asNumber(result.peakMemory),
|
|
102
|
+
gcObjects: asNumber(result.gcObjects),
|
|
103
|
+
gcCounts: (0, unknown_shape_1.numberArrayField)(result, "gcCounts"),
|
|
104
|
+
generationSizes: (0, unknown_shape_1.recordArrayField)(result, "generationSizes").map((region) => ({ name: asString(region.name), size: asNumber(region.size) })),
|
|
105
|
+
topAllocations: (0, unknown_shape_1.recordArrayField)(result, "topAllocations").map((allocation) => toAllocation(allocation)),
|
|
106
|
+
timeline: [],
|
|
107
|
+
heapProfilePath: asString(result.heapProfilePath),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** Map an ingest diff result to the dashboard's diff shape (lowercasing confidence). */
|
|
111
|
+
function toDashboardDiff(result) {
|
|
112
|
+
const leaks = (0, unknown_shape_1.recordArrayField)(result, "suspectedLeaks");
|
|
113
|
+
return {
|
|
114
|
+
totalGrowth: asNumber(result.totalGrowth),
|
|
115
|
+
totalFreed: asNumber(result.totalFreed),
|
|
116
|
+
netGrowth: asNumber(result.netGrowth),
|
|
117
|
+
grownAllocations: [],
|
|
118
|
+
suspectedLeaks: leaks.map((leak) => toSuspectedLeak(leak)),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/** One suspected leak in the dashboard's shape. */
|
|
122
|
+
function toSuspectedLeak(leak) {
|
|
123
|
+
return {
|
|
124
|
+
file: asString(leak.file),
|
|
125
|
+
line: asNumber(leak.line),
|
|
126
|
+
sizeGrowth: asNumber(leak.sizeGrowth),
|
|
127
|
+
countGrowth: asNumber(leak.countGrowth),
|
|
128
|
+
currentSize: asNumber(leak.currentSize),
|
|
129
|
+
currentCount: asNumber(leak.currentCount),
|
|
130
|
+
confidence: toConfidence(asString(leak.confidence, "low")),
|
|
131
|
+
reason: asString(leak.reason),
|
|
132
|
+
...typeNameField(leak),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=memory-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EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC;QACvC,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;QACzC,UAAU,EAAE,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC1D,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;QAC7B,GAAG,aAAa,CAAC,IAAI,CAAC;KACvB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory dashboard webview for memory profiling.
|
|
3
|
+
*
|
|
4
|
+
* Provides:
|
|
5
|
+
* - Summary cards: current memory, peak memory, gc objects, gc counts
|
|
6
|
+
* - Timeline chart: memory usage over time (Canvas 2D line chart)
|
|
7
|
+
* - Top allocations table: file, line, size, count — click to navigate
|
|
8
|
+
* - Leak confidence badges: Definite, High, Medium, Low
|
|
9
|
+
* - Dual heat map mode toggle: CPU or memory heat, in the host palette
|
|
10
|
+
*
|
|
11
|
+
* All data comes from the LSP via memory snapshot/diff commands.
|
|
12
|
+
* This module handles only the client-side visualization.
|
|
13
|
+
*/
|
|
14
|
+
import type { MemoryAllocation } from "./memory-decorations";
|
|
15
|
+
import type { WebviewMessage } from "./profiler-webview";
|
|
16
|
+
export { buildMemoryDashboardHtml } from "./memory-dashboard-html";
|
|
17
|
+
/** A single time-series data point for the memory timeline. */
|
|
18
|
+
export interface MemoryTimelinePoint {
|
|
19
|
+
timestamp: number;
|
|
20
|
+
currentMemory: number;
|
|
21
|
+
peakMemory: number;
|
|
22
|
+
gcObjects: number;
|
|
23
|
+
}
|
|
24
|
+
/** Snapshot data extended with timeline and gc info. */
|
|
25
|
+
export interface MemoryDashboardSnapshot {
|
|
26
|
+
memorySessionId: string;
|
|
27
|
+
snapshotId: string;
|
|
28
|
+
currentMemory: number;
|
|
29
|
+
peakMemory: number;
|
|
30
|
+
gcObjects: number;
|
|
31
|
+
gcCounts: number[];
|
|
32
|
+
/** Runtime-named heap regions measured in bytes, separate from GC counts. */
|
|
33
|
+
generationSizes?: {
|
|
34
|
+
name: string;
|
|
35
|
+
size: number;
|
|
36
|
+
}[];
|
|
37
|
+
topAllocations: MemoryAllocation[];
|
|
38
|
+
timeline: MemoryTimelinePoint[];
|
|
39
|
+
/** On-disk V8 `.heapprofile` for the built-in viewer; empty when not written. */
|
|
40
|
+
heapProfilePath: string;
|
|
41
|
+
}
|
|
42
|
+
/** A suspected leak from a snapshot diff. */
|
|
43
|
+
export interface SuspectedLeak {
|
|
44
|
+
file: string;
|
|
45
|
+
line: number;
|
|
46
|
+
sizeGrowth: number;
|
|
47
|
+
countGrowth: number;
|
|
48
|
+
currentSize: number;
|
|
49
|
+
currentCount: number;
|
|
50
|
+
confidence: "definite" | "high" | "medium" | "low";
|
|
51
|
+
reason: string;
|
|
52
|
+
/** The runtime's own name for the growing type, when it reports one. */
|
|
53
|
+
typeName?: string;
|
|
54
|
+
}
|
|
55
|
+
/** Diff data comparing two memory snapshots. */
|
|
56
|
+
export interface MemoryDiffData {
|
|
57
|
+
totalGrowth: number;
|
|
58
|
+
totalFreed: number;
|
|
59
|
+
netGrowth: number;
|
|
60
|
+
suspectedLeaks: SuspectedLeak[];
|
|
61
|
+
grownAllocations: MemoryAllocation[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Route a dashboard action-button message to its real memory command, so the
|
|
65
|
+
* dashboard's "take more snapshots" advice is a button, not homework
|
|
66
|
+
* ([PROF-UI-MEMORY], #263). Returns whether the message was one of
|
|
67
|
+
* the dashboard's actions (source-navigation clicks fall through).
|
|
68
|
+
*/
|
|
69
|
+
export declare function handleMemoryDashboardMessage(msg: WebviewMessage): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Open or reveal the memory dashboard webview.
|
|
72
|
+
* If diffData is provided, the leak analysis section is shown.
|
|
73
|
+
*/
|
|
74
|
+
export declare function openMemoryDashboard(snapshotData: MemoryDashboardSnapshot, diffData?: MemoryDiffData): void;
|
|
75
|
+
/** Dispose the memory dashboard panel if open. */
|
|
76
|
+
/** The open memory dashboard's view type, title and HTML (e2e seam). */
|
|
77
|
+
export declare function memoryDashboardState(): {
|
|
78
|
+
readonly viewType: string;
|
|
79
|
+
readonly title: string;
|
|
80
|
+
readonly html: string;
|
|
81
|
+
} | undefined;
|
|
82
|
+
export declare function disposeMemoryDashboard(): void;
|