@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,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Memory dashboard webview for memory profiling.
|
|
5
|
+
*
|
|
6
|
+
* Provides:
|
|
7
|
+
* - Summary cards: current memory, peak memory, gc objects, gc counts
|
|
8
|
+
* - Timeline chart: memory usage over time (Canvas 2D line chart)
|
|
9
|
+
* - Top allocations table: file, line, size, count — click to navigate
|
|
10
|
+
* - Leak confidence badges: Definite, High, Medium, Low
|
|
11
|
+
* - Dual heat map mode toggle: CPU or memory heat, in the host palette
|
|
12
|
+
*
|
|
13
|
+
* All data comes from the LSP via memory snapshot/diff commands.
|
|
14
|
+
* This module handles only the client-side visualization.
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.buildMemoryDashboardHtml = void 0;
|
|
51
|
+
exports.handleMemoryDashboardMessage = handleMemoryDashboardMessage;
|
|
52
|
+
exports.openMemoryDashboard = openMemoryDashboard;
|
|
53
|
+
exports.memoryDashboardState = memoryDashboardState;
|
|
54
|
+
exports.disposeMemoryDashboard = disposeMemoryDashboard;
|
|
55
|
+
const vscode = __importStar(require("vscode"));
|
|
56
|
+
const ids_1 = require("./ids");
|
|
57
|
+
const logger_1 = require("./logger");
|
|
58
|
+
const trace_actions_1 = require("./trace-actions");
|
|
59
|
+
const profiler_styles_1 = require("./profiler-styles");
|
|
60
|
+
const memory_dashboard_html_1 = require("./memory-dashboard-html");
|
|
61
|
+
const profiler_webview_1 = require("./profiler-webview");
|
|
62
|
+
var memory_dashboard_html_2 = require("./memory-dashboard-html");
|
|
63
|
+
Object.defineProperty(exports, "buildMemoryDashboardHtml", { enumerable: true, get: function () { return memory_dashboard_html_2.buildMemoryDashboardHtml; } });
|
|
64
|
+
// ── State ─────────────────────────────────────────────────────────────────
|
|
65
|
+
// One panel, one message handler — the shared host guarantees a re-opened
|
|
66
|
+
// dashboard (the autopilot re-renders it on every pause) never stacks a second
|
|
67
|
+
// navigation handler ([PROF-UI-WEBVIEW]).
|
|
68
|
+
const memoryDashboardPanel = new profiler_webview_1.SingletonWebviewPanel(() => (0, ids_1.cmd)("memoryDashboard"), (msg) => {
|
|
69
|
+
if (!handleMemoryDashboardMessage(msg)) {
|
|
70
|
+
(0, profiler_webview_1.handleSourceNavigation)(msg);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
/** The dashboard action buttons' message → command routing ([PROF-UI-MEMORY]). */
|
|
74
|
+
function dashboardActionCommand(type) {
|
|
75
|
+
switch (type) {
|
|
76
|
+
case "takeSnapshot": {
|
|
77
|
+
return (0, ids_1.cmd)("memorySnapshot");
|
|
78
|
+
}
|
|
79
|
+
case "compareSnapshots": {
|
|
80
|
+
return (0, ids_1.cmd)("memoryDiff");
|
|
81
|
+
}
|
|
82
|
+
default: {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Route a heap-profile open message to its viewer; false when the message is
|
|
89
|
+
* not one of the dashboard's heap-profile opens.
|
|
90
|
+
*/
|
|
91
|
+
function openHeapProfileFromMessage(msg) {
|
|
92
|
+
const file = msg.file ?? "";
|
|
93
|
+
// The dashboard is the landing view; the raw V8 `.heapprofile` opens on demand
|
|
94
|
+
// in VS Code's built-in viewer ([PROF-CPU-START]), or in speedscope, which
|
|
95
|
+
// imports it too, over the CPU panel's loopback deep link ([PROF-UI-WEBVIEW]).
|
|
96
|
+
if (msg.type === "openHeapProfile" && file !== "") {
|
|
97
|
+
void (0, trace_actions_1.openNativeTraceViewer)(file, file);
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
if (msg.type === "openSpeedscope" && file !== "") {
|
|
101
|
+
void (0, trace_actions_1.openSpeedscopeImport)(file);
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Route a dashboard action-button message to its real memory command, so the
|
|
108
|
+
* dashboard's "take more snapshots" advice is a button, not homework
|
|
109
|
+
* ([PROF-UI-MEMORY], #263). Returns whether the message was one of
|
|
110
|
+
* the dashboard's actions (source-navigation clicks fall through).
|
|
111
|
+
*/
|
|
112
|
+
function handleMemoryDashboardMessage(msg) {
|
|
113
|
+
if (openHeapProfileFromMessage(msg)) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
const command = dashboardActionCommand(msg.type);
|
|
117
|
+
if (command !== undefined) {
|
|
118
|
+
void vscode.commands.executeCommand(command);
|
|
119
|
+
}
|
|
120
|
+
return command !== undefined;
|
|
121
|
+
}
|
|
122
|
+
// ── Public API ────────────────────────────────────────────────────────────
|
|
123
|
+
/**
|
|
124
|
+
* Open or reveal the memory dashboard webview.
|
|
125
|
+
* If diffData is provided, the leak analysis section is shown.
|
|
126
|
+
*/
|
|
127
|
+
function openMemoryDashboard(snapshotData, diffData) {
|
|
128
|
+
memoryDashboardPanel.show(`${(0, ids_1.brand)()} Memory Dashboard`, (0, memory_dashboard_html_1.buildMemoryDashboardHtml)(snapshotData, diffData));
|
|
129
|
+
const leakCount = diffData?.suspectedLeaks.length ?? 0;
|
|
130
|
+
logger_1.Logger.info(`Memory dashboard opened: ${(0, profiler_styles_1.formatBytes)(snapshotData.currentMemory)} current, ` +
|
|
131
|
+
`${String(snapshotData.topAllocations.length)} allocations, ${String(leakCount)} suspected leaks`);
|
|
132
|
+
}
|
|
133
|
+
/** Dispose the memory dashboard panel if open. */
|
|
134
|
+
/** The open memory dashboard's view type, title and HTML (e2e seam). */
|
|
135
|
+
function memoryDashboardState() {
|
|
136
|
+
const described = memoryDashboardPanel.describe();
|
|
137
|
+
return described === undefined ? undefined : { ...described, html: memoryDashboardPanel.html() ?? "" };
|
|
138
|
+
}
|
|
139
|
+
function disposeMemoryDashboard() {
|
|
140
|
+
memoryDashboardPanel.dispose();
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=memory-dashboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-dashboard.js","sourceRoot":"","sources":["../../src/memory-dashboard.ts"],"names":[],"mappings":";AAAA,4DAA4D;AA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EAAE,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;AACzG,CAAC;AAED;IACE,oBAAoB,CAAC,OAAO,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline memory allocation decorations for memory profiling.
|
|
3
|
+
*
|
|
4
|
+
* After a memory snapshot, hot allocation lines get decorations showing
|
|
5
|
+
* allocation size and count, in the host palette's memory ramp (memory,
|
|
6
|
+
* memoryHot, memoryWarm, memoryCool by size); a suspected leak wears the
|
|
7
|
+
* palette's leak, warm or memory colour by confidence ([PROF-UI-PALETTE]).
|
|
8
|
+
*/
|
|
9
|
+
import type { AppliedDecoration } from "./profiler-decorations";
|
|
10
|
+
/** Per-line allocation data from the LSP server. */
|
|
11
|
+
export interface MemoryAllocation {
|
|
12
|
+
/** Source path; absent for a type with no location, such as an array ([PROF-DOTNET-SOURCE]). */
|
|
13
|
+
file?: string;
|
|
14
|
+
/** 1-based line; present exactly when `file` is. */
|
|
15
|
+
line?: number;
|
|
16
|
+
size: number;
|
|
17
|
+
count: number;
|
|
18
|
+
/** The runtime's own name for the allocated type; absent when it attributes allocations to lines only. */
|
|
19
|
+
typeName?: string;
|
|
20
|
+
}
|
|
21
|
+
/** Memory snapshot result from the LSP. */
|
|
22
|
+
export interface MemorySnapshotResult {
|
|
23
|
+
memorySessionId: string;
|
|
24
|
+
snapshotId: string;
|
|
25
|
+
currentMemory: number;
|
|
26
|
+
peakMemory: number;
|
|
27
|
+
topAllocations: MemoryAllocation[];
|
|
28
|
+
}
|
|
29
|
+
/** Leak confidence level matching the LSP's `LeakConfidence` enum. */
|
|
30
|
+
export type LeakConfidence = "LOW" | "MEDIUM" | "HIGH" | "DEFINITE";
|
|
31
|
+
/** Rank a confidence level so callers can pick the worst leak / gate on a threshold. */
|
|
32
|
+
export declare function confidenceRank(confidence: LeakConfidence): number;
|
|
33
|
+
/** Per-line suspected leak data from the LSP diff diagnostics. */
|
|
34
|
+
export interface SuspectedLeak {
|
|
35
|
+
file: string;
|
|
36
|
+
line: number;
|
|
37
|
+
sizeGrowth: number;
|
|
38
|
+
countGrowth: number;
|
|
39
|
+
currentSize: number;
|
|
40
|
+
confidence: LeakConfidence;
|
|
41
|
+
reason: string;
|
|
42
|
+
/** The runtime's own name for the growing type, or empty when it reports none. */
|
|
43
|
+
typeName: string;
|
|
44
|
+
}
|
|
45
|
+
/** Memory diff result from the LSP. */
|
|
46
|
+
export interface MemoryDiffResult {
|
|
47
|
+
totalGrowth: number;
|
|
48
|
+
totalFreed: number;
|
|
49
|
+
netGrowth: number;
|
|
50
|
+
suspectedLeaks: SuspectedLeak[];
|
|
51
|
+
}
|
|
52
|
+
/** The memory/leak decorations currently applied across visible editors. */
|
|
53
|
+
export declare function appliedMemoryDecorations(): readonly AppliedDecoration[];
|
|
54
|
+
/** Apply memory allocation decorations to visible editors; a new snapshot drops the last diff's badges. */
|
|
55
|
+
export declare function applyMemoryDecorations(result: MemorySnapshotResult): Promise<void>;
|
|
56
|
+
/** Apply leak indicator decorations with confidence badges, replacing the last diff's. */
|
|
57
|
+
export declare function applyLeakDecorations(result: MemoryDiffResult): Promise<void>;
|
|
58
|
+
/** Clear all memory decorations from visible editors. */
|
|
59
|
+
export declare function clearMemoryDecorations(): void;
|
|
60
|
+
/** Dispose all memory decoration types. */
|
|
61
|
+
export declare function disposeMemoryDecorations(): void;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Inline memory allocation decorations for memory profiling.
|
|
5
|
+
*
|
|
6
|
+
* After a memory snapshot, hot allocation lines get decorations showing
|
|
7
|
+
* allocation size and count, in the host palette's memory ramp (memory,
|
|
8
|
+
* memoryHot, memoryWarm, memoryCool by size); a suspected leak wears the
|
|
9
|
+
* palette's leak, warm or memory colour by confidence ([PROF-UI-PALETTE]).
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.confidenceRank = confidenceRank;
|
|
46
|
+
exports.appliedMemoryDecorations = appliedMemoryDecorations;
|
|
47
|
+
exports.applyMemoryDecorations = applyMemoryDecorations;
|
|
48
|
+
exports.applyLeakDecorations = applyLeakDecorations;
|
|
49
|
+
exports.clearMemoryDecorations = clearMemoryDecorations;
|
|
50
|
+
exports.disposeMemoryDecorations = disposeMemoryDecorations;
|
|
51
|
+
const palette_1 = require("./palette");
|
|
52
|
+
const vscode = __importStar(require("vscode"));
|
|
53
|
+
const logger_1 = require("./logger");
|
|
54
|
+
const profiler_decorations_1 = require("./profiler-decorations");
|
|
55
|
+
const editor_path_key_1 = require("./editor-path-key");
|
|
56
|
+
const profiler_styles_1 = require("./profiler-styles");
|
|
57
|
+
/** Severity ordering for leak confidence (Low < Medium < High < Definite). */
|
|
58
|
+
const CONFIDENCE_SEVERITY = ["LOW", "MEDIUM", "HIGH", "DEFINITE"];
|
|
59
|
+
/** Rank a confidence level so callers can pick the worst leak / gate on a threshold. */
|
|
60
|
+
function confidenceRank(confidence) {
|
|
61
|
+
return CONFIDENCE_SEVERITY.indexOf(confidence) + 1;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* One layer of the memory track, with its own decoration types and its own
|
|
65
|
+
* ledger. The allocation track and the leak badges are separate layers: a diff
|
|
66
|
+
* replaces the last diff's badges and never touches the allocations, even where
|
|
67
|
+
* a badge and an allocation share a colour.
|
|
68
|
+
*/
|
|
69
|
+
class MemoryLayer {
|
|
70
|
+
types = new Map();
|
|
71
|
+
applied = [];
|
|
72
|
+
get decorations() { return this.applied; }
|
|
73
|
+
/** Replace this layer's paint with `lines`, on every visible editor. */
|
|
74
|
+
async paint(lines) {
|
|
75
|
+
this.clear();
|
|
76
|
+
// Keyed, not compared raw: tracemalloc reports the interpreter's own
|
|
77
|
+
// filename and the editor reports what VS Code resolved. On win32 those
|
|
78
|
+
// differ in drive-letter case and 8.3 short components, so a raw compare
|
|
79
|
+
// matches nothing and the memory track silently paints nothing at all
|
|
80
|
+
// ([PROF-TESTING]).
|
|
81
|
+
const editors = vscode.window.visibleTextEditors;
|
|
82
|
+
const keyOf = await (0, editor_path_key_1.rowAndEditorKeyer)(lines, editors);
|
|
83
|
+
const byFile = (0, editor_path_key_1.groupByFile)(lines, keyOf);
|
|
84
|
+
for (const editor of editors) {
|
|
85
|
+
const painted = byFile.get(keyOf(editor.document.uri.fsPath));
|
|
86
|
+
if (painted !== undefined) {
|
|
87
|
+
this.paintEditor(editor, painted);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
clear() {
|
|
92
|
+
for (const decorationType of this.types.values()) {
|
|
93
|
+
for (const editor of vscode.window.visibleTextEditors) {
|
|
94
|
+
editor.setDecorations(decorationType, []);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
this.applied = [];
|
|
98
|
+
}
|
|
99
|
+
dispose() {
|
|
100
|
+
for (const decorationType of this.types.values()) {
|
|
101
|
+
decorationType.dispose();
|
|
102
|
+
}
|
|
103
|
+
this.types.clear();
|
|
104
|
+
this.applied = [];
|
|
105
|
+
}
|
|
106
|
+
paintEditor(editor, lines) {
|
|
107
|
+
const optionsByColor = new Map();
|
|
108
|
+
for (const line of lines) {
|
|
109
|
+
const option = lineOption(editor.document, line);
|
|
110
|
+
if (option !== undefined) {
|
|
111
|
+
optionsByColor.set(line.color, [...(optionsByColor.get(line.color) ?? []), option]);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
for (const [color, options] of optionsByColor) {
|
|
115
|
+
editor.setDecorations(this.typeFor(color), options);
|
|
116
|
+
}
|
|
117
|
+
(0, profiler_decorations_1.recordApplied)(this.applied, editor.document.uri.fsPath, optionsByColor);
|
|
118
|
+
}
|
|
119
|
+
typeFor(color) {
|
|
120
|
+
const existing = this.types.get(color);
|
|
121
|
+
if (existing !== undefined) {
|
|
122
|
+
return existing;
|
|
123
|
+
}
|
|
124
|
+
const created = vscode.window.createTextEditorDecorationType({
|
|
125
|
+
overviewRulerColor: color,
|
|
126
|
+
overviewRulerLane: vscode.OverviewRulerLane.Right,
|
|
127
|
+
isWholeLine: false,
|
|
128
|
+
after: {
|
|
129
|
+
margin: "0 0 0 2em",
|
|
130
|
+
fontStyle: "normal",
|
|
131
|
+
fontWeight: "500",
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
this.types.set(color, created);
|
|
135
|
+
return created;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/** The whole-line decoration for `line`, or nothing when the document has no such line. */
|
|
139
|
+
function lineOption(document, line) {
|
|
140
|
+
const lineIdx = line.line - 1;
|
|
141
|
+
if (lineIdx < 0 || lineIdx >= document.lineCount) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
range: new vscode.Range(new vscode.Position(lineIdx, 0), new vscode.Position(lineIdx, document.lineAt(lineIdx).text.length)),
|
|
146
|
+
renderOptions: { after: { contentText: line.text, color: line.color } },
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const allocationLayer = new MemoryLayer();
|
|
150
|
+
const leakLayer = new MemoryLayer();
|
|
151
|
+
/** The memory/leak decorations currently applied across visible editors. */
|
|
152
|
+
function appliedMemoryDecorations() {
|
|
153
|
+
return [...allocationLayer.decorations, ...leakLayer.decorations];
|
|
154
|
+
}
|
|
155
|
+
// ── Formatting ────────────────────────────────────────────────────────────
|
|
156
|
+
/** Threshold for "critical" memory allocation color (100 MiB). */
|
|
157
|
+
const MEM_CRITICAL_THRESHOLD = 104_857_600;
|
|
158
|
+
/** Threshold for "hot" memory allocation color (10 MiB). */
|
|
159
|
+
const MEM_HOT_THRESHOLD = 10_485_760;
|
|
160
|
+
/** Threshold for "warm" memory allocation color (1 MiB). */
|
|
161
|
+
const MEM_WARM_THRESHOLD = 1_048_576;
|
|
162
|
+
function memColor(size) {
|
|
163
|
+
const palette = (0, palette_1.profilerPalette)();
|
|
164
|
+
if (size >= MEM_CRITICAL_THRESHOLD) {
|
|
165
|
+
return palette.memory;
|
|
166
|
+
}
|
|
167
|
+
if (size >= MEM_HOT_THRESHOLD) {
|
|
168
|
+
return palette.memoryHot;
|
|
169
|
+
}
|
|
170
|
+
if (size >= MEM_WARM_THRESHOLD) {
|
|
171
|
+
return palette.memoryWarm ?? palette.memoryHot;
|
|
172
|
+
}
|
|
173
|
+
return palette.memoryCool ?? palette.memoryHot;
|
|
174
|
+
}
|
|
175
|
+
/** The host's colour for a leak of `confidence`, as the dashboard's badges draw it ([PROF-UI-PALETTE]). */
|
|
176
|
+
function leakColor(confidence) {
|
|
177
|
+
const palette = (0, palette_1.profilerPalette)();
|
|
178
|
+
switch (confidence) {
|
|
179
|
+
case "DEFINITE":
|
|
180
|
+
case "HIGH": {
|
|
181
|
+
return palette.leak;
|
|
182
|
+
}
|
|
183
|
+
case "MEDIUM": {
|
|
184
|
+
return palette.warm;
|
|
185
|
+
}
|
|
186
|
+
// Warming up: not yet a leak.
|
|
187
|
+
case "LOW": {
|
|
188
|
+
return palette.memoryHot;
|
|
189
|
+
}
|
|
190
|
+
default: {
|
|
191
|
+
return palette.memoryHot;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function confidenceBadge(confidence) {
|
|
196
|
+
switch (confidence) {
|
|
197
|
+
case "DEFINITE": {
|
|
198
|
+
return "\u26D4 DEFINITE";
|
|
199
|
+
}
|
|
200
|
+
case "HIGH": {
|
|
201
|
+
return "\u26A0 HIGH";
|
|
202
|
+
}
|
|
203
|
+
case "MEDIUM": {
|
|
204
|
+
return "\u25CF MEDIUM";
|
|
205
|
+
}
|
|
206
|
+
case "LOW": {
|
|
207
|
+
return "\u25CB LOW";
|
|
208
|
+
}
|
|
209
|
+
default: {
|
|
210
|
+
return "\u25CB LOW";
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// ── Public API ────────────────────────────────────────────────────────────
|
|
215
|
+
/** Apply memory allocation decorations to visible editors; a new snapshot drops the last diff's badges. */
|
|
216
|
+
async function applyMemoryDecorations(result) {
|
|
217
|
+
leakLayer.clear();
|
|
218
|
+
// A site with no location still lists in the dashboard but paints no line.
|
|
219
|
+
await allocationLayer.paint(result.topAllocations.flatMap(({ file, line, size, count }) => file === undefined || line === undefined ? [] : [{
|
|
220
|
+
file,
|
|
221
|
+
line,
|
|
222
|
+
color: memColor(size),
|
|
223
|
+
text: ` \u2588\u2588\u2588\u2588 ${(0, profiler_styles_1.formatBytes)(size)} allocated (${String(count)} objects)`,
|
|
224
|
+
}]));
|
|
225
|
+
logger_1.Logger.info(`Memory decorations applied: ${String(result.topAllocations.length)} allocations`);
|
|
226
|
+
}
|
|
227
|
+
/** Apply leak indicator decorations with confidence badges, replacing the last diff's. */
|
|
228
|
+
async function applyLeakDecorations(result) {
|
|
229
|
+
await leakLayer.paint(result.suspectedLeaks.map((leak) => ({
|
|
230
|
+
file: leak.file,
|
|
231
|
+
line: leak.line,
|
|
232
|
+
color: leakColor(leak.confidence),
|
|
233
|
+
text: ` ${confidenceBadge(leak.confidence)} +${(0, profiler_styles_1.formatBytes)(Math.abs(leak.sizeGrowth))} leak (${String(leak.countGrowth)} objects)`,
|
|
234
|
+
})));
|
|
235
|
+
logger_1.Logger.info(`Leak decorations applied: ${String(result.suspectedLeaks.length)} suspected leaks`);
|
|
236
|
+
}
|
|
237
|
+
/** Clear all memory decorations from visible editors. */
|
|
238
|
+
function clearMemoryDecorations() {
|
|
239
|
+
allocationLayer.clear();
|
|
240
|
+
leakLayer.clear();
|
|
241
|
+
}
|
|
242
|
+
/** Dispose all memory decoration types. */
|
|
243
|
+
function disposeMemoryDecorations() {
|
|
244
|
+
allocationLayer.dispose();
|
|
245
|
+
leakLayer.dispose();
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=memory-decorations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-decorations.js","sourceRoot":"","sources":["../../src/memory-decorations.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH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C,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACzD,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;QACjC,IAAI,EAAE,IAAI,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,IAAA,6BAAW,EAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,UAAU,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW;KACnI,CAAC,CAAC,CAAC,CAAC;IACL,eAAM,CAAC,IAAI,CAAC,6BAA6B,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;AACnG,CAAC;AAED,yDAAyD;AACzD;IACE,eAAe,CAAC,KAAK,EAAE,CAAC;IACxB,SAAS,CAAC,KAAK,EAAE,CAAC;AACpB,CAAC;AAED,2CAA2C;AAC3C;IACE,eAAe,CAAC,OAAO,EAAE,CAAC;IAC1B,SAAS,CAAC,OAAO,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ending memory tracking: a manual stop, and the tracked debug session's end,
|
|
3
|
+
* which turns the run into a visible result. Stopping never silently produces
|
|
4
|
+
* nothing (#146).
|
|
5
|
+
*/
|
|
6
|
+
import * as vscode from "vscode";
|
|
7
|
+
import type { ProfilerStore as Store } from "./store";
|
|
8
|
+
/** Forget every pending cleanup (disposal). */
|
|
9
|
+
export declare function clearPendingSnapshotCleanup(): void;
|
|
10
|
+
/** Schedule the tracked session's at-exit file for deletion when that session ends. */
|
|
11
|
+
export declare function scheduleSnapshotCleanup(store: Store): void;
|
|
12
|
+
/**
|
|
13
|
+
* Show a toast whose named action is offered as a button — a message must
|
|
14
|
+
* never demand an action it doesn't offer ([PROF-UI-MEMORY], #263).
|
|
15
|
+
* Fire-and-forget: a sticky notification must not block the flow.
|
|
16
|
+
*/
|
|
17
|
+
export declare function showActionableToast(message: string, action: string, command: string): void;
|
|
18
|
+
/** Settle the UI's tracking state to idle. */
|
|
19
|
+
export declare function handleMemoryStop(store: Store): void;
|
|
20
|
+
/**
|
|
21
|
+
* A debug session ended. Only the *tracked* session's end finalises the run
|
|
22
|
+
* ([PROF-PY-MEMORY-FINAL], #146); an unrelated session never tears down live
|
|
23
|
+
* tracking. A manually stopped session deletes its orphaned at-exit file.
|
|
24
|
+
*/
|
|
25
|
+
export declare function settleMemoryOnSessionEnd(store: Store, session: vscode.DebugSession): void;
|