@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,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline heat map decorations for CPU profiling results.
|
|
3
|
+
*
|
|
4
|
+
* After profiling completes, hot lines get colored decorations in the
|
|
5
|
+
* editor gutter and after-line text showing CPU percentage and sample
|
|
6
|
+
* count. Uses the host palette ([PROF-UI-PALETTE]):
|
|
7
|
+
*
|
|
8
|
+
* Critical (>20%): critical
|
|
9
|
+
* Hot (10-20%): hot
|
|
10
|
+
* Warm (5-10%): warm
|
|
11
|
+
* Cool (1-5%): #4a5468 — muted slate, in every host
|
|
12
|
+
*/
|
|
13
|
+
import type { SampledView } from "./sampled-view";
|
|
14
|
+
import * as vscode from "vscode";
|
|
15
|
+
/** Per-line profiling data from the LSP server. */
|
|
16
|
+
export interface ProfileHotLine {
|
|
17
|
+
file: string;
|
|
18
|
+
line: number;
|
|
19
|
+
samples: number;
|
|
20
|
+
percentage: number;
|
|
21
|
+
}
|
|
22
|
+
/** Per-function profiling data from the LSP server. */
|
|
23
|
+
export interface ProfileHotFunction {
|
|
24
|
+
name: string;
|
|
25
|
+
/** Source path; absent for a frame the runtime could not place, such as a framework method ([PROF-DOTNET-CPU-SYMBOLS]). */
|
|
26
|
+
file?: string;
|
|
27
|
+
/** 1-based definition line; present exactly when `file` is. */
|
|
28
|
+
line?: number;
|
|
29
|
+
samples: number;
|
|
30
|
+
percentage: number;
|
|
31
|
+
selfPercentage: number;
|
|
32
|
+
}
|
|
33
|
+
/** Profile result returned by `<prefix>.lspProfiler.cpu.stop` or `/snapshot`. */
|
|
34
|
+
export interface ProfileResult {
|
|
35
|
+
sampled?: SampledView;
|
|
36
|
+
sessionId: string;
|
|
37
|
+
duration: number;
|
|
38
|
+
totalSamples: number;
|
|
39
|
+
outputFile: string;
|
|
40
|
+
/** Path to the V8 `.cpuprofile` for VS Code's built-in profile viewer. */
|
|
41
|
+
cpuProfilePath?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Path to the self-contained interactive flame graph SVG the LSP always
|
|
44
|
+
* attempts to export ([PROF-EXPORT-FLAMEGRAPH]). Embedded as the hero of the
|
|
45
|
+
* results webview and openable externally for full zoom/search.
|
|
46
|
+
*/
|
|
47
|
+
flamegraphPath?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Why an export was refused or failed ([PROF-EXPORT-VALIDATE]) — e.g.
|
|
50
|
+
* a zero-sample run. Surfaced to the user; never silent (#145).
|
|
51
|
+
*/
|
|
52
|
+
exportError?: string;
|
|
53
|
+
hotFunctions: ProfileHotFunction[];
|
|
54
|
+
hotLines: ProfileHotLine[];
|
|
55
|
+
}
|
|
56
|
+
/** One heat decoration as applied to an open editor. */
|
|
57
|
+
export interface AppliedDecoration {
|
|
58
|
+
readonly file: string;
|
|
59
|
+
/** 1-based line the decoration landed on. */
|
|
60
|
+
readonly line: number;
|
|
61
|
+
/** Palette color used (the host palette's `critical` for a critical line). */
|
|
62
|
+
readonly color: string;
|
|
63
|
+
/** The after-line text shown to the user (bar + % + samples). */
|
|
64
|
+
readonly contentText: string;
|
|
65
|
+
}
|
|
66
|
+
/** The heat-map decorations currently applied across visible editors. */
|
|
67
|
+
export declare function appliedProfileDecorations(): readonly AppliedDecoration[];
|
|
68
|
+
/** Record everything painted for one file, for the applied ledger. */
|
|
69
|
+
export declare function recordApplied(ledger: AppliedDecoration[], file: string, paintedByColor: ReadonlyMap<string, readonly vscode.DecorationOptions[]>): void;
|
|
70
|
+
export declare function applyProfileDecorations(result: ProfileResult): Promise<void>;
|
|
71
|
+
/** Clear all profiling decorations from visible editors. */
|
|
72
|
+
export declare function clearProfileDecorations(): void;
|
|
73
|
+
/** Dispose all decoration types (call on extension deactivate). */
|
|
74
|
+
export declare function disposeProfileDecorations(): void;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Implements [PROF-UI]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
3
|
+
/**
|
|
4
|
+
* Inline heat map decorations for CPU profiling results.
|
|
5
|
+
*
|
|
6
|
+
* After profiling completes, hot lines get colored decorations in the
|
|
7
|
+
* editor gutter and after-line text showing CPU percentage and sample
|
|
8
|
+
* count. Uses the host palette ([PROF-UI-PALETTE]):
|
|
9
|
+
*
|
|
10
|
+
* Critical (>20%): critical
|
|
11
|
+
* Hot (10-20%): hot
|
|
12
|
+
* Warm (5-10%): warm
|
|
13
|
+
* Cool (1-5%): #4a5468 — muted slate, in every host
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
+
}) : function(o, v) {
|
|
29
|
+
o["default"] = v;
|
|
30
|
+
});
|
|
31
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
32
|
+
var ownKeys = function(o) {
|
|
33
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
34
|
+
var ar = [];
|
|
35
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
36
|
+
return ar;
|
|
37
|
+
};
|
|
38
|
+
return ownKeys(o);
|
|
39
|
+
};
|
|
40
|
+
return function (mod) {
|
|
41
|
+
if (mod && mod.__esModule) return mod;
|
|
42
|
+
var result = {};
|
|
43
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
44
|
+
__setModuleDefault(result, mod);
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
})();
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.appliedProfileDecorations = appliedProfileDecorations;
|
|
50
|
+
exports.recordApplied = recordApplied;
|
|
51
|
+
exports.applyProfileDecorations = applyProfileDecorations;
|
|
52
|
+
exports.clearProfileDecorations = clearProfileDecorations;
|
|
53
|
+
exports.disposeProfileDecorations = disposeProfileDecorations;
|
|
54
|
+
const palette_1 = require("./palette");
|
|
55
|
+
const vscode = __importStar(require("vscode"));
|
|
56
|
+
const ids_1 = require("./ids");
|
|
57
|
+
const logger_1 = require("./logger");
|
|
58
|
+
const editor_path_key_1 = require("./editor-path-key");
|
|
59
|
+
/** Minimum percentage for "critical" heat classification. */
|
|
60
|
+
const HEAT_CRITICAL_PCT = 20;
|
|
61
|
+
/** Minimum percentage for "hot" heat classification. */
|
|
62
|
+
const HEAT_HOT_PCT = 10;
|
|
63
|
+
/** Minimum percentage for "warm" heat classification. */
|
|
64
|
+
const HEAT_WARM_PCT = 5;
|
|
65
|
+
/** Max bar length for critical heat level. */
|
|
66
|
+
const BAR_LEN_CRITICAL = 10;
|
|
67
|
+
/** Max bar length for hot heat level. */
|
|
68
|
+
const BAR_LEN_HOT = 8;
|
|
69
|
+
/** Max bar length for warm heat level. */
|
|
70
|
+
const BAR_LEN_WARM = 6;
|
|
71
|
+
/** Max bar length for cool heat level. */
|
|
72
|
+
const BAR_LEN_COOL = 4;
|
|
73
|
+
const heatLevels = () => [
|
|
74
|
+
{ minPct: HEAT_CRITICAL_PCT, color: (0, palette_1.profilerPalette)().critical, barChar: "\u2588", barMaxLen: BAR_LEN_CRITICAL },
|
|
75
|
+
{ minPct: HEAT_HOT_PCT, color: (0, palette_1.profilerPalette)().hot, barChar: "\u2588", barMaxLen: BAR_LEN_HOT },
|
|
76
|
+
{ minPct: HEAT_WARM_PCT, color: (0, palette_1.profilerPalette)().warm, barChar: "\u2588", barMaxLen: BAR_LEN_WARM },
|
|
77
|
+
{ minPct: 1, color: "#4a5468", barChar: "\u2588", barMaxLen: BAR_LEN_COOL },
|
|
78
|
+
];
|
|
79
|
+
function heatLevelFor(pct) {
|
|
80
|
+
return heatLevels().find((level) => pct >= level.minPct);
|
|
81
|
+
}
|
|
82
|
+
let appliedDecorations = [];
|
|
83
|
+
/** The heat-map decorations currently applied across visible editors. */
|
|
84
|
+
function appliedProfileDecorations() {
|
|
85
|
+
return appliedDecorations;
|
|
86
|
+
}
|
|
87
|
+
/** Record everything painted for one file, for the applied ledger. */
|
|
88
|
+
function recordApplied(ledger, file, paintedByColor) {
|
|
89
|
+
for (const [color, options] of paintedByColor) {
|
|
90
|
+
for (const option of options) {
|
|
91
|
+
ledger.push({
|
|
92
|
+
file,
|
|
93
|
+
line: option.range.start.line + 1,
|
|
94
|
+
color,
|
|
95
|
+
contentText: option.renderOptions?.after?.contentText ?? "",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// ── Decoration types (created lazily, one per heat level) ─────────────────
|
|
101
|
+
const decorationTypes = new Map();
|
|
102
|
+
function getDecorationTypeForColor(color) {
|
|
103
|
+
let existing = decorationTypes.get(color);
|
|
104
|
+
if (existing !== undefined) {
|
|
105
|
+
return existing;
|
|
106
|
+
}
|
|
107
|
+
existing = vscode.window.createTextEditorDecorationType({
|
|
108
|
+
overviewRulerColor: color,
|
|
109
|
+
overviewRulerLane: vscode.OverviewRulerLane.Right,
|
|
110
|
+
gutterIconSize: "contain",
|
|
111
|
+
isWholeLine: false,
|
|
112
|
+
after: {
|
|
113
|
+
margin: "0 0 0 2em",
|
|
114
|
+
fontStyle: "normal",
|
|
115
|
+
fontWeight: "500",
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
decorationTypes.set(color, existing);
|
|
119
|
+
return existing;
|
|
120
|
+
}
|
|
121
|
+
// ── Public API ────────────────────────────────────────────────────────────
|
|
122
|
+
/**
|
|
123
|
+
* Apply inline heat map decorations to all visible editors based on
|
|
124
|
+
* profiling results.
|
|
125
|
+
*/
|
|
126
|
+
/** Add a decoration option to the color-keyed options map. */
|
|
127
|
+
function addDecorationOption(optionsByColor, color, option) {
|
|
128
|
+
const existing = optionsByColor.get(color);
|
|
129
|
+
if (existing === undefined) {
|
|
130
|
+
optionsByColor.set(color, [option]);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
existing.push(option);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/** Paint `hint.text` after source line `hint.line` (1-based) in `hint.color`, when the line exists. */
|
|
137
|
+
function addLineHint(editor, optionsByColor, hint) {
|
|
138
|
+
const lineIdx = hint.line - 1;
|
|
139
|
+
if (lineIdx < 0 || lineIdx >= editor.document.lineCount) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const range = new vscode.Range(new vscode.Position(lineIdx, 0), new vscode.Position(lineIdx, editor.document.lineAt(lineIdx).text.length));
|
|
143
|
+
addDecorationOption(optionsByColor, hint.color, { range, renderOptions: { after: { contentText: hint.text, color: hint.color } } });
|
|
144
|
+
}
|
|
145
|
+
/** Build line-level heat decoration options for a single editor. */
|
|
146
|
+
function buildLineDecorations(editor, lines, optionsByColor) {
|
|
147
|
+
for (const line of lines) {
|
|
148
|
+
const level = heatLevelFor(line.percentage);
|
|
149
|
+
if (level !== undefined) {
|
|
150
|
+
const barLen = Math.ceil((line.percentage / level.minPct) * (level.barMaxLen / 2));
|
|
151
|
+
const bar = level.barChar.repeat(Math.min(barLen, level.barMaxLen));
|
|
152
|
+
addLineHint(editor, optionsByColor, { line: line.line, text: ` ${bar} ${line.percentage.toFixed(1)}% (${String(line.samples)} samples)`, color: level.color });
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function isLocated(func) {
|
|
157
|
+
return func.file !== undefined && func.line !== undefined;
|
|
158
|
+
}
|
|
159
|
+
/** Build function-level heat decoration options for a single editor; a line's own heat takes its place. */
|
|
160
|
+
function buildFuncDecorations(editor, funcs, ctx) {
|
|
161
|
+
for (const func of funcs) {
|
|
162
|
+
const level = heatLevelFor(func.percentage);
|
|
163
|
+
if (level !== undefined && ctx.lines?.some((line) => line.line === func.line) !== true) {
|
|
164
|
+
const text = ` ${func.name} \u2014 ${func.percentage.toFixed(1)}% CPU (${func.selfPercentage.toFixed(1)}% self)`;
|
|
165
|
+
addLineHint(editor, ctx.optionsByColor, { line: func.line, text, color: level.color });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/** Group the result's located heat by the key of each file it names. */
|
|
170
|
+
async function heatByFile(result, editors) {
|
|
171
|
+
// An unlocated frame stays in the results table but paints no line.
|
|
172
|
+
const located = result.hotFunctions.filter(isLocated);
|
|
173
|
+
const keyOf = await (0, editor_path_key_1.rowAndEditorKeyer)([...result.hotLines, ...located], editors);
|
|
174
|
+
return { keyOf, lines: (0, editor_path_key_1.groupByFile)(result.hotLines, keyOf), funcs: (0, editor_path_key_1.groupByFile)(located, keyOf) };
|
|
175
|
+
}
|
|
176
|
+
async function applyProfileDecorations(result) {
|
|
177
|
+
if (!vscode.workspace.getConfiguration((0, ids_1.configSection)()).get("profiler.showInlineHeatMap", true)) {
|
|
178
|
+
logger_1.Logger.info("Profiler heat map disabled — skipping decorations");
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
clearProfileDecorations();
|
|
182
|
+
const editors = vscode.window.visibleTextEditors;
|
|
183
|
+
const heat = await heatByFile(result, editors);
|
|
184
|
+
for (const editor of editors) {
|
|
185
|
+
decorateEditor(editor, heat);
|
|
186
|
+
}
|
|
187
|
+
// Count what was PAINTED, not what the profile held: a profile full of hot
|
|
188
|
+
// lines that matches no open editor used to log exactly like a successful
|
|
189
|
+
// pass, which is how the heat map stayed silently blank on Windows.
|
|
190
|
+
logger_1.Logger.info(`Profile decorations applied: ${String(appliedDecorations.length)} across ${String(editors.length)} visible editor(s)`
|
|
191
|
+
+ ` from ${String(result.hotLines.length)} hot lines, ${String(result.hotFunctions.length)} hot functions`);
|
|
192
|
+
}
|
|
193
|
+
/** Paint one editor's heat and record what was painted. */
|
|
194
|
+
function decorateEditor(editor, heat) {
|
|
195
|
+
const filePath = editor.document.uri.fsPath;
|
|
196
|
+
const optionsByColor = buildEditorDecorations(editor, heat);
|
|
197
|
+
applyDecorationsByColor(editor, optionsByColor);
|
|
198
|
+
recordApplied(appliedDecorations, filePath, optionsByColor);
|
|
199
|
+
}
|
|
200
|
+
/** Build the decoration options this editor will receive. */
|
|
201
|
+
function buildEditorDecorations(editor, heat) {
|
|
202
|
+
const key = heat.keyOf(editor.document.uri.fsPath);
|
|
203
|
+
const optionsByColor = new Map();
|
|
204
|
+
const lines = heat.lines.get(key);
|
|
205
|
+
if (lines !== undefined) {
|
|
206
|
+
buildLineDecorations(editor, lines, optionsByColor);
|
|
207
|
+
}
|
|
208
|
+
const funcs = heat.funcs.get(key);
|
|
209
|
+
if (funcs !== undefined) {
|
|
210
|
+
buildFuncDecorations(editor, funcs, { lines, optionsByColor });
|
|
211
|
+
}
|
|
212
|
+
return optionsByColor;
|
|
213
|
+
}
|
|
214
|
+
/** Apply one decoration type per colour to the editor. */
|
|
215
|
+
function applyDecorationsByColor(editor, optionsByColor) {
|
|
216
|
+
for (const [color, options] of optionsByColor) {
|
|
217
|
+
editor.setDecorations(getDecorationTypeForColor(color), options);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/** Clear all profiling decorations from visible editors. */
|
|
221
|
+
function clearProfileDecorations() {
|
|
222
|
+
for (const decorationType of decorationTypes.values()) {
|
|
223
|
+
for (const editor of vscode.window.visibleTextEditors) {
|
|
224
|
+
editor.setDecorations(decorationType, []);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
appliedDecorations = [];
|
|
228
|
+
}
|
|
229
|
+
/** Dispose all decoration types (call on extension deactivate). */
|
|
230
|
+
function disposeProfileDecorations() {
|
|
231
|
+
for (const decorationType of decorationTypes.values()) {
|
|
232
|
+
decorationType.dispose();
|
|
233
|
+
}
|
|
234
|
+
decorationTypes.clear();
|
|
235
|
+
appliedDecorations = [];
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=profiler-decorations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler-decorations.js","sourceRoot":"","sources":["../../src/profiler-decorations.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAA4C;AAE5C,MAAY,MAAM,mCAAe;AACjC,+BAAsC;AACtC,qCAAkC;AAClC,uDAAmE;AAyDnE,6DAA6D;AAC7D,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,wDAAwD;AACxD,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,yDAAyD;AACzD,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,8CAA8C;AAC9C,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,yCAAyC;AACzC,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,0CAA0C;AAC1C,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,0CAA0C;AAC1C,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAM,UAAU,GAAG,GAAgB,EAAE,CAAC;IACpC,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,IAAA,yBAAe,GAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE;IAChH,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,IAAA,yBAAe,GAAE,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE;IACjG,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,IAAA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6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dispose the profiler's UI artifacts. Session state lives in the store and is
|
|
3
|
+
* cleared by `store.reset()` on deactivation; the status bar and context keys
|
|
4
|
+
* follow reactively, so there is nothing imperative to tear down here.
|
|
5
|
+
*/
|
|
6
|
+
export declare function disposeProfiler(): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.disposeProfiler = disposeProfiler;
|
|
4
|
+
// Implements [PROF-UI]. See docs/specs/LSP-PROFILER-SPEC.md
|
|
5
|
+
const profiler_decorations_1 = require("./profiler-decorations");
|
|
6
|
+
const profiler_flamegraph_html_1 = require("./profiler-flamegraph-html");
|
|
7
|
+
const profile_server_1 = require("./profile-server");
|
|
8
|
+
const profiler_results_1 = require("./profiler-results");
|
|
9
|
+
/**
|
|
10
|
+
* Dispose the profiler's UI artifacts. Session state lives in the store and is
|
|
11
|
+
* cleared by `store.reset()` on deactivation; the status bar and context keys
|
|
12
|
+
* follow reactively, so there is nothing imperative to tear down here.
|
|
13
|
+
*/
|
|
14
|
+
function disposeProfiler() {
|
|
15
|
+
(0, profiler_decorations_1.disposeProfileDecorations)();
|
|
16
|
+
(0, profiler_flamegraph_html_1.disposeFlamegraphPanel)();
|
|
17
|
+
(0, profile_server_1.disposeProfileServer)();
|
|
18
|
+
(0, profiler_results_1.clearLastProfileResult)();
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=profiler-dispose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler-dispose.js","sourceRoot":"","sources":["../../src/profiler-dispose.ts"],"names":[],"mappings":";;;AAAA,4DAA4D;AAC5D,iEAAmE;AACnE,yEAAoE;AACpE,qDAAwD;AACxD,yDAA4D;AAE5D;;;;GAIG;AACH;IACE,IAAA,gDAAyB,GAAE,CAAC;IAC5B,IAAA,iDAAsB,GAAE,CAAC;IACzB,IAAA,qCAAoB,GAAE,CAAC;IACvB,IAAA,yCAAsB,GAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CPU profile results webview for the profiler.
|
|
3
|
+
*
|
|
4
|
+
* Owns the results panel end to end: the interactive flame graph hero (the
|
|
5
|
+
* inferno SVG the LSP exports on every stop, [PROF-EXPORT-FLAMEGRAPH]), summary
|
|
6
|
+
* cards, hot function/line tables with click-to-source navigation, and the
|
|
7
|
+
* result-landing flow that never dead-ends the user (#145): the panel is the
|
|
8
|
+
* primary view on stop, with the raw V8 trace one click away.
|
|
9
|
+
*
|
|
10
|
+
* Panel lifecycle, CSP, and safe data embedding come from the shared webview
|
|
11
|
+
* host ([PROF-UI-WEBVIEW], profiler-webview.ts).
|
|
12
|
+
*/
|
|
13
|
+
import type { ProfileResult } from "./profiler-decorations";
|
|
14
|
+
import type { WebviewMessage } from "./profiler-webview";
|
|
15
|
+
export { loadFlamegraphSvgDataUri } from "./flamegraph-artifact";
|
|
16
|
+
/**
|
|
17
|
+
* Whether a completed profile has nothing worth showing — no hot functions and
|
|
18
|
+
* no hot lines (#145).
|
|
19
|
+
*
|
|
20
|
+
* Raw sample count is the wrong signal: a sub-tick program (e.g.
|
|
21
|
+
* `debug_demo.py` ≈ 1 ms) finishes before its work can be sampled, yet the
|
|
22
|
+
* session keeps sampling the idle/exiting interpreter — so the result can carry
|
|
23
|
+
* dozens of samples that resolve to zero user-code attribution. A sampling
|
|
24
|
+
* profiler at 100 Hz cannot fix this by raising the rate; deterministic
|
|
25
|
+
* profiling can (Phase 2). When there is no attribution, say so honestly instead
|
|
26
|
+
* of presenting an empty flame chart/heat map as a result.
|
|
27
|
+
*/
|
|
28
|
+
export declare function profileHasNoUsableData(result: Pick<ProfileResult, "hotFunctions" | "hotLines">): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Land a completed CPU profile on a viewable result ([PROF-CPU-START], #145).
|
|
31
|
+
*
|
|
32
|
+
* The self-contained results panel (summary cards, flame graph hero, navigable
|
|
33
|
+
* hot-function/line tables) opens immediately as the primary view: it always
|
|
34
|
+
* renders, while VS Code's built-in `.cpuprofile` viewer lands on a raw
|
|
35
|
+
* self/total-time table that reads as a wall of numbers until the user finds
|
|
36
|
+
* its flame icon. The native trace stays one deliberate click away — the
|
|
37
|
+
* completion toast's "Open Trace in VS Code Viewer" action, the panel's own
|
|
38
|
+
* button, or the `${brand()}: Show Profile Results` re-entry command — so the
|
|
39
|
+
* user is never stranded and never dumped somewhere confusing.
|
|
40
|
+
*/
|
|
41
|
+
export declare function presentProfileResult(result: ProfileResult): Promise<void>;
|
|
42
|
+
/** Route a message posted from the results webview; a host that keeps its own results panel routes through it too. */
|
|
43
|
+
export declare function handleFlamegraphMessage(msg: WebviewMessage): void;
|
|
44
|
+
/** Open (or reveal) the profile results panel beside the source. */
|
|
45
|
+
export declare function openFlamegraphWebview(result: ProfileResult): Promise<void>;
|
|
46
|
+
/** The open results panel's view type, title and HTML (e2e seam). */
|
|
47
|
+
export declare function flamegraphPanelState(): {
|
|
48
|
+
readonly viewType: string;
|
|
49
|
+
readonly title: string;
|
|
50
|
+
readonly html: string;
|
|
51
|
+
} | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Test seam: is the self-contained results panel currently open? Lets the
|
|
54
|
+
* run→profile→view e2e assert the user reaches a working flame chart rather
|
|
55
|
+
* than dead-ending on the built-in viewer's error ([PROF-CPU-START]).
|
|
56
|
+
*/
|
|
57
|
+
export declare function flamegraphPanelOpen(): boolean;
|
|
58
|
+
/** Close and forget the panel (extension teardown). */
|
|
59
|
+
export declare function disposeFlamegraphPanel(): void;
|
|
60
|
+
/** Build the complete results-panel HTML for the profiler webview. */
|
|
61
|
+
export declare function buildFlamegraphHtml(result: ProfileResult): Promise<string>;
|