@nimblesite/lsp-profiler-ui 0.0.0-stage → 0.0.1
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,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI-PROCESSES]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* The centralised, reactive state of the Processes panel (#148).
|
|
5
|
+
*
|
|
6
|
+
* The panel used to own its data privately — `this.processes`, `this.fetched`,
|
|
7
|
+
* sort/group/filter fields — and refresh itself on a panel-local timer. Per the
|
|
8
|
+
* architecture (CLAUDE.md: all mutable state lives in the single store as
|
|
9
|
+
* Signals; no panel polls itself), that state is hoisted here: the store owns
|
|
10
|
+
* one `ProcessPanelState` Signal, the store-side poll (process-poll.ts) feeds
|
|
11
|
+
* it, and the tree provider renders it as a pure projection, subscribing via
|
|
12
|
+
* `subscribeRevision` exactly like the Modules panel.
|
|
13
|
+
*
|
|
14
|
+
* Defined outside store.ts so the store file only grows by the signal wiring,
|
|
15
|
+
* not the type surface and action bodies (the profiler-state.ts pattern).
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.IDLE_PROCESS_PANEL = void 0;
|
|
19
|
+
exports.createProcessPanelActions = createProcessPanelActions;
|
|
20
|
+
const process_explorer_rows_1 = require("./process-explorer-rows");
|
|
21
|
+
/**
|
|
22
|
+
* The initial state: nothing fetched yet, so the welcome honestly says "loading".
|
|
23
|
+
* Rows open grouped by runtime version ([PROF-UI-PROCESSES]).
|
|
24
|
+
*/
|
|
25
|
+
exports.IDLE_PROCESS_PANEL = {
|
|
26
|
+
list: [],
|
|
27
|
+
fetch: "loading",
|
|
28
|
+
sortMode: "cpu",
|
|
29
|
+
groupMode: "version",
|
|
30
|
+
filterText: "",
|
|
31
|
+
activeDebuggeePid: undefined,
|
|
32
|
+
revision: 0,
|
|
33
|
+
};
|
|
34
|
+
/** The mode after `current` in `cycle`, wrapping round. */
|
|
35
|
+
function nextInCycle(cycle, current) {
|
|
36
|
+
return cycle[(cycle.indexOf(current) + 1) % cycle.length] ?? current;
|
|
37
|
+
}
|
|
38
|
+
/** Apply `next` to the panel state, bumping its revision so every subscribed panel repaints (#148). */
|
|
39
|
+
function patchPanel(panel, next) {
|
|
40
|
+
panel.value = { ...panel.value, ...next, revision: panel.value.revision + 1 };
|
|
41
|
+
}
|
|
42
|
+
/** Build the process-panel actions over the store's backing Signal. */
|
|
43
|
+
function createProcessPanelActions(panel) {
|
|
44
|
+
const patch = (next) => { patchPanel(panel, next); };
|
|
45
|
+
return { ...fetchActions(patch), ...viewActions(panel, patch) };
|
|
46
|
+
}
|
|
47
|
+
/** What each fetch outcome leaves in the panel (#147). */
|
|
48
|
+
function fetchActions(patch) {
|
|
49
|
+
return {
|
|
50
|
+
processesLoading() { patch({ list: [], fetch: "loading" }); },
|
|
51
|
+
processesLoaded(list) { patch({ list, fetch: "loaded" }); },
|
|
52
|
+
processesFetchFailed() { patch({ list: [], fetch: "error" }); },
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** How the user arranges the rows, and which row is the debuggee. */
|
|
56
|
+
function viewActions(panel, patch) {
|
|
57
|
+
return {
|
|
58
|
+
cycleProcessSort() {
|
|
59
|
+
const sortMode = nextInCycle(process_explorer_rows_1.SORT_CYCLE, panel.value.sortMode);
|
|
60
|
+
patch({ sortMode });
|
|
61
|
+
return sortMode;
|
|
62
|
+
},
|
|
63
|
+
cycleProcessGroup() {
|
|
64
|
+
const groupMode = nextInCycle(process_explorer_rows_1.GROUP_CYCLE, panel.value.groupMode);
|
|
65
|
+
patch({ groupMode });
|
|
66
|
+
return groupMode;
|
|
67
|
+
},
|
|
68
|
+
setProcessFilter(text) { patch({ filterText: text.trim().toLowerCase() }); },
|
|
69
|
+
setActiveDebuggeePid(pid) {
|
|
70
|
+
if (panel.value.activeDebuggeePid !== pid) {
|
|
71
|
+
patch({ activeDebuggeePid: pid });
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=processes-state.js.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C,CAAC,CAAC,CAAC;QAC7D,eAAe,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3D,oBAAoB,KAAK,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;KAChE,CAAC;AACJ,CAAC;AAED,qEAAqE;AACrE,SAAS,WAAW,CAAC,KAAgC,EAAE,KAAY;IACjE,OAAO;QACL,gBAAgB;YACd,MAAM,QAAQ,GAAG,WAAW,CAAC,kCAAU,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC/D,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;YACpB,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,iBAAiB;YACf,MAAM,SAAS,GAAG,WAAW,CAAC,mCAAW,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAClE,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;YACrB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,gBAAgB,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5E,oBAAoB,CAAC,GAAG;YACtB,IAAI,KAAK,CAAC,KAAK,CAAC,iBAAiB,KAAK,GAAG,EAAE,CAAC;gBAAC,KAAK,CAAC,EAAE,iBAAiB,EAAE,GAAG,EAAE,CAAC,CAAC;YAAC,CAAC;QACnF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type * as vscode from "vscode";
|
|
2
|
+
import type { ProfilerStore as Store } from "./store";
|
|
3
|
+
/** "Profile on Launch": profile a debug session that asked for it while the CPU leg is idle. */
|
|
4
|
+
export declare function profileOnLaunch(store: Store, session: vscode.DebugSession): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.profileOnLaunch = profileOnLaunch;
|
|
4
|
+
const logger_1 = require("./logger");
|
|
5
|
+
const profiler_launch_1 = require("./profiler-launch");
|
|
6
|
+
const profiler_launch_cooperative_1 = require("./profiler-launch-cooperative");
|
|
7
|
+
/** "Profile on Launch": profile a debug session that asked for it while the CPU leg is idle. */
|
|
8
|
+
function profileOnLaunch(store, session) {
|
|
9
|
+
if (!(0, profiler_launch_1.shouldProfileOnLaunch)(session) || store.profiler.value.cpu !== "idle") {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
logger_1.Logger.info(`Profile on Launch: auto-profiling debug session ${session.id}`);
|
|
13
|
+
(0, profiler_launch_cooperative_1.notifyBreakpointsSuppressedForProfiling)();
|
|
14
|
+
void (0, profiler_launch_cooperative_1.startProfilerOnLaunch)(store, session.id);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=profile-on-launch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-on-launch.js","sourceRoot":"","sources":["../../src/profile-on-launch.ts"],"names":[],"mappings":";;;AAEA,qCAAkC;AAClC,uDAA0D;AAE1D,+EAA+G;AAE/G,gGAAgG;AAChG,yBAAgC,KAAY,EAAE,OAA4B;IACxE,IAAI,CAAC,IAAA,uCAAqB,EAAC,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,MAAM,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IACvF,eAAM,CAAC,IAAI,CAAC,mDAAmD,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7E,IAAA,qEAAuC,GAAE,CAAC;IAC1C,KAAK,IAAA,mDAAqB,EAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loopback HTTP server that makes exported profiles readable by speedscope.app.
|
|
3
|
+
*
|
|
4
|
+
* speedscope.app is served over https and can never read `file://` URLs, so a
|
|
5
|
+
* `#profileURL=file://…` deep link always dead-ends on "Something went wrong".
|
|
6
|
+
* Browsers do, however, treat loopback as a potentially-trustworthy origin an
|
|
7
|
+
* https page may fetch from — so this module serves each exported profile over
|
|
8
|
+
* `http://127.0.0.1:<port>/<token>/profile.json` and the speedscope deep link
|
|
9
|
+
* loads it automatically instead of demanding a manual drag-and-drop.
|
|
10
|
+
*
|
|
11
|
+
* Containment: bound to 127.0.0.1 only, one unguessable token per registered
|
|
12
|
+
* file, GET only, CORS open (speedscope's importer fetches cross-origin),
|
|
13
|
+
* `no-store`, registrations expire so a forgotten server never keeps a stale
|
|
14
|
+
* profile reachable, and the whole server tears down with the extension.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Register `filePath` with the loopback server and return the `http://127.0.0.1`
|
|
18
|
+
* URL speedscope can fetch it from. Starts the server on first use.
|
|
19
|
+
*
|
|
20
|
+
* `ttlMs` is a test seam — production callers use the default.
|
|
21
|
+
*/
|
|
22
|
+
export declare function serveProfileForBrowser(filePath: string, ttlMs?: number): Promise<string>;
|
|
23
|
+
/** Stop the server and forget every registration (extension teardown). */
|
|
24
|
+
export declare function disposeProfileServer(): void;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI-WEBVIEW]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Loopback HTTP server that makes exported profiles readable by speedscope.app.
|
|
5
|
+
*
|
|
6
|
+
* speedscope.app is served over https and can never read `file://` URLs, so a
|
|
7
|
+
* `#profileURL=file://…` deep link always dead-ends on "Something went wrong".
|
|
8
|
+
* Browsers do, however, treat loopback as a potentially-trustworthy origin an
|
|
9
|
+
* https page may fetch from — so this module serves each exported profile over
|
|
10
|
+
* `http://127.0.0.1:<port>/<token>/profile.json` and the speedscope deep link
|
|
11
|
+
* loads it automatically instead of demanding a manual drag-and-drop.
|
|
12
|
+
*
|
|
13
|
+
* Containment: bound to 127.0.0.1 only, one unguessable token per registered
|
|
14
|
+
* file, GET only, CORS open (speedscope's importer fetches cross-origin),
|
|
15
|
+
* `no-store`, registrations expire so a forgotten server never keeps a stale
|
|
16
|
+
* profile reachable, and the whole server tears down with the extension.
|
|
17
|
+
*/
|
|
18
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
21
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
22
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
23
|
+
}
|
|
24
|
+
Object.defineProperty(o, k2, desc);
|
|
25
|
+
}) : (function(o, m, k, k2) {
|
|
26
|
+
if (k2 === undefined) k2 = k;
|
|
27
|
+
o[k2] = m[k];
|
|
28
|
+
}));
|
|
29
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
30
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
31
|
+
}) : function(o, v) {
|
|
32
|
+
o["default"] = v;
|
|
33
|
+
});
|
|
34
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
35
|
+
var ownKeys = function(o) {
|
|
36
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
37
|
+
var ar = [];
|
|
38
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
39
|
+
return ar;
|
|
40
|
+
};
|
|
41
|
+
return ownKeys(o);
|
|
42
|
+
};
|
|
43
|
+
return function (mod) {
|
|
44
|
+
if (mod && mod.__esModule) return mod;
|
|
45
|
+
var result = {};
|
|
46
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
47
|
+
__setModuleDefault(result, mod);
|
|
48
|
+
return result;
|
|
49
|
+
};
|
|
50
|
+
})();
|
|
51
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
52
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
53
|
+
};
|
|
54
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
+
exports.serveProfileForBrowser = serveProfileForBrowser;
|
|
56
|
+
exports.disposeProfileServer = disposeProfileServer;
|
|
57
|
+
const node_crypto_1 = require("node:crypto");
|
|
58
|
+
const node_events_1 = require("node:events");
|
|
59
|
+
const promises_1 = require("node:fs/promises");
|
|
60
|
+
const http = __importStar(require("node:http"));
|
|
61
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
62
|
+
const logger_1 = require("./logger");
|
|
63
|
+
const failure_1 = require("./failure");
|
|
64
|
+
/** How long a registered profile stays fetchable (10 minutes). */
|
|
65
|
+
const REGISTRATION_TTL_MS = 600_000;
|
|
66
|
+
/** Entropy (bytes) for the per-profile URL token. */
|
|
67
|
+
const TOKEN_BYTES = 16;
|
|
68
|
+
/** HTTP status codes used by the loopback server. */
|
|
69
|
+
const HTTP_OK = 200;
|
|
70
|
+
const HTTP_NOT_FOUND = 404;
|
|
71
|
+
const serverState = { server: undefined, serverPort: undefined };
|
|
72
|
+
const registrations = new Map();
|
|
73
|
+
/**
|
|
74
|
+
* Register `filePath` with the loopback server and return the `http://127.0.0.1`
|
|
75
|
+
* URL speedscope can fetch it from. Starts the server on first use.
|
|
76
|
+
*
|
|
77
|
+
* `ttlMs` is a test seam — production callers use the default.
|
|
78
|
+
*/
|
|
79
|
+
async function serveProfileForBrowser(filePath, ttlMs = REGISTRATION_TTL_MS) {
|
|
80
|
+
const port = await ensureServer();
|
|
81
|
+
pruneExpired();
|
|
82
|
+
const token = (0, node_crypto_1.randomBytes)(TOKEN_BYTES).toString("hex");
|
|
83
|
+
registrations.set(token, { filePath, expiresAt: Date.now() + ttlMs });
|
|
84
|
+
// The URL carries the real basename — speedscope falls back to
|
|
85
|
+
// extension-based format detection (`.heapprofile` vs speedscope JSON).
|
|
86
|
+
return `http://127.0.0.1:${String(port)}/${token}/${encodeURIComponent(node_path_1.default.basename(filePath))}`;
|
|
87
|
+
}
|
|
88
|
+
/** Stop the server and forget every registration (extension teardown). */
|
|
89
|
+
function disposeProfileServer() {
|
|
90
|
+
serverState.server?.close();
|
|
91
|
+
serverState.server = undefined;
|
|
92
|
+
serverState.serverPort = undefined;
|
|
93
|
+
registrations.clear();
|
|
94
|
+
}
|
|
95
|
+
/** Start the loopback server if needed and resolve its port. */
|
|
96
|
+
async function ensureServer() {
|
|
97
|
+
if (serverState.server !== undefined && serverState.serverPort !== undefined) {
|
|
98
|
+
return serverState.serverPort;
|
|
99
|
+
}
|
|
100
|
+
const created = http.createServer((req, res) => {
|
|
101
|
+
void handleRequest(req, res);
|
|
102
|
+
});
|
|
103
|
+
created.on("error", (error) => {
|
|
104
|
+
logger_1.Logger.warn(`Profile loopback server error: ${error.message}`);
|
|
105
|
+
});
|
|
106
|
+
// Port 0 = ephemeral; loopback only — never reachable off-machine.
|
|
107
|
+
created.listen(0, "127.0.0.1");
|
|
108
|
+
await (0, node_events_1.once)(created, "listening");
|
|
109
|
+
return adoptListening(created);
|
|
110
|
+
}
|
|
111
|
+
/** Keep the server once it is listening on a port; one bound without a port is closed. */
|
|
112
|
+
function adoptListening(created) {
|
|
113
|
+
const address = created.address();
|
|
114
|
+
if (address === null || typeof address === "string") {
|
|
115
|
+
created.close();
|
|
116
|
+
throw new Error("profile loopback server bound without a port");
|
|
117
|
+
}
|
|
118
|
+
serverState.server = created;
|
|
119
|
+
serverState.serverPort = address.port;
|
|
120
|
+
return address.port;
|
|
121
|
+
}
|
|
122
|
+
/** Speedscope.app fetches cross-origin; the token is the access control. */
|
|
123
|
+
const PROFILE_HEADERS = {
|
|
124
|
+
"Content-Type": "application/json",
|
|
125
|
+
"Access-Control-Allow-Origin": "*",
|
|
126
|
+
"Cache-Control": "no-store",
|
|
127
|
+
};
|
|
128
|
+
/** Serve a registered profile by token; anything else is a 404. */
|
|
129
|
+
async function handleRequest(req, res) {
|
|
130
|
+
const registration = req.method === "GET" ? lookupRegistration(req.url ?? "") : undefined;
|
|
131
|
+
if (registration === undefined) {
|
|
132
|
+
res.writeHead(HTTP_NOT_FOUND).end();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
const body = await (0, promises_1.readFile)(registration.filePath);
|
|
137
|
+
res.writeHead(HTTP_OK, PROFILE_HEADERS);
|
|
138
|
+
res.end(body);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
logger_1.Logger.warn(`Profile loopback server could not read ${registration.filePath}: ${(0, failure_1.errorText)(error)}`);
|
|
142
|
+
res.writeHead(HTTP_NOT_FOUND).end();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/** Resolve a request path to its live registration, dropping expired ones. */
|
|
146
|
+
function lookupRegistration(url) {
|
|
147
|
+
const token = url.split("/").find((segment) => segment.length === TOKEN_BYTES * 2);
|
|
148
|
+
if (token === undefined) {
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
const registration = registrations.get(token);
|
|
152
|
+
if (registration === undefined) {
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
if (registration.expiresAt <= Date.now()) {
|
|
156
|
+
registrations.delete(token);
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
return registration;
|
|
160
|
+
}
|
|
161
|
+
/** Drop expired registrations so the map never grows unboundedly. */
|
|
162
|
+
function pruneExpired() {
|
|
163
|
+
const now = Date.now();
|
|
164
|
+
for (const [token, registration] of registrations) {
|
|
165
|
+
if (registration.expiresAt <= now) {
|
|
166
|
+
registrations.delete(token);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=profile-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-server.js","sourceRoot":"","sources":["../../src/profile-server.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA0C;AAC1C,6CAAmC;AACnC,+CAA4C;AAC5C,MAAY,IAAI,sCAAkB;AAClC,0DAA6B;AAC7B,qCAAkC;AAClC,uCAAsC;AAEtC,kEAAkE;AAClE,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAEpC,qDAAqD;AACrD,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,qDAAqD;AACrD,MAAM,OAAO,GAAG,GAAG,CAAC;AACpB,MAAM,cAAc,GAAG,GAAG,CAAC;AAa3B,MAAM,WAAW,GAAwB,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AACtF,MAAM,aAAa,GAAG,IAAI,GAAG,EAAwB,CAAC;AAEtD;;;;;GAKG;AACI,KAAK,iCACV,QAAgB,EAChB,KAAK,GAAW,mBAAmB;IAEnC,MAAM,IAAI,GAAG,MAAM,YAAY,EAAE,CAAC;IAClC,YAAY,EAAE,CAAC;IACf,MAAM,KAAK,GAAG,IAAA,yBAAW,EAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvD,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IACtE,+DAA+D;IAC/D,wEAAwE;IACxE,OAAO,oBAAoB,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,kBAAkB,CAAC,mBAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;AACpG,CAAC;AAED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AAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9C,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,YAAY,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QACzC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,qEAAqE;AACrE,SAAS,YAAY;IACnB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,KAAK,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,aAAa,EAAE,CAAC;QAClD,IAAI,YAAY,CAAC,SAAS,IAAI,GAAG,EAAE,CAAC;YAClC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Starting a CPU session: from the Processes panel, from a debug session and
|
|
3
|
+
* on launch. Every start adopts its session into the store, whose signal drives
|
|
4
|
+
* the status bar, the panel chrome and the stop/snapshot/progress routing.
|
|
5
|
+
*/
|
|
6
|
+
import type { ProfilerStore as Store } from "./store";
|
|
7
|
+
export { CPU_CMD } from "./profiler-session-core";
|
|
8
|
+
export { profileOnLaunch } from "./profile-on-launch";
|
|
9
|
+
/**
|
|
10
|
+
* Start profiling a specific PID: the panel's one-click path. The LSP resolves
|
|
11
|
+
* `preset` server-side; the sampler settings apply when the preset is
|
|
12
|
+
* `"default"`. Implements [PROF-UI-PROCESSES].
|
|
13
|
+
*/
|
|
14
|
+
export declare function startProfilingForPid(store: Store, pid: number, preset: string): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Profile the active debug session's debuggee: the PID captured from the DAP
|
|
17
|
+
* `process` event, so the sampler profiles the process the debugger is on.
|
|
18
|
+
*/
|
|
19
|
+
export declare function handleProfileAttachToDebug(store: Store): Promise<void>;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI-STATE], [PROF-CPU-COOPERATIVE]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Starting a CPU session: from the Processes panel, from a debug session and
|
|
5
|
+
* on launch. Every start adopts its session into the store, whose signal drives
|
|
6
|
+
* the status bar, the panel chrome and the stop/snapshot/progress routing.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.profileOnLaunch = exports.CPU_CMD = void 0;
|
|
43
|
+
exports.startProfilingForPid = startProfilingForPid;
|
|
44
|
+
exports.handleProfileAttachToDebug = handleProfileAttachToDebug;
|
|
45
|
+
const vscode = __importStar(require("vscode"));
|
|
46
|
+
const ids_1 = require("./ids");
|
|
47
|
+
const failure_1 = require("./failure");
|
|
48
|
+
const progress_ops_1 = require("./progress-ops");
|
|
49
|
+
const server_command_1 = require("./server-command");
|
|
50
|
+
const profiler_session_core_1 = require("./profiler-session-core");
|
|
51
|
+
// Re-exported so the profiler keeps one import site for every CPU start seam.
|
|
52
|
+
var profiler_session_core_2 = require("./profiler-session-core");
|
|
53
|
+
Object.defineProperty(exports, "CPU_CMD", { enumerable: true, get: function () { return profiler_session_core_2.CPU_CMD; } });
|
|
54
|
+
var profile_on_launch_1 = require("./profile-on-launch");
|
|
55
|
+
Object.defineProperty(exports, "profileOnLaunch", { enumerable: true, get: function () { return profile_on_launch_1.profileOnLaunch; } });
|
|
56
|
+
/**
|
|
57
|
+
* The running client, when a CPU start may begin. Only the CPU leg blocks a CPU
|
|
58
|
+
* start: a CPU profile may begin while memory tracking is live, but never on
|
|
59
|
+
* top of another CPU profile ([PROF-UI-PROCESSES]). Otherwise the reason is shown.
|
|
60
|
+
*/
|
|
61
|
+
function clientForStart(store, busy) {
|
|
62
|
+
const client = store.client.value;
|
|
63
|
+
if (client?.isRunning() !== true) {
|
|
64
|
+
vscode.window.showWarningMessage(`${(0, ids_1.brand)()}: Language server not running.`);
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
if (store.cpuBusy.value) {
|
|
68
|
+
vscode.window.showWarningMessage(busy());
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
return client;
|
|
72
|
+
}
|
|
73
|
+
/** A "stop the current CPU session first" warning naming the active CPU profile. */
|
|
74
|
+
function busyMessage(store) {
|
|
75
|
+
const session = store.profiler.value;
|
|
76
|
+
const pid = session.cpuPid === undefined ? "" : ` PID ${String(session.cpuPid)}`;
|
|
77
|
+
return `${(0, ids_1.brand)()}: Already profiling${pid}. Stop the current CPU session first.`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Start profiling a specific PID: the panel's one-click path. The LSP resolves
|
|
81
|
+
* `preset` server-side; the sampler settings apply when the preset is
|
|
82
|
+
* `"default"`. Implements [PROF-UI-PROCESSES].
|
|
83
|
+
*/
|
|
84
|
+
async function startProfilingForPid(store, pid, preset) {
|
|
85
|
+
const client = clientForStart(store, () => busyMessage(store));
|
|
86
|
+
if (client === undefined) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
store.profilerStarting();
|
|
90
|
+
try {
|
|
91
|
+
await (0, progress_ops_1.withUserProgress)((0, profiler_session_core_1.cpuStartTitle)(), async (report) => {
|
|
92
|
+
report(`Attaching to PID ${String(pid)}…`);
|
|
93
|
+
const raw = await (0, server_command_1.executeServerCommand)(client, profiler_session_core_1.CPU_CMD.start, { pid, preset, ...(0, profiler_session_core_1.samplerSettings)() });
|
|
94
|
+
(0, profiler_session_core_1.adoptSession)(store, raw, (result) => `${(0, ids_1.brand)()}: Profiling PID ${String(result.pid)} (${result.runtime} ${result.runtimeVersion})`);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
(0, failure_1.reportFailure)("Profile start", error);
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
(0, profiler_session_core_1.settleStart)(store);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Profile the active debug session's debuggee: the PID captured from the DAP
|
|
106
|
+
* `process` event, so the sampler profiles the process the debugger is on.
|
|
107
|
+
*/
|
|
108
|
+
async function handleProfileAttachToDebug(store) {
|
|
109
|
+
const session = vscode.debug.activeDebugSession;
|
|
110
|
+
if (session === undefined) {
|
|
111
|
+
vscode.window.showWarningMessage(`${(0, ids_1.brand)()}: No active debug session to profile.`);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const client = clientForStart(store, () => `${(0, ids_1.brand)()}: Already profiling (session ${store.profiler.value.cpuSessionId ?? "?"}).`);
|
|
115
|
+
if (client === undefined) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
await attachToActiveDebuggee(store, client, session);
|
|
119
|
+
}
|
|
120
|
+
/** Resolve the active session's debuggee PID and start profiling it. */
|
|
121
|
+
async function attachToActiveDebuggee(store, client, session) {
|
|
122
|
+
const pid = store.getDebuggeeProcessId(session.id);
|
|
123
|
+
if (pid === undefined) {
|
|
124
|
+
vscode.window.showWarningMessage(`${(0, ids_1.brand)()}: The debuggee process isn't ready yet — let it start running, then run “Profile Debug Session” again.`);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
await (0, profiler_session_core_1.attachToDebuggee)(store, client, { pid });
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=profiler-attach.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler-attach.js","sourceRoot":"","sources":["../../src/profiler-attach.ts"],"names":[],"mappings":";AAAA,0FAA0F;AAC1F;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,MAAY,MAAM,mCAAe;AAEjC,+BAA8B;AAE9B,uCAA0C;AAC1C,iDAAkD;AAClD,qDAAwD;AAExD,mEAA+H;AAE/H,8EAA8E;AAC9E,iEAAkD;AAAzC,gHAAA,OA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,CAAC,CAAC;AACvD,CAAC;AAED,wEAAwE;AACxE,KAAK,UAAU,sBAAsB,CAAC,KAAY,EAAE,MAAsB,EAAE,OAA4B;IACtG,MAAM,GAAG,GAAG,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACnD,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAC9B,GAAG,IAAA,WAAK,GAAE,wGAAwG,CACnH,CAAC;QACF,OAAO;IACT,CAAC;IACD,MAAM,IAAA,wCAAgB,EAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The profiler command bodies: start (reveal the panel), stop, and snapshot.
|
|
3
|
+
*/
|
|
4
|
+
import type { ProfilerStore as Store } from "./store";
|
|
5
|
+
declare function handleProfileStart(): Promise<void>;
|
|
6
|
+
export declare function handleProfileStop(store: Store): Promise<void>;
|
|
7
|
+
export declare function handleProfileSnapshot(store: Store): Promise<void>;
|
|
8
|
+
export { handleProfileStart };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* The profiler command bodies: start (reveal the panel), stop, and snapshot.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.handleProfileStop = handleProfileStop;
|
|
41
|
+
exports.handleProfileSnapshot = handleProfileSnapshot;
|
|
42
|
+
exports.handleProfileStart = handleProfileStart;
|
|
43
|
+
const vscode = __importStar(require("vscode"));
|
|
44
|
+
const ids_1 = require("./ids");
|
|
45
|
+
const failure_1 = require("./failure");
|
|
46
|
+
const progress_ops_1 = require("./progress-ops");
|
|
47
|
+
const server_command_1 = require("./server-command");
|
|
48
|
+
const wire_adapters_1 = require("./wire-adapters");
|
|
49
|
+
const profiler_attach_1 = require("./profiler-attach");
|
|
50
|
+
const profiler_results_1 = require("./profiler-results");
|
|
51
|
+
async function handleProfileStart() {
|
|
52
|
+
// [PROF-UI-PROCESSES] #62: the profiler no longer asks the user to
|
|
53
|
+
// hand-type a PID (and there was never a real "auto-detect"). Reveal the
|
|
54
|
+
// Processes panel so they can pick a process — or run & profile the
|
|
55
|
+
// current file — and start profiling with one click.
|
|
56
|
+
await vscode.commands.executeCommand(`${(0, ids_1.viewId)()}.focus`);
|
|
57
|
+
vscode.window.showInformationMessage(`${(0, ids_1.brand)()}: Pick a process in the panel to profile, or run & profile the current file.`);
|
|
58
|
+
}
|
|
59
|
+
function activeSession(store) {
|
|
60
|
+
const client = store.client.value;
|
|
61
|
+
const sessionId = store.profiler.value.cpuSessionId;
|
|
62
|
+
if (client?.isRunning() !== true || sessionId === undefined) {
|
|
63
|
+
vscode.window.showWarningMessage(`${(0, ids_1.brand)()}: No active profiling session.`);
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
return { client, sessionId };
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Ask the server for the active session's report under a progress
|
|
70
|
+
* notification: collecting samples and writing artifacts takes a beat
|
|
71
|
+
* ([PROF-UI-STATE]).
|
|
72
|
+
*/
|
|
73
|
+
async function collectReport(active, command, progress) {
|
|
74
|
+
return (0, progress_ops_1.withUserProgress)(progress.title, async (report) => {
|
|
75
|
+
report(progress.step);
|
|
76
|
+
const raw = await (0, server_command_1.executeServerCommand)(active.client, command, { session_id: active.sessionId });
|
|
77
|
+
return raw === undefined ? undefined : (0, wire_adapters_1.toProfileResult)(raw);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async function handleProfileStop(store) {
|
|
81
|
+
const active = activeSession(store);
|
|
82
|
+
if (active === undefined) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const result = await collectReport(active, profiler_attach_1.CPU_CMD.stop, { title: `${(0, ids_1.brand)()}: Stopping profiler`, step: "Collecting results…" });
|
|
87
|
+
store.profilerStopped();
|
|
88
|
+
await (0, profiler_results_1.presentStopResult)(result);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
store.profilerStopped();
|
|
92
|
+
(0, failure_1.reportFailure)("Profile stop", error);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function handleProfileSnapshot(store) {
|
|
96
|
+
const active = activeSession(store);
|
|
97
|
+
if (active === undefined) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const result = await collectReport(active, profiler_attach_1.CPU_CMD.snapshot, { title: `${(0, ids_1.brand)()}: Taking profile snapshot`, step: "Collecting samples so far…" });
|
|
102
|
+
if (result !== undefined) {
|
|
103
|
+
await (0, profiler_results_1.announceSnapshot)(result);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
(0, failure_1.reportFailure)("Profile snapshot", error);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=profiler-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler-commands.js","sourceRoot":"","sources":["../../src/profiler-commands.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqFM,kBAAkB;AAnF3B,MAAY,MAAM,mCAAe;AACjC,+BAAsC;AAEtC,uCAA0C;AAC1C,iDAAkD;AAClD,qDAAwD;AACxD,mDAAkD;AAElD,uDAA4C;AAC5C,yDAAyE;AAIzE,KAAK,UAAU,kBAAkB;IAC/B,mEAAmE;IACnE,yEAAyE;IACzE,oEAAoE;IACpE,qDAAqD;IACrD,MAAM,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,IAAA,YAAM,GAAE,QAAQ,CAAC,CAAC;IAC1D,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAClC,GAAG,IAAA,WAAK,GAAE,8EAA8E,CACzF,CAAC;AACJ,CAAC;AAQD,SAAS,aAAa,CAAC,KAAY;IACjC,MAAM,MAAM,GAAG,KAAK,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