@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,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI-PROCESSES]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Pure helpers for the "profile on launch" flow: deciding whether a freshly
|
|
5
|
+
* started debug session should be auto-profiled, and waiting for the
|
|
6
|
+
* debuggee's PID to land. Stateless — the session flow stays in profiler.ts.
|
|
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.shouldProfileOnLaunch = shouldProfileOnLaunch;
|
|
43
|
+
exports.waitForDebuggeePid = waitForDebuggeePid;
|
|
44
|
+
exports.startWhenRuntimeReady = startWhenRuntimeReady;
|
|
45
|
+
const vscode = __importStar(require("vscode"));
|
|
46
|
+
const ids_1 = require("./ids");
|
|
47
|
+
const timeouts_1 = require("./timeouts");
|
|
48
|
+
const unknown_shape_1 = require("./unknown-shape");
|
|
49
|
+
/** [PROF-ERRORS] `UNSUPPORTED_RUNTIME`: no runtime recognises the PID (yet). */
|
|
50
|
+
const UNSUPPORTED_RUNTIME = -32_002;
|
|
51
|
+
/** Gap between start attempts while a launched program's runtime comes up. */
|
|
52
|
+
const RETRY_GAP_MS = 100;
|
|
53
|
+
/**
|
|
54
|
+
* Whether a freshly started debug session should be auto-profiled: either its
|
|
55
|
+
* launch configuration asked for it (`profileOnLaunch: true`, set by the
|
|
56
|
+
* metric-explicit "Run & Profile CPU (Current File)" entry point — #82) or the
|
|
57
|
+
* user enabled the global `<section>.profiler.profileOnLaunch` setting.
|
|
58
|
+
*/
|
|
59
|
+
function shouldProfileOnLaunch(session) {
|
|
60
|
+
if (session.type !== (0, ids_1.debugType)()) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
// A "Run & Track Memory" launch tracks memory, not CPU. Never auto-start the
|
|
64
|
+
// CPU sampler on it — even when the global setting is on (read directly
|
|
65
|
+
// below, so the stamp carve-out in applyDebugConfigDefaults is not enough) —
|
|
66
|
+
// or the cooperative sampler and tracemalloc collide on the single entry
|
|
67
|
+
// pause (dap-1).
|
|
68
|
+
if (session.configuration.memoryTrackOnLaunch === true) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if (session.configuration.profileOnLaunch === true) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
return vscode.workspace
|
|
75
|
+
.getConfiguration((0, ids_1.configSection)())
|
|
76
|
+
.get("profiler.profileOnLaunch", false);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Resolve once the debuggee's PID for `sessionId` is known (captured from the
|
|
80
|
+
* DAP `process` event into the store), or after a bounded wait. Returns whether
|
|
81
|
+
* the PID became available. Used by the "Profile on Launch" auto-attach so it
|
|
82
|
+
* doesn't fire before debugpy reports the process.
|
|
83
|
+
*/
|
|
84
|
+
async function waitForDebuggeePid(store, sessionId) {
|
|
85
|
+
return waitForDebuggeePidUntil(store, sessionId, Date.now() + timeouts_1.STARTUP_TIMEOUT_MS);
|
|
86
|
+
}
|
|
87
|
+
/** Poll the store for a debuggee PID until it lands or the deadline passes. */
|
|
88
|
+
async function waitForDebuggeePidUntil(store, sessionId, deadline) {
|
|
89
|
+
if (store.getDebuggeeProcessId(sessionId) !== undefined) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
if (Date.now() >= deadline) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
await (0, timeouts_1.delay)(timeouts_1.POLL_INTERVAL_MS);
|
|
96
|
+
return waitForDebuggeePidUntil(store, sessionId, deadline);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Send a CPU start for a program the debugger just launched. The adapter
|
|
100
|
+
* reports the PID before the program's runtime has opened its diagnostics
|
|
101
|
+
* endpoint, so while `pending()` holds and for up to the startup timeout an
|
|
102
|
+
* `UNSUPPORTED_RUNTIME` refusal means "not yet" and the start is sent again
|
|
103
|
+
* ([PROF-UI-PROCESSES]). Any other error, or the same one later, is final.
|
|
104
|
+
*/
|
|
105
|
+
async function startWhenRuntimeReady(send, pending) {
|
|
106
|
+
const deadline = Date.now() + timeouts_1.STARTUP_TIMEOUT_MS;
|
|
107
|
+
return startWhenRuntimeReadyBy(deadline, send, pending);
|
|
108
|
+
}
|
|
109
|
+
/** One retry step: try the start; on "not yet", wait and try again. */
|
|
110
|
+
async function startWhenRuntimeReadyBy(deadline, send, pending) {
|
|
111
|
+
try {
|
|
112
|
+
return await send();
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
const notYet = (0, unknown_shape_1.numberField)(error, "code") === UNSUPPORTED_RUNTIME && pending() && Date.now() < deadline;
|
|
116
|
+
if (!notYet) {
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
await (0, timeouts_1.delay)(RETRY_GAP_MS);
|
|
120
|
+
return startWhenRuntimeReadyBy(deadline, send, pending);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=profiler-launch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler-launch.js","sourceRoot":"","sources":["../../src/profiler-launch.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,MAAY,MAAM,mCAAe;AACjC,+BAAiD;AAEjD,yCAAyE;AACzE,mDAA8C;AAE9C,gFAAgF;AAChF,MAAM,mBAAmB,GAAG,CAAC,MAAM,CAAC;AACpC,8EAA8E;AAC9E,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB;;;;;GAKG;AACH,+BACE,OAA4D;IAE5D,IAAI,OAAO,CAAC,IAAI,KAAK,IAAA,eAAS,GAAE,EAAE,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;IACnD,6EAA6E;IAC7E,wEAAwE;IACxE,6EAA6E;IAC7E,yEAAyE;IACzE,iBAAiB;IACjB,IAAI,OAAO,CAAC,aAAa,CAAC,mBAAmB,KAAK,IAAI,EAAE,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;IACzE,IAAI,OAAO,CAAC,aAAa,CAAC,eAAe,KAAK,IAAI,EAAE,CAAC;QAAC,OAAO,IAAI,CA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IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC;QACxG,IAAI,CAAC,MAAM,EAAE,CAAC;YAAC,MAAM,KAAK,CAAC;QAAC,CAAC;QAC7B,MAAM,IAAA,gBAAK,EAAC,YAAY,CAAC,CAAC;QAC1B,OAAO,uBAAuB,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The last CPU result the UI presented, and how it reaches the user.
|
|
3
|
+
*/
|
|
4
|
+
import type { ProfileResult } from "./profiler-decorations";
|
|
5
|
+
/** The most recent CPU result the UI presented (e2e seam). */
|
|
6
|
+
export declare function lastProfileResult(): ProfileResult | undefined;
|
|
7
|
+
/** Forget the last result (extension teardown). */
|
|
8
|
+
export declare function clearLastProfileResult(): void;
|
|
9
|
+
/** Keep and present a stop result, when the server returned one. */
|
|
10
|
+
export declare function presentStopResult(result: ProfileResult | undefined): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Keep a snapshot's result and offer its panel. Fire-and-forget: a toast with
|
|
13
|
+
* a button is sticky and must not block the snapshot handler ([PROF-CPU-START]).
|
|
14
|
+
*/
|
|
15
|
+
export declare function announceSnapshot(result: ProfileResult): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Re-open the results panel for the most recent profile. The panel is a
|
|
18
|
+
* singleton the user can close; this palette command is the always-available
|
|
19
|
+
* way back in — results are never trapped behind a dismissed completion toast
|
|
20
|
+
* ([PROF-CPU-START]).
|
|
21
|
+
*/
|
|
22
|
+
export declare function handleProfileShowResults(): Promise<void>;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* The last CPU result the UI presented, and how it reaches the user.
|
|
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.lastProfileResult = lastProfileResult;
|
|
41
|
+
exports.clearLastProfileResult = clearLastProfileResult;
|
|
42
|
+
exports.presentStopResult = presentStopResult;
|
|
43
|
+
exports.announceSnapshot = announceSnapshot;
|
|
44
|
+
exports.handleProfileShowResults = handleProfileShowResults;
|
|
45
|
+
const vscode = __importStar(require("vscode"));
|
|
46
|
+
const ids_1 = require("./ids");
|
|
47
|
+
const logger_1 = require("./logger");
|
|
48
|
+
const profiler_decorations_1 = require("./profiler-decorations");
|
|
49
|
+
const profiler_flamegraph_html_1 = require("./profiler-flamegraph-html");
|
|
50
|
+
const lastProfile = { result: undefined };
|
|
51
|
+
/** The most recent CPU result the UI presented (e2e seam). */
|
|
52
|
+
function lastProfileResult() {
|
|
53
|
+
return lastProfile.result;
|
|
54
|
+
}
|
|
55
|
+
/** Forget the last result (extension teardown). */
|
|
56
|
+
function clearLastProfileResult() {
|
|
57
|
+
lastProfile.result = undefined;
|
|
58
|
+
}
|
|
59
|
+
/** Keep `result` as the last one and paint its heat on the editors. */
|
|
60
|
+
async function keepResult(result) {
|
|
61
|
+
lastProfile.result = result;
|
|
62
|
+
await (0, profiler_decorations_1.applyProfileDecorations)(result);
|
|
63
|
+
}
|
|
64
|
+
/** Keep and present a stop result, when the server returned one. */
|
|
65
|
+
async function presentStopResult(result) {
|
|
66
|
+
if (result === undefined) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
await keepResult(result);
|
|
70
|
+
// Land the user on the self-contained results panel, beside the
|
|
71
|
+
// heat-mapped source; the raw `.cpuprofile` stays one click away
|
|
72
|
+
// ([PROF-CPU-START], #145).
|
|
73
|
+
await (0, profiler_flamegraph_html_1.presentProfileResult)(result);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Keep a snapshot's result and offer its panel. Fire-and-forget: a toast with
|
|
77
|
+
* a button is sticky and must not block the snapshot handler ([PROF-CPU-START]).
|
|
78
|
+
*/
|
|
79
|
+
async function announceSnapshot(result) {
|
|
80
|
+
await keepResult(result);
|
|
81
|
+
logger_1.Logger.info(`Profile snapshot: ${String(result.totalSamples)} samples so far`);
|
|
82
|
+
void offerSnapshotView(result);
|
|
83
|
+
}
|
|
84
|
+
/** Offer the snapshot's results panel and open it when the user accepts. */
|
|
85
|
+
async function offerSnapshotView(result) {
|
|
86
|
+
const choice = await vscode.window.showInformationMessage(`${(0, ids_1.brand)()}: Snapshot — ${String(result.totalSamples)} samples (profiling continues)`, "View Results");
|
|
87
|
+
if (choice === "View Results") {
|
|
88
|
+
await (0, profiler_flamegraph_html_1.openFlamegraphWebview)(result);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Re-open the results panel for the most recent profile. The panel is a
|
|
93
|
+
* singleton the user can close; this palette command is the always-available
|
|
94
|
+
* way back in — results are never trapped behind a dismissed completion toast
|
|
95
|
+
* ([PROF-CPU-START]).
|
|
96
|
+
*/
|
|
97
|
+
async function handleProfileShowResults() {
|
|
98
|
+
if (lastProfile.result === undefined) {
|
|
99
|
+
vscode.window.showInformationMessage(`${(0, ids_1.brand)()}: No profile results yet — run a profiling session first.`);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
await (0, profiler_flamegraph_html_1.openFlamegraphWebview)(lastProfile.result);
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=profiler-results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler-results.js","sourceRoot":"","sources":["../../src/profiler-results.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,MAAY,MAAM,mCAAe;AACjC,+BAA8B;AAC9B,qCAAkC;AAElC,iEAAiE;AACjE,yEAAyF;AAEzF,MAAM,WAAW,GAA0C,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAEjF,8DAA8D;AAC9D;IACE,OAAO,WAAW,CAAC,MAAM,CAAC;AAC5B,CAAC;AAED,mDAAmD;AACnD;IACE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC;AACjC,CAAC;AAED,uEAAuE;AACvE,KAAK,UAAU,UAAU,CAAC,MAAqB;IAC7C,WAA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/**
|
|
2
|
+
* Shared CPU-session machinery: the LSP command table, sampler settings,
|
|
3
|
+
* session adoption, and the attach-to-debuggee request both the panel and the
|
|
4
|
+
* launch flows reuse.
|
|
5
|
+
*/
|
|
6
|
+
import type { LanguageClient } from "vscode-languageclient/node";
|
|
7
|
+
import type { ProfilerStore as Store } from "./store";
|
|
8
|
+
import type { StartedSession } from "./wire-adapters";
|
|
9
|
+
import type { StartProfileResult } from "./wire-generated";
|
|
10
|
+
/** LSP command names ([PROF-WIRE-METHODS]). */
|
|
11
|
+
export declare const CPU_CMD: {
|
|
12
|
+
readonly start: string;
|
|
13
|
+
readonly stop: string;
|
|
14
|
+
readonly snapshot: string;
|
|
15
|
+
readonly list: string;
|
|
16
|
+
readonly cooperativeScript: string;
|
|
17
|
+
readonly cooperativeAttach: string;
|
|
18
|
+
};
|
|
19
|
+
/** The configured sampler: its rate (Hz) and whether native frames are kept. */
|
|
20
|
+
export declare function samplerSettings(): {
|
|
21
|
+
sample_rate: number;
|
|
22
|
+
include_native: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Adopt a freshly started session into the shared reactive state
|
|
26
|
+
* ([PROF-UI-PROCESSES]). A start the server answered with nothing adopts nothing.
|
|
27
|
+
*/
|
|
28
|
+
export declare function adoptSession(store: Store, raw: StartProfileResult | undefined, announce: (session: StartedSession) => string): void;
|
|
29
|
+
/** A start that never reached "active" clears its spinner. */
|
|
30
|
+
export declare function settleStart(store: Store): void;
|
|
31
|
+
/** The single progress title every CPU-start flow shares. */
|
|
32
|
+
export declare function cpuStartTitle(): string;
|
|
33
|
+
/** The debuggee a CPU start targets, plus an optional "still launching" retry gate. */
|
|
34
|
+
export interface AttachTarget {
|
|
35
|
+
readonly pid: number;
|
|
36
|
+
readonly launching?: () => boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Start a CPU session on the debuggee `pid` and adopt it; a just-launched one
|
|
40
|
+
* is retried while `launching()` holds. The caller owns the CPU leg.
|
|
41
|
+
*/
|
|
42
|
+
export declare function attachToDebuggee(store: Store, client: LanguageClient, target: AttachTarget): Promise<void>;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI-STATE], [PROF-CPU-COOPERATIVE]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Shared CPU-session machinery: the LSP command table, sampler settings,
|
|
5
|
+
* session adoption, and the attach-to-debuggee request both the panel and the
|
|
6
|
+
* launch flows reuse.
|
|
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.CPU_CMD = void 0;
|
|
43
|
+
exports.samplerSettings = samplerSettings;
|
|
44
|
+
exports.adoptSession = adoptSession;
|
|
45
|
+
exports.settleStart = settleStart;
|
|
46
|
+
exports.cpuStartTitle = cpuStartTitle;
|
|
47
|
+
exports.attachToDebuggee = attachToDebuggee;
|
|
48
|
+
const vscode = __importStar(require("vscode"));
|
|
49
|
+
const ids_1 = require("./ids");
|
|
50
|
+
const logger_1 = require("./logger");
|
|
51
|
+
const failure_1 = require("./failure");
|
|
52
|
+
const server_command_1 = require("./server-command");
|
|
53
|
+
const wire_adapters_1 = require("./wire-adapters");
|
|
54
|
+
const profiler_launch_1 = require("./profiler-launch");
|
|
55
|
+
/** LSP command names ([PROF-WIRE-METHODS]). */
|
|
56
|
+
exports.CPU_CMD = (0, ids_1.lspTable)({
|
|
57
|
+
start: "cpu.start",
|
|
58
|
+
stop: "cpu.stop",
|
|
59
|
+
snapshot: "cpu.snapshot",
|
|
60
|
+
list: "cpu.list",
|
|
61
|
+
cooperativeScript: "cpu.cooperativeScript",
|
|
62
|
+
cooperativeAttach: "cpu.cooperativeAttach",
|
|
63
|
+
});
|
|
64
|
+
/** Default sample rate fallback (Hz). */
|
|
65
|
+
const DEFAULT_SAMPLE_RATE = 100;
|
|
66
|
+
/** The configured sampler: its rate (Hz) and whether native frames are kept. */
|
|
67
|
+
function samplerSettings() {
|
|
68
|
+
const cfg = vscode.workspace.getConfiguration((0, ids_1.configSection)());
|
|
69
|
+
return {
|
|
70
|
+
sample_rate: cfg.get("profiler.sampleRate", DEFAULT_SAMPLE_RATE),
|
|
71
|
+
include_native: cfg.get("profiler.includeNative", false),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Adopt a freshly started session into the shared reactive state
|
|
76
|
+
* ([PROF-UI-PROCESSES]). A start the server answered with nothing adopts nothing.
|
|
77
|
+
*/
|
|
78
|
+
function adoptSession(store, raw, announce) {
|
|
79
|
+
if (raw === undefined) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const result = (0, wire_adapters_1.toStartedSession)(raw);
|
|
83
|
+
store.profilerActive(result.pid, result.sessionId);
|
|
84
|
+
logger_1.Logger.info(`Profiling started: PID ${String(result.pid)}, ${result.runtime} ${result.runtimeVersion}, session ${result.sessionId}`);
|
|
85
|
+
vscode.window.showInformationMessage(announce(result));
|
|
86
|
+
}
|
|
87
|
+
/** A start that never reached "active" clears its spinner. */
|
|
88
|
+
function settleStart(store) {
|
|
89
|
+
if (store.profiler.value.cpu !== "active") {
|
|
90
|
+
store.profilerStopped();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** The single progress title every CPU-start flow shares. */
|
|
94
|
+
function cpuStartTitle() {
|
|
95
|
+
return `${(0, ids_1.brand)()}: Starting CPU profiler`;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Start a CPU session on the debuggee `pid` and adopt it; a just-launched one
|
|
99
|
+
* is retried while `launching()` holds. The caller owns the CPU leg.
|
|
100
|
+
*/
|
|
101
|
+
async function attachToDebuggee(store, client, target) {
|
|
102
|
+
const { pid, launching = () => false } = target;
|
|
103
|
+
const args = { pid, ...samplerSettings() };
|
|
104
|
+
const send = async () => {
|
|
105
|
+
const result = await (0, server_command_1.executeServerCommand)(client, exports.CPU_CMD.start, args);
|
|
106
|
+
return result;
|
|
107
|
+
};
|
|
108
|
+
try {
|
|
109
|
+
const raw = await (0, profiler_launch_1.startWhenRuntimeReady)(send, launching);
|
|
110
|
+
adoptSession(store, raw, (result) => `${(0, ids_1.brand)()}: Profiling debug session (PID ${String(result.pid)})`);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
(0, failure_1.reportFailure)("Profile attach-to-debug", error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=profiler-session-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler-session-core.js","sourceRoot":"","sources":["../../src/profiler-session-core.ts"],"names":[],"mappings":";AAAA,0FAA0F;AAC1F;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,MAAY,MAAM,mCAAe;AAEjC,+BAAuD;AACvD,qCAAkC;AAElC,uCAA0C;AAC1C,qDAAwD;AACxD,mDAAmD;AAGnD,uDAA0D;AAE1D,+CAA+C;AAClC,QAAA,OAAO,GAAG,IAAA,cAAQ,EAAC;IAC9B,KAAK,EAAE,WAAW;IAClB,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,UAAU;IAChB,iBAAiB,EAAE,uBAAuB;IAC1C,iBAAiB,EAAE,uBAAuB;CAC3C,CAAC,CAAC;AAEH,yCAAyC;AACzC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,gFAAgF;AAChF;IACE,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAA,mBAAa,GAAE,CAAC,CAAC;IAC/D,OAAO;QACL,WAAW,EAAE,GAAG,CAAC,GAAG,CAAS,qBAAqB,EAAE,mBAAmB,CAAC;QACxE,cAAc,EAAE,GAAG,CAAC,GAAG,CAAU,wBAAwB,EAAE,KAAK,CAAC;KAClE,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,sBAA6B,KAAY,EAAE,GAAmC,EAAE,QAA6C;IAC3H,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAClC,MAAM,MAAM,GAAG,IAAA,gCAAgB,EAAC,GAAG,CAAC,CAAC;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AAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1G,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAA,uBAAa,EAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The canonical, reactive profiling state and the actions that mutate it.
|
|
3
|
+
*
|
|
4
|
+
* Profiling used to keep its "am I running?" flags as module-level variables
|
|
5
|
+
* inside profiler.ts (`activeSessionId`) and memory-profiler.ts
|
|
6
|
+
* (`activeMemorySessionId`). Nothing on screen could react to them, so the
|
|
7
|
+
* Processes panel kept offering "Run & Profile" while a session was
|
|
8
|
+
* already running. This module hoists that state into a single object the
|
|
9
|
+
* store owns as a Signal, so the status bar, the panel chrome, and the gating
|
|
10
|
+
* context keys all derive from one source of truth (CLAUDE.md: "All state that
|
|
11
|
+
* can change uses Signals for reactivity. No stale state on screen.").
|
|
12
|
+
*
|
|
13
|
+
* Defined outside store.ts so the (already large) store file only grows by the
|
|
14
|
+
* signal wiring, not the type surface and the action bodies.
|
|
15
|
+
*/
|
|
16
|
+
import type { Signal } from "@preact/signals-core";
|
|
17
|
+
/** Lifecycle of a single profiling activity, surfaced reactively to the UI. */
|
|
18
|
+
export type ProfilerActivity = "idle" | "starting" | "active";
|
|
19
|
+
/**
|
|
20
|
+
* Reactive snapshot of every profiling activity. Copy-on-write: actions
|
|
21
|
+
* replace the whole object so the backing Signal notifies subscribers.
|
|
22
|
+
*/
|
|
23
|
+
export interface ProfilerSession {
|
|
24
|
+
/** CPU sampling lifecycle. */
|
|
25
|
+
readonly cpu: ProfilerActivity;
|
|
26
|
+
/** PID being CPU-profiled (known once `cpu === "active"`). */
|
|
27
|
+
readonly cpuPid: number | undefined;
|
|
28
|
+
/** LSP CPU session id — routes stop/snapshot/progress. */
|
|
29
|
+
readonly cpuSessionId: string | undefined;
|
|
30
|
+
/** Live sample count from `lspProfiler/cpu/progress`. */
|
|
31
|
+
readonly sampleCount: number;
|
|
32
|
+
/** Live elapsed seconds from the same notification. */
|
|
33
|
+
readonly durationSecs: number;
|
|
34
|
+
/** Hottest function so far, for the live readout. */
|
|
35
|
+
readonly topFunction: string | undefined;
|
|
36
|
+
/** Memory-tracking (tracemalloc) lifecycle. */
|
|
37
|
+
readonly memory: ProfilerActivity;
|
|
38
|
+
/** LSP memory session id while tracking. */
|
|
39
|
+
readonly memorySessionId: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Path the debuggee's `atexit` hook writes a final snapshot to, read when the
|
|
42
|
+
* debug session ends so the run finalises into a visible result
|
|
43
|
+
* ([PROF-PY-MEMORY-FINAL]). Set alongside `memorySessionId`.
|
|
44
|
+
*/
|
|
45
|
+
readonly memoryFinalSnapshotFile: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* The VS Code debug session being tracked, so only *its* termination finalises
|
|
48
|
+
* the run ([PROF-PY-MEMORY-FINAL]) — an unrelated session ending must never
|
|
49
|
+
* tear down live tracking.
|
|
50
|
+
*/
|
|
51
|
+
readonly memoryDebugSessionId: string | undefined;
|
|
52
|
+
}
|
|
53
|
+
/** The neutral state: nothing profiling, nothing tracking. */
|
|
54
|
+
export declare const IDLE_PROFILER_SESSION: ProfilerSession;
|
|
55
|
+
/** The only way to mutate profiling state — exposed on the Store. */
|
|
56
|
+
export interface ProfilerActions {
|
|
57
|
+
/** A CPU start is in flight (click → before the first sample batch). */
|
|
58
|
+
readonly profilerStarting: () => void;
|
|
59
|
+
/** A CPU session is live for `pid`/`sessionId`; resets the live counters. */
|
|
60
|
+
readonly profilerActive: (pid: number, sessionId: string) => void;
|
|
61
|
+
/** Live progress for the active CPU session (ignored when not active). */
|
|
62
|
+
readonly profilerProgress: (sampleCount: number, durationSecs: number, topFunction: string) => void;
|
|
63
|
+
/** The CPU session ended (or its start failed). */
|
|
64
|
+
readonly profilerStopped: () => void;
|
|
65
|
+
/** A memory-tracking start is in flight. */
|
|
66
|
+
readonly memoryTrackingStarting: () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Memory tracking is live for `sessionId`. `finalSnapshotFile` is the path the
|
|
69
|
+
* debuggee writes a final snapshot to at exit, and `debugSessionId` is the VS
|
|
70
|
+
* Code debug session whose termination finalises the run ([PROF-PY-MEMORY-FINAL]).
|
|
71
|
+
*/
|
|
72
|
+
readonly memoryTrackingActive: (sessionId: string, finalSnapshotFile?: string, debugSessionId?: string) => void;
|
|
73
|
+
/** Memory tracking ended (or its start failed). */
|
|
74
|
+
readonly memoryTrackingStopped: () => void;
|
|
75
|
+
}
|
|
76
|
+
/** True while any CPU or memory profiling activity is starting or running. */
|
|
77
|
+
export declare function isProfilerBusy(session: ProfilerSession): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* True while the CPU leg is starting or running. Gates CPU starts independently
|
|
80
|
+
* of memory so a CPU run can begin while memory tracking is live, but never a
|
|
81
|
+
* second CPU run on top of an active one ([PROF-UI-PROCESSES]).
|
|
82
|
+
*/
|
|
83
|
+
export declare function isCpuBusy(session: ProfilerSession): boolean;
|
|
84
|
+
/** True while the memory leg is starting or running. The mirror of [`isCpuBusy`]. */
|
|
85
|
+
export declare function isMemoryBusy(session: ProfilerSession): boolean;
|
|
86
|
+
/** Build the profiler actions over the store's backing Signal. */
|
|
87
|
+
export declare function createProfilerActions(profiler: Signal<ProfilerSession>): ProfilerActions;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI-PROCESSES]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* The canonical, reactive profiling state and the actions that mutate it.
|
|
5
|
+
*
|
|
6
|
+
* Profiling used to keep its "am I running?" flags as module-level variables
|
|
7
|
+
* inside profiler.ts (`activeSessionId`) and memory-profiler.ts
|
|
8
|
+
* (`activeMemorySessionId`). Nothing on screen could react to them, so the
|
|
9
|
+
* Processes panel kept offering "Run & Profile" while a session was
|
|
10
|
+
* already running. This module hoists that state into a single object the
|
|
11
|
+
* store owns as a Signal, so the status bar, the panel chrome, and the gating
|
|
12
|
+
* context keys all derive from one source of truth (CLAUDE.md: "All state that
|
|
13
|
+
* can change uses Signals for reactivity. No stale state on screen.").
|
|
14
|
+
*
|
|
15
|
+
* Defined outside store.ts so the (already large) store file only grows by the
|
|
16
|
+
* signal wiring, not the type surface and the action bodies.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.IDLE_PROFILER_SESSION = void 0;
|
|
20
|
+
exports.isProfilerBusy = isProfilerBusy;
|
|
21
|
+
exports.isCpuBusy = isCpuBusy;
|
|
22
|
+
exports.isMemoryBusy = isMemoryBusy;
|
|
23
|
+
exports.createProfilerActions = createProfilerActions;
|
|
24
|
+
/** The neutral state: nothing profiling, nothing tracking. */
|
|
25
|
+
exports.IDLE_PROFILER_SESSION = {
|
|
26
|
+
cpu: "idle",
|
|
27
|
+
cpuPid: undefined,
|
|
28
|
+
cpuSessionId: undefined,
|
|
29
|
+
sampleCount: 0,
|
|
30
|
+
durationSecs: 0,
|
|
31
|
+
topFunction: undefined,
|
|
32
|
+
memory: "idle",
|
|
33
|
+
memorySessionId: undefined,
|
|
34
|
+
memoryFinalSnapshotFile: undefined,
|
|
35
|
+
memoryDebugSessionId: undefined,
|
|
36
|
+
};
|
|
37
|
+
/** True while any CPU or memory profiling activity is starting or running. */
|
|
38
|
+
function isProfilerBusy(session) {
|
|
39
|
+
return session.cpu !== "idle" || session.memory !== "idle";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* True while the CPU leg is starting or running. Gates CPU starts independently
|
|
43
|
+
* of memory so a CPU run can begin while memory tracking is live, but never a
|
|
44
|
+
* second CPU run on top of an active one ([PROF-UI-PROCESSES]).
|
|
45
|
+
*/
|
|
46
|
+
function isCpuBusy(session) {
|
|
47
|
+
return session.cpu !== "idle";
|
|
48
|
+
}
|
|
49
|
+
/** True while the memory leg is starting or running. The mirror of [`isCpuBusy`]. */
|
|
50
|
+
function isMemoryBusy(session) {
|
|
51
|
+
return session.memory !== "idle";
|
|
52
|
+
}
|
|
53
|
+
/** A CPU leg with no session: no PID, no session id, no live progress. */
|
|
54
|
+
const NO_CPU_SESSION = { cpuPid: undefined, cpuSessionId: undefined, sampleCount: 0, durationSecs: 0, topFunction: undefined };
|
|
55
|
+
/** A memory leg with no session. */
|
|
56
|
+
const NO_MEMORY_SESSION = { memorySessionId: undefined, memoryFinalSnapshotFile: undefined, memoryDebugSessionId: undefined };
|
|
57
|
+
/** Build the profiler actions over the store's backing Signal. */
|
|
58
|
+
function createProfilerActions(profiler) {
|
|
59
|
+
const patch = (next) => { profiler.value = { ...profiler.value, ...next }; };
|
|
60
|
+
return { ...cpuActions(profiler, patch), ...memoryActions(patch) };
|
|
61
|
+
}
|
|
62
|
+
function cpuActions(profiler, patch) {
|
|
63
|
+
return {
|
|
64
|
+
profilerStarting() { patch({ ...NO_CPU_SESSION, cpu: "starting" }); },
|
|
65
|
+
profilerActive(pid, sessionId) { patch({ ...NO_CPU_SESSION, cpu: "active", cpuPid: pid, cpuSessionId: sessionId }); },
|
|
66
|
+
profilerProgress(sampleCount, durationSecs, topFunction) {
|
|
67
|
+
if (profiler.value.cpu === "active") {
|
|
68
|
+
patch({ sampleCount, durationSecs, topFunction });
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
profilerStopped() { patch({ ...NO_CPU_SESSION, cpu: "idle" }); },
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function memoryActions(patch) {
|
|
75
|
+
return {
|
|
76
|
+
memoryTrackingStarting() { patch({ ...NO_MEMORY_SESSION, memory: "starting" }); },
|
|
77
|
+
memoryTrackingActive(sessionId, finalSnapshotFile, debugSessionId) {
|
|
78
|
+
patch({ memory: "active", memorySessionId: sessionId, memoryFinalSnapshotFile: finalSnapshotFile, memoryDebugSessionId: debugSessionId });
|
|
79
|
+
},
|
|
80
|
+
memoryTrackingStopped() { patch({ ...NO_MEMORY_SESSION, memory: "idle" }); },
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=profiler-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler-state.js","sourceRoot":"","sources":["../../src/profiler-state.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE;;;;;;;;;;;;;;GAcG;;;;;;;AA0CH,8DAA8D;AACjD,QAAA,qBAAqB,GAAoB;IACpD,GAAG,EAAE,MAAM;IACX,MAAM,EAAE,SAAS;IACjB,YAAY,EAAE,SAAS;IACvB,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,SAAS;IACtB,MAAM,EAAE,MAAM;IACd,eAAe,EAAE,SAAS;IAC1B,uBAAuB,EAAE,SAAS;IAClC,oBAAoB,EAAE,SAAS;CAChC,CAAC;AAwBF,8EAA8E;AAC9E,wBAA+B,OAAwB;IACrD,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,mBAA0B,OAAwB;IAChD,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM,CAAC;AAChC,CAAC;AAED,qFAAqF;AACrF,sBAA6B,OAAwB;IACnD,OAAO,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC;AACnC,CAAC;AAED,0EAA0E;AAC1E,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AAC/H,oCAAoC;AACpC,MAAM,iBAAiB,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,uBAAuB,EAAE,SAAS,EAAE,oBAAoB,EAAE,SAAS,EAAE,CAAC;AAI9H,kEAAkE;AAClE,+BAA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E,SAAS,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,cAAc,EAAE,CAAC,CAAC;QAC5I,CAAC;QACD,qBAAqB,KAAK,KAAK,CAAC,EAAE,GAAG,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;KAC7E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profiler status-bar lifecycle: hidden → starting spinner → live flame
|
|
3
|
+
* counter. A CPU-profiling start is never silent — between the click and the
|
|
4
|
+
* first sample batch the item shows `$(loading~spin)`, then the LSP's progress
|
|
5
|
+
* notifications drive the live counter.
|
|
6
|
+
*
|
|
7
|
+
* The item renders purely from the store's reactive `profiler` signal
|
|
8
|
+
* ([PROF-UI-PROCESSES]): one `effect` repaints it whenever the session
|
|
9
|
+
* state changes, so there is no imperative "set status" call to forget. Owned
|
|
10
|
+
* here so profiler.ts stays focused on session flow.
|
|
11
|
+
*/
|
|
12
|
+
import * as vscode from "vscode";
|
|
13
|
+
import type { ProfilerStore as Store } from "./store";
|
|
14
|
+
/**
|
|
15
|
+
* Create the profiler status-bar item (click = stop) and bind it to the store's
|
|
16
|
+
* `profiler` signal. Returns a disposable that tears down both the effect and
|
|
17
|
+
* the item.
|
|
18
|
+
*/
|
|
19
|
+
export declare function bindProfilerStatusBar(store: Store): vscode.Disposable;
|
|
20
|
+
/**
|
|
21
|
+
* The profiler status-bar text, or undefined when idle/hidden. E2e seam for
|
|
22
|
+
* [PROF-UI-STATE]/[PROF-UI-STATE]: the lifecycle
|
|
23
|
+
* (starting spinner → live samples) lands here and StatusBarItem state is not
|
|
24
|
+
* readable via the public API.
|
|
25
|
+
*/
|
|
26
|
+
export declare function profilerStatusText(): string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Bind the `lspProfiler/cpu/progress` handler to whichever LanguageClient the
|
|
29
|
+
* store currently holds — reactively, so the live sample counter never goes
|
|
30
|
+
* silently dead. The runtime can be re-created within one session (store reset
|
|
31
|
+
* → a brand-new client), and a slow cold start can outlast any fixed timeout,
|
|
32
|
+
* so a one-shot registration is wrong ([PROF-UI-STATE]).
|
|
33
|
+
*
|
|
34
|
+
* `onNotification` may be called before the client connects (the handler is
|
|
35
|
+
* queued), and vscode-languageclient replays it across restarts of the same
|
|
36
|
+
* instance — so registering once per client *instance* is sufficient.
|
|
37
|
+
*/
|
|
38
|
+
export declare function registerProgressListener(store: Store): vscode.Disposable;
|