@nimblesite/lsp-profiler-ui 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. package/LICENSE +21 -0
  2. package/out/src/bind-host.d.ts +3 -0
  3. package/out/src/bind-host.js +52 -0
  4. package/out/src/bind-host.js.map +1 -0
  5. package/out/src/context-keys.d.ts +4 -0
  6. package/out/src/context-keys.js +54 -0
  7. package/out/src/context-keys.js.map +1 -0
  8. package/out/src/dap-evaluate.d.ts +84 -0
  9. package/out/src/dap-evaluate.js +442 -0
  10. package/out/src/dap-evaluate.js.map +1 -0
  11. package/out/src/dap-output.d.ts +50 -0
  12. package/out/src/dap-output.js +177 -0
  13. package/out/src/dap-output.js.map +1 -0
  14. package/out/src/debug/adapter-resolution.d.ts +56 -0
  15. package/out/src/debug/adapter-resolution.js +112 -0
  16. package/out/src/debug/adapter-resolution.js.map +1 -0
  17. package/out/src/debug/dap-messages.d.ts +18 -0
  18. package/out/src/debug/dap-messages.js +71 -0
  19. package/out/src/debug/dap-messages.js.map +1 -0
  20. package/out/src/debug/index.d.ts +7 -0
  21. package/out/src/debug/index.js +27 -0
  22. package/out/src/debug/index.js.map +1 -0
  23. package/out/src/debug/launch-config.d.ts +42 -0
  24. package/out/src/debug/launch-config.js +73 -0
  25. package/out/src/debug/launch-config.js.map +1 -0
  26. package/out/src/debug/launch-lifecycle.d.ts +29 -0
  27. package/out/src/debug/launch-lifecycle.js +40 -0
  28. package/out/src/debug/launch-lifecycle.js.map +1 -0
  29. package/out/src/debug/poll.d.ts +25 -0
  30. package/out/src/debug/poll.js +70 -0
  31. package/out/src/debug/poll.js.map +1 -0
  32. package/out/src/debug/profiling.d.ts +34 -0
  33. package/out/src/debug/profiling.js +81 -0
  34. package/out/src/debug/profiling.js.map +1 -0
  35. package/out/src/debug/testing/assertions.d.ts +27 -0
  36. package/out/src/debug/testing/assertions.js +111 -0
  37. package/out/src/debug/testing/assertions.js.map +1 -0
  38. package/out/src/debug/testing/dap-client.d.ts +86 -0
  39. package/out/src/debug/testing/dap-client.js +204 -0
  40. package/out/src/debug/testing/dap-client.js.map +1 -0
  41. package/out/src/debug/testing/index.d.ts +7 -0
  42. package/out/src/debug/testing/index.js +31 -0
  43. package/out/src/debug/testing/index.js.map +1 -0
  44. package/out/src/debug/testing/vscode-harness.d.ts +44 -0
  45. package/out/src/debug/testing/vscode-harness.js +81 -0
  46. package/out/src/debug/testing/vscode-harness.js.map +1 -0
  47. package/out/src/debug/ui-stubs.d.ts +26 -0
  48. package/out/src/debug/ui-stubs.js +88 -0
  49. package/out/src/debug/ui-stubs.js.map +1 -0
  50. package/out/src/debug-link-setup.d.ts +4 -0
  51. package/out/src/debug-link-setup.js +19 -0
  52. package/out/src/debug-link-setup.js.map +1 -0
  53. package/out/src/debug-link-view.d.ts +4 -0
  54. package/out/src/debug-link-view.js +49 -0
  55. package/out/src/debug-link-view.js.map +1 -0
  56. package/out/src/debug-link.d.ts +6 -0
  57. package/out/src/debug-link.js +95 -0
  58. package/out/src/debug-link.js.map +1 -0
  59. package/out/src/debug-selection.d.ts +14 -0
  60. package/out/src/debug-selection.js +33 -0
  61. package/out/src/debug-selection.js.map +1 -0
  62. package/out/src/debuggee-pause.d.ts +11 -0
  63. package/out/src/debuggee-pause.js +109 -0
  64. package/out/src/debuggee-pause.js.map +1 -0
  65. package/out/src/editor-path-key.d.ts +52 -0
  66. package/out/src/editor-path-key.js +105 -0
  67. package/out/src/editor-path-key.js.map +1 -0
  68. package/out/src/failure.d.ts +5 -0
  69. package/out/src/failure.js +53 -0
  70. package/out/src/failure.js.map +1 -0
  71. package/out/src/file-log-sink.d.ts +20 -0
  72. package/out/src/file-log-sink.js +74 -0
  73. package/out/src/file-log-sink.js.map +1 -0
  74. package/out/src/flame-html.d.ts +8 -0
  75. package/out/src/flame-html.js +104 -0
  76. package/out/src/flame-html.js.map +1 -0
  77. package/out/src/flame-model.d.ts +93 -0
  78. package/out/src/flame-model.js +242 -0
  79. package/out/src/flame-model.js.map +1 -0
  80. package/out/src/flame-script-helpers.d.ts +26 -0
  81. package/out/src/flame-script-helpers.js +71 -0
  82. package/out/src/flame-script-helpers.js.map +1 -0
  83. package/out/src/flame-script.d.ts +1 -0
  84. package/out/src/flame-script.js +332 -0
  85. package/out/src/flame-script.js.map +1 -0
  86. package/out/src/flame-time-order.d.ts +14 -0
  87. package/out/src/flame-time-order.js +112 -0
  88. package/out/src/flame-time-order.js.map +1 -0
  89. package/out/src/flamegraph-artifact.d.ts +9 -0
  90. package/out/src/flamegraph-artifact.js +45 -0
  91. package/out/src/flamegraph-artifact.js.map +1 -0
  92. package/out/src/host.d.ts +31 -0
  93. package/out/src/host.js +6 -0
  94. package/out/src/host.js.map +1 -0
  95. package/out/src/ids.d.ts +27 -0
  96. package/out/src/ids.js +63 -0
  97. package/out/src/ids.js.map +1 -0
  98. package/out/src/index.d.ts +42 -0
  99. package/out/src/index.js +98 -0
  100. package/out/src/index.js.map +1 -0
  101. package/out/src/logger.d.ts +50 -0
  102. package/out/src/logger.js +86 -0
  103. package/out/src/logger.js.map +1 -0
  104. package/out/src/memory-autopilot.d.ts +64 -0
  105. package/out/src/memory-autopilot.js +306 -0
  106. package/out/src/memory-autopilot.js.map +1 -0
  107. package/out/src/memory-capture-ids.d.ts +17 -0
  108. package/out/src/memory-capture-ids.js +45 -0
  109. package/out/src/memory-capture-ids.js.map +1 -0
  110. package/out/src/memory-capture-ingest.d.ts +15 -0
  111. package/out/src/memory-capture-ingest.js +84 -0
  112. package/out/src/memory-capture-ingest.js.map +1 -0
  113. package/out/src/memory-capture-legs.d.ts +4 -0
  114. package/out/src/memory-capture-legs.js +55 -0
  115. package/out/src/memory-capture-legs.js.map +1 -0
  116. package/out/src/memory-capture-present.d.ts +32 -0
  117. package/out/src/memory-capture-present.js +71 -0
  118. package/out/src/memory-capture-present.js.map +1 -0
  119. package/out/src/memory-capture-roundtrip.d.ts +17 -0
  120. package/out/src/memory-capture-roundtrip.js +75 -0
  121. package/out/src/memory-capture-roundtrip.js.map +1 -0
  122. package/out/src/memory-capture-state.d.ts +23 -0
  123. package/out/src/memory-capture-state.js +89 -0
  124. package/out/src/memory-capture-state.js.map +1 -0
  125. package/out/src/memory-capture-types.d.ts +28 -0
  126. package/out/src/memory-capture-types.js +70 -0
  127. package/out/src/memory-capture-types.js.map +1 -0
  128. package/out/src/memory-capture.d.ts +24 -0
  129. package/out/src/memory-capture.js +51 -0
  130. package/out/src/memory-capture.js.map +1 -0
  131. package/out/src/memory-dashboard-html.d.ts +3 -0
  132. package/out/src/memory-dashboard-html.js +327 -0
  133. package/out/src/memory-dashboard-html.js.map +1 -0
  134. package/out/src/memory-dashboard-mapping.d.ts +34 -0
  135. package/out/src/memory-dashboard-mapping.js +135 -0
  136. package/out/src/memory-dashboard-mapping.js.map +1 -0
  137. package/out/src/memory-dashboard.d.ts +82 -0
  138. package/out/src/memory-dashboard.js +142 -0
  139. package/out/src/memory-dashboard.js.map +1 -0
  140. package/out/src/memory-decorations.d.ts +61 -0
  141. package/out/src/memory-decorations.js +247 -0
  142. package/out/src/memory-decorations.js.map +1 -0
  143. package/out/src/memory-finalize.d.ts +25 -0
  144. package/out/src/memory-finalize.js +207 -0
  145. package/out/src/memory-finalize.js.map +1 -0
  146. package/out/src/memory-guidance.d.ts +14 -0
  147. package/out/src/memory-guidance.js +36 -0
  148. package/out/src/memory-guidance.js.map +1 -0
  149. package/out/src/memory-inspect-commands.d.ts +20 -0
  150. package/out/src/memory-inspect-commands.js +114 -0
  151. package/out/src/memory-inspect-commands.js.map +1 -0
  152. package/out/src/memory-launch-direct.d.ts +12 -0
  153. package/out/src/memory-launch-direct.js +74 -0
  154. package/out/src/memory-launch-direct.js.map +1 -0
  155. package/out/src/memory-launch.d.ts +4 -0
  156. package/out/src/memory-launch.js +92 -0
  157. package/out/src/memory-launch.js.map +1 -0
  158. package/out/src/memory-leak-offer.d.ts +18 -0
  159. package/out/src/memory-leak-offer.js +51 -0
  160. package/out/src/memory-leak-offer.js.map +1 -0
  161. package/out/src/memory-profiler.d.ts +27 -0
  162. package/out/src/memory-profiler.js +71 -0
  163. package/out/src/memory-profiler.js.map +1 -0
  164. package/out/src/memory-ref-graph.d.ts +62 -0
  165. package/out/src/memory-ref-graph.js +248 -0
  166. package/out/src/memory-ref-graph.js.map +1 -0
  167. package/out/src/memory-ref-picker.d.ts +21 -0
  168. package/out/src/memory-ref-picker.js +103 -0
  169. package/out/src/memory-ref-picker.js.map +1 -0
  170. package/out/src/memory-registration.d.ts +4 -0
  171. package/out/src/memory-registration.js +63 -0
  172. package/out/src/memory-registration.js.map +1 -0
  173. package/out/src/memory-start-core.d.ts +8 -0
  174. package/out/src/memory-start-core.js +165 -0
  175. package/out/src/memory-start-core.js.map +1 -0
  176. package/out/src/memory-start-stop-commands.d.ts +10 -0
  177. package/out/src/memory-start-stop-commands.js +75 -0
  178. package/out/src/memory-start-stop-commands.js.map +1 -0
  179. package/out/src/memory-start.d.ts +6 -0
  180. package/out/src/memory-start.js +13 -0
  181. package/out/src/memory-start.js.map +1 -0
  182. package/out/src/memory-status.d.ts +24 -0
  183. package/out/src/memory-status.js +135 -0
  184. package/out/src/memory-status.js.map +1 -0
  185. package/out/src/palette-vscode.d.ts +2 -0
  186. package/out/src/palette-vscode.js +50 -0
  187. package/out/src/palette-vscode.js.map +1 -0
  188. package/out/src/palette.d.ts +70 -0
  189. package/out/src/palette.js +150 -0
  190. package/out/src/palette.js.map +1 -0
  191. package/out/src/process-bind-panel.d.ts +11 -0
  192. package/out/src/process-bind-panel.js +65 -0
  193. package/out/src/process-bind-panel.js.map +1 -0
  194. package/out/src/process-commands.d.ts +5 -0
  195. package/out/src/process-commands.js +112 -0
  196. package/out/src/process-commands.js.map +1 -0
  197. package/out/src/process-context-keys.d.ts +11 -0
  198. package/out/src/process-context-keys.js +48 -0
  199. package/out/src/process-context-keys.js.map +1 -0
  200. package/out/src/process-decoration.d.ts +18 -0
  201. package/out/src/process-decoration.js +76 -0
  202. package/out/src/process-decoration.js.map +1 -0
  203. package/out/src/process-explorer-rows.d.ts +59 -0
  204. package/out/src/process-explorer-rows.js +47 -0
  205. package/out/src/process-explorer-rows.js.map +1 -0
  206. package/out/src/process-explorer.d.ts +66 -0
  207. package/out/src/process-explorer.js +241 -0
  208. package/out/src/process-explorer.js.map +1 -0
  209. package/out/src/process-group-item.d.ts +8 -0
  210. package/out/src/process-group-item.js +55 -0
  211. package/out/src/process-group-item.js.map +1 -0
  212. package/out/src/process-launch-item.d.ts +12 -0
  213. package/out/src/process-launch-item.js +57 -0
  214. package/out/src/process-launch-item.js.map +1 -0
  215. package/out/src/process-launch.d.ts +47 -0
  216. package/out/src/process-launch.js +205 -0
  217. package/out/src/process-launch.js.map +1 -0
  218. package/out/src/process-message-item.d.ts +10 -0
  219. package/out/src/process-message-item.js +53 -0
  220. package/out/src/process-message-item.js.map +1 -0
  221. package/out/src/process-poll.d.ts +26 -0
  222. package/out/src/process-poll.js +125 -0
  223. package/out/src/process-poll.js.map +1 -0
  224. package/out/src/process-reactivity.d.ts +55 -0
  225. package/out/src/process-reactivity.js +188 -0
  226. package/out/src/process-reactivity.js.map +1 -0
  227. package/out/src/process-registration.d.ts +11 -0
  228. package/out/src/process-registration.js +55 -0
  229. package/out/src/process-registration.js.map +1 -0
  230. package/out/src/process-tree-item.d.ts +18 -0
  231. package/out/src/process-tree-item.js +219 -0
  232. package/out/src/process-tree-item.js.map +1 -0
  233. package/out/src/processes-state.d.ts +75 -0
  234. package/out/src/processes-state.js +76 -0
  235. package/out/src/processes-state.js.map +1 -0
  236. package/out/src/profile-on-launch.d.ts +4 -0
  237. package/out/src/profile-on-launch.js +16 -0
  238. package/out/src/profile-on-launch.js.map +1 -0
  239. package/out/src/profile-server.d.ts +24 -0
  240. package/out/src/profile-server.js +170 -0
  241. package/out/src/profile-server.js.map +1 -0
  242. package/out/src/profiler-attach.d.ts +19 -0
  243. package/out/src/profiler-attach.js +129 -0
  244. package/out/src/profiler-attach.js.map +1 -0
  245. package/out/src/profiler-commands.d.ts +8 -0
  246. package/out/src/profiler-commands.js +110 -0
  247. package/out/src/profiler-commands.js.map +1 -0
  248. package/out/src/profiler-decorations.d.ts +74 -0
  249. package/out/src/profiler-decorations.js +237 -0
  250. package/out/src/profiler-decorations.js.map +1 -0
  251. package/out/src/profiler-dispose.d.ts +6 -0
  252. package/out/src/profiler-dispose.js +20 -0
  253. package/out/src/profiler-dispose.js.map +1 -0
  254. package/out/src/profiler-flamegraph-html.d.ts +61 -0
  255. package/out/src/profiler-flamegraph-html.js +366 -0
  256. package/out/src/profiler-flamegraph-html.js.map +1 -0
  257. package/out/src/profiler-format.d.ts +10 -0
  258. package/out/src/profiler-format.js +28 -0
  259. package/out/src/profiler-format.js.map +1 -0
  260. package/out/src/profiler-launch-cooperative.d.ts +16 -0
  261. package/out/src/profiler-launch-cooperative.js +167 -0
  262. package/out/src/profiler-launch-cooperative.js.map +1 -0
  263. package/out/src/profiler-launch.d.ts +29 -0
  264. package/out/src/profiler-launch.js +123 -0
  265. package/out/src/profiler-launch.js.map +1 -0
  266. package/out/src/profiler-results.d.ts +22 -0
  267. package/out/src/profiler-results.js +104 -0
  268. package/out/src/profiler-results.js.map +1 -0
  269. package/out/src/profiler-session-core.d.ts +42 -0
  270. package/out/src/profiler-session-core.js +116 -0
  271. package/out/src/profiler-session-core.js.map +1 -0
  272. package/out/src/profiler-state.d.ts +87 -0
  273. package/out/src/profiler-state.js +83 -0
  274. package/out/src/profiler-state.js.map +1 -0
  275. package/out/src/profiler-status.d.ts +38 -0
  276. package/out/src/profiler-status.js +163 -0
  277. package/out/src/profiler-status.js.map +1 -0
  278. package/out/src/profiler-styles.d.ts +21 -0
  279. package/out/src/profiler-styles.js +160 -0
  280. package/out/src/profiler-styles.js.map +1 -0
  281. package/out/src/profiler-webview.d.ts +95 -0
  282. package/out/src/profiler-webview.js +243 -0
  283. package/out/src/profiler-webview.js.map +1 -0
  284. package/out/src/profiler.d.ts +23 -0
  285. package/out/src/profiler.js +113 -0
  286. package/out/src/profiler.js.map +1 -0
  287. package/out/src/progress-ops.d.ts +24 -0
  288. package/out/src/progress-ops.js +135 -0
  289. package/out/src/progress-ops.js.map +1 -0
  290. package/out/src/reactive-refresh.d.ts +24 -0
  291. package/out/src/reactive-refresh.js +33 -0
  292. package/out/src/reactive-refresh.js.map +1 -0
  293. package/out/src/sample-summary.d.ts +39 -0
  294. package/out/src/sample-summary.js +32 -0
  295. package/out/src/sample-summary.js.map +1 -0
  296. package/out/src/sampled-view.d.ts +15 -0
  297. package/out/src/sampled-view.js +56 -0
  298. package/out/src/sampled-view.js.map +1 -0
  299. package/out/src/server-command.d.ts +4 -0
  300. package/out/src/server-command.js +14 -0
  301. package/out/src/server-command.js.map +1 -0
  302. package/out/src/settings.d.ts +1 -0
  303. package/out/src/settings.js +22 -0
  304. package/out/src/settings.js.map +1 -0
  305. package/out/src/store.d.ts +34 -0
  306. package/out/src/store.js +64 -0
  307. package/out/src/store.js.map +1 -0
  308. package/out/src/testing/cpu-capture-assertions.d.ts +8 -0
  309. package/out/src/testing/cpu-capture-assertions.js +71 -0
  310. package/out/src/testing/cpu-capture-assertions.js.map +1 -0
  311. package/out/src/testing/cpu-capture-contract.d.ts +8 -0
  312. package/out/src/testing/cpu-capture-contract.js +123 -0
  313. package/out/src/testing/cpu-capture-contract.js.map +1 -0
  314. package/out/src/testing/webview-contract-helpers.d.ts +24 -0
  315. package/out/src/testing/webview-contract-helpers.js +125 -0
  316. package/out/src/testing/webview-contract-helpers.js.map +1 -0
  317. package/out/src/testing/webview-contract-leak.d.ts +2 -0
  318. package/out/src/testing/webview-contract-leak.js +80 -0
  319. package/out/src/testing/webview-contract-leak.js.map +1 -0
  320. package/out/src/testing/webview-contract-memory.d.ts +5 -0
  321. package/out/src/testing/webview-contract-memory.js +221 -0
  322. package/out/src/testing/webview-contract-memory.js.map +1 -0
  323. package/out/src/testing/webview-contract-palette.d.ts +6 -0
  324. package/out/src/testing/webview-contract-palette.js +121 -0
  325. package/out/src/testing/webview-contract-palette.js.map +1 -0
  326. package/out/src/testing/webview-contract-panel.d.ts +7 -0
  327. package/out/src/testing/webview-contract-panel.js +100 -0
  328. package/out/src/testing/webview-contract-panel.js.map +1 -0
  329. package/out/src/testing/webview-contract-results.d.ts +6 -0
  330. package/out/src/testing/webview-contract-results.js +136 -0
  331. package/out/src/testing/webview-contract-results.js.map +1 -0
  332. package/out/src/testing/webview-contract.d.ts +18 -0
  333. package/out/src/testing/webview-contract.js +23 -0
  334. package/out/src/testing/webview-contract.js.map +1 -0
  335. package/out/src/timeouts.d.ts +21 -0
  336. package/out/src/timeouts.js +30 -0
  337. package/out/src/timeouts.js.map +1 -0
  338. package/out/src/trace-actions.d.ts +33 -0
  339. package/out/src/trace-actions.js +135 -0
  340. package/out/src/trace-actions.js.map +1 -0
  341. package/out/src/unknown-shape.d.ts +58 -0
  342. package/out/src/unknown-shape.js +110 -0
  343. package/out/src/unknown-shape.js.map +1 -0
  344. package/out/src/wire-adapters.d.ts +18 -0
  345. package/out/src/wire-adapters.js +160 -0
  346. package/out/src/wire-adapters.js.map +1 -0
  347. package/out/src/wire-generated.d.ts +760 -0
  348. package/out/src/wire-generated.js +38 -0
  349. package/out/src/wire-generated.js.map +1 -0
  350. package/package.json +53 -4
  351. package/scripts/contributions.mjs +187 -0
  352. package/README.md +0 -3
@@ -0,0 +1,39 @@
1
+ export interface FiberInfo {
2
+ id: number;
3
+ label: string;
4
+ samples: number;
5
+ oncpuSamples: number;
6
+ }
7
+ export interface HotFunctionInfo {
8
+ name: string;
9
+ file: string;
10
+ line: number;
11
+ selfPct: number;
12
+ totalPct: number;
13
+ selfSamples: number;
14
+ totalSamples: number;
15
+ kind: string;
16
+ }
17
+ export interface HotLineInfo {
18
+ file: string;
19
+ line: number;
20
+ pct: number;
21
+ samples: number;
22
+ }
23
+ export interface ProfileSummary {
24
+ schedulingKnown?: boolean;
25
+ version: number;
26
+ program: string;
27
+ wallSeconds: number;
28
+ cpuSeconds: number;
29
+ sampleCount: number;
30
+ rateHz: number;
31
+ droppedSamples: number;
32
+ fibers: FiberInfo[];
33
+ hotFunctions: HotFunctionInfo[];
34
+ hotLines: HotLineInfo[];
35
+ }
36
+ /** `4182 samples · 997Hz · 4.2s wall · 3.9s CPU · 3 fibers` (+ dropped). */
37
+ export declare function formatSummaryHeader(summary: ProfileSummary): string;
38
+ /** A fiber's on-CPU share as a whole percentage (0 when it never sampled). */
39
+ export declare function onCpuPct(fiber: FiberInfo): number;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatSummaryHeader = formatSummaryHeader;
4
+ exports.onCpuPct = onCpuPct;
5
+ const SECONDS_SMALL_LIMIT = 0.1;
6
+ const MS_PER_SECOND = 1000;
7
+ const SECONDS_LARGE_LIMIT = 100;
8
+ const PERCENT = 100;
9
+ function formatSeconds(seconds) {
10
+ if (seconds > 0 && seconds < SECONDS_SMALL_LIMIT) {
11
+ return `${(seconds * MS_PER_SECOND).toFixed(1)}ms`;
12
+ }
13
+ return `${seconds >= SECONDS_LARGE_LIMIT ? seconds.toFixed(0) : seconds.toFixed(1)}s`;
14
+ }
15
+ /** `4182 samples · 997Hz · 4.2s wall · 3.9s CPU · 3 fibers` (+ dropped). */
16
+ function formatSummaryHeader(summary) {
17
+ if (summary.schedulingKnown === false) {
18
+ return `${String(summary.sampleCount)} samples · ${formatSeconds(summary.wallSeconds)} wall · ${String(summary.fibers.length)} threads`;
19
+ }
20
+ const fibers = `${String(summary.fibers.length)} ${summary.fibers.length === 1 ? "fiber" : "fibers"}`;
21
+ const dropped = summary.droppedSamples > 0 ? ` · ${String(summary.droppedSamples)} dropped` : "";
22
+ return (`${String(summary.sampleCount)} samples · ${String(summary.rateHz)}Hz · ` +
23
+ `${formatSeconds(summary.wallSeconds)} wall · ${formatSeconds(summary.cpuSeconds)} CPU · ` +
24
+ `${fibers}${dropped}`);
25
+ }
26
+ /** A fiber's on-CPU share as a whole percentage (0 when it never sampled). */
27
+ function onCpuPct(fiber) {
28
+ return fiber.samples > 0
29
+ ? Math.round((PERCENT * fiber.oncpuSamples) / fiber.samples)
30
+ : 0;
31
+ }
32
+ //# sourceMappingURL=sample-summary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sample-summary.js","sourceRoot":"","sources":["../../src/sample-summary.ts"],"names":[],"mappings":";;;;AAwCA,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,OAAO,GAAG,GAAG,CAAC;AAEpB,SAAS,aAAa,CAAC,OAAe;IACpC,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,mBAAmB,EAAE,CAAC;QACjD,OAAO,GAAG,CAAC,OAAO,GAAG,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC;IACD,OAAO,GAAG,OAAO,IAAI,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACxF,CAAC;AAED,4EAA4E;AAC5E,6BAAoC,OAAuB;IACzD,IAAI,OAAO,CAAC,eAAe,KAAK,KAAK,EAAE,CAAC;QAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,cAAc,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;IAAC,CAAC;IACnL,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IACtG,MAAM,OAAO,GACX,OAAO,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IACnF,OAAO,CACL,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,cAAc,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO;QACzE,GAAG,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS;QAC1F,GAAG,MAAM,GAAG,OAAO,EAAE,CACtB,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,kBAAyB,KAAgB;IACvC,OAAO,KAAK,CAAC,OAAO,GAAG,CAAC;QACtB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;QAC5D,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { FlameModel } from "./flame-model";
2
+ import type { ProfileSummary } from "./sample-summary";
3
+ import type { ProfileResult } from "./profiler-decorations";
4
+ export interface SampledView {
5
+ readonly model: FlameModel;
6
+ readonly summary: ProfileSummary;
7
+ }
8
+ /** Load the existing speedscope artifact; metadata from the native host stays intact. */
9
+ export declare function sampledView(result: ProfileResult): Promise<SampledView | undefined>;
10
+ /** One renderer and interaction script, shared with native host imports. */
11
+ export declare function sampledParts(view: SampledView | undefined): {
12
+ css: string;
13
+ body: string;
14
+ script: string;
15
+ };
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sampledView = sampledView;
4
+ exports.sampledParts = sampledParts;
5
+ // Implements [PROF-UI-SAMPLED]. Shared interactive view for every sampled runtime.
6
+ const promises_1 = require("node:fs/promises");
7
+ const flame_model_1 = require("./flame-model");
8
+ const flame_html_1 = require("./flame-html");
9
+ const flame_script_1 = require("./flame-script");
10
+ const palette_1 = require("./palette");
11
+ const logger_1 = require("./logger");
12
+ /** Load the existing speedscope artifact; metadata from the native host stays intact. */
13
+ async function sampledView(result) {
14
+ if (result.sampled !== undefined) {
15
+ return result.sampled;
16
+ }
17
+ if (result.outputFile === "") {
18
+ return undefined;
19
+ }
20
+ return sampledViewFromFile(result);
21
+ }
22
+ /** Build the sampled view from the existing speedscope artifact on disk. */
23
+ async function sampledViewFromFile(result) {
24
+ try {
25
+ const parsed = (0, flame_model_1.parseSpeedscope)(await (0, promises_1.readFile)(result.outputFile, "utf8"));
26
+ if (!parsed.ok) {
27
+ logger_1.Logger.warn(parsed.error);
28
+ return undefined;
29
+ }
30
+ const model = (0, flame_model_1.buildFlameModel)(parsed.value);
31
+ return { model, summary: summaryFromResult(result, model) };
32
+ }
33
+ catch (error) {
34
+ logger_1.Logger.warn(`Sampled view unavailable: ${String(error)}`);
35
+ return undefined;
36
+ }
37
+ }
38
+ function summaryFromResult(result, model) {
39
+ return {
40
+ schedulingKnown: false, version: 1, program: "", wallSeconds: result.duration, cpuSeconds: 0,
41
+ sampleCount: result.totalSamples, rateHz: 0, droppedSamples: 0,
42
+ fibers: model.fibers.map((fiber, id) => ({ id, label: fiber.name,
43
+ samples: fiber.sampleCount, oncpuSamples: 0 })),
44
+ hotFunctions: [], hotLines: [],
45
+ };
46
+ }
47
+ /** One renderer and interaction script, shared with native host imports. */
48
+ function sampledParts(view) {
49
+ if (view === undefined) {
50
+ return { css: "", body: "", script: "" };
51
+ }
52
+ const palette = (0, palette_1.profilerPalette)();
53
+ const model = { ...view.model, frames: (0, palette_1.paletteFrames)(view.model.frames, palette) };
54
+ return { css: flame_html_1.FLAME_CSS, body: (0, flame_html_1.flameBody)(model, view.summary), script: flame_script_1.FLAME_SCRIPT };
55
+ }
56
+ //# sourceMappingURL=sampled-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sampled-view.js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OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC;QAC5F,WAAW,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC;QAC9D,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI;YAC9D,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC;QACjD,YAAY,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE;KAC/B,CAAC;AACJ,CAAC;AAED,4EAA4E;AAC5E,sBAA6B,IAA6B;IACxD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAAC,CAAC;IACrE,MAAM,OAAO,GAAG,IAAA,yBAAe,GAAE,CAAC;IAClC,MAAM,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAA,uBAAa,EAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACnF,OAAO,EAAE,GAAG,EAAE,sBAAS,EAAE,IAAI,EAAE,IAAA,sBAAS,EAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,2BAAY,EAAE,CAAC;AACxF,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Every profiler request is one `workspace/executeCommand` with one argument object. */
2
+ import type { LanguageClient } from "vscode-languageclient/node";
3
+ /** Run the server command `command` with `args`; a `null` reply is `undefined`. */
4
+ export declare function executeServerCommand<Reply>(client: LanguageClient, command: string, args: object): Promise<Reply | undefined>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ // Implements [PROF-WIRE-METHODS]. See docs/specs/LSP-PROFILER-SPEC.md
3
+ /** Every profiler request is one `workspace/executeCommand` with one argument object. */
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.executeServerCommand = executeServerCommand;
6
+ /** Run the server command `command` with `args`; a `null` reply is `undefined`. */
7
+ async function executeServerCommand(client, command, args) {
8
+ const reply = await client.sendRequest("workspace/executeCommand", {
9
+ command,
10
+ arguments: [args],
11
+ });
12
+ return reply ?? undefined;
13
+ }
14
+ //# sourceMappingURL=server-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-command.js","sourceRoot":"","sources":["../../src/server-command.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,yFAAyF;;;AAIzF,mFAAmF;AAC5E,KAAK,+BACV,MAAsB,EACtB,OAAe,EACf,IAAY;IAEZ,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,WAAW,CAA2B,0BAA0B,EAAE;QAC3F,OAAO;QACP,SAAS,EAAE,CAAC,IAAI,CAAC;KAClB,CAAC,CAAC;IACH,OAAO,KAAK,IAAI,SAAS,CAAC;AAC5B,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const PROFILER_SETTING_KEYS: readonly ["profiler.palette", "profiler.sampleRate", "profiler.includeNative", "profiler.lineThreshold", "profiler.functionThreshold", "profiler.maxDiagnosticsPerFile", "profiler.showInlineHeatMap", "profiler.profileOnLaunch", "profiler.processRefreshMs", "profiler.preset", "profiler.autoSnapshotOnPause", "profiler.autoSnapshot", "profiler.autoSnapshotInterval"];
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ // The `profiler.*` settings the library reads under the host's section.
3
+ // A host's package.json contributes each one as `<section>.profiler.<key>`;
4
+ // its manifest test checks the list against this constant.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PROFILER_SETTING_KEYS = void 0;
7
+ exports.PROFILER_SETTING_KEYS = [
8
+ "profiler.palette",
9
+ "profiler.sampleRate",
10
+ "profiler.includeNative",
11
+ "profiler.lineThreshold",
12
+ "profiler.functionThreshold",
13
+ "profiler.maxDiagnosticsPerFile",
14
+ "profiler.showInlineHeatMap",
15
+ "profiler.profileOnLaunch",
16
+ "profiler.processRefreshMs",
17
+ "profiler.preset",
18
+ "profiler.autoSnapshotOnPause",
19
+ "profiler.autoSnapshot",
20
+ "profiler.autoSnapshotInterval",
21
+ ];
22
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/settings.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,4EAA4E;AAC5E,2DAA2D;;;AAE9C,QAAA,qBAAqB,GAAG;IACnC,kBAAkB;IAClB,qBAAqB;IACrB,wBAAwB;IACxB,wBAAwB;IACxB,4BAA4B;IAC5B,gCAAgC;IAChC,4BAA4B;IAC5B,0BAA0B;IAC1B,2BAA2B;IAC3B,iBAAiB;IACjB,8BAA8B;IAC9B,uBAAuB;IACvB,+BAA+B;CACvB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { ReadonlySignal } from "@preact/signals-core";
2
+ import type { LanguageClient } from "vscode-languageclient/node";
3
+ import type { ProfilerCapabilities } from "./wire-generated";
4
+ import type { ProfilerHost } from "./host";
5
+ import type { ProcessPanelActions, ProcessPanelState } from "./processes-state";
6
+ import type { ProfilerActions, ProfilerSession } from "./profiler-state";
7
+ export interface ProfilerStore extends ProfilerActions, ProcessPanelActions {
8
+ readonly host: ProfilerHost;
9
+ readonly client: ReadonlySignal<LanguageClient | undefined>;
10
+ readonly sessionIdToPid: ReadonlySignal<ReadonlyMap<string, number>>;
11
+ readonly profiler: ReadonlySignal<ProfilerSession>;
12
+ readonly profilerBusy: ReadonlySignal<boolean>;
13
+ readonly cpuBusy: ReadonlySignal<boolean>;
14
+ readonly memoryBusy: ReadonlySignal<boolean>;
15
+ readonly processes: ReadonlySignal<ProcessPanelState>;
16
+ readonly processesRevision: ReadonlySignal<number>;
17
+ /** What the server's runtimes can do ([PROF-UI-CAPABILITIES]); `undefined` until the server initialised. */
18
+ readonly capabilities: ReadonlySignal<ProfilerCapabilities | undefined>;
19
+ getDebuggeeProcessId: (sessionId: string) => number | undefined;
20
+ /** Whether `runtime` reads its own heap, so any attachable process can be memory-tracked. */
21
+ memoryIsDirect: (runtime: string) => boolean;
22
+ /** False once the server advertised its runtimes and none tracks memory, so no memory action is offered. */
23
+ memoryOffered: () => boolean;
24
+ /** False once the server advertised its runtimes and `runtime` is not one with a memory backend. */
25
+ tracksMemory: (runtime: string) => boolean;
26
+ /** The runtime's advertised `display_name`, or its wire id when the server named none. */
27
+ runtimeName: (runtime: string) => string;
28
+ /** Whether `runtime`'s process entries are source files the editor can open. */
29
+ sourceEntries: (runtime: string) => boolean;
30
+ /** Return every signal to idle (deactivation, test teardown). */
31
+ reset: () => void;
32
+ }
33
+ /** Create the profiler's reactive state bound to `host`. Factory, never a singleton. */
34
+ export declare function createProfilerStore(host: ProfilerHost): ProfilerStore;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ // Implements [PROF-UI-STATE]. All profiler UI state lives in signals here;
3
+ // screens render from them and mutate only through the actions. The host
4
+ // supplies the client and the debuggee map; the library owns the rest.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createProfilerStore = createProfilerStore;
7
+ const signals_core_1 = require("@preact/signals-core");
8
+ const unknown_shape_1 = require("./unknown-shape");
9
+ const bind_host_1 = require("./bind-host");
10
+ const processes_state_1 = require("./processes-state");
11
+ const profiler_state_1 = require("./profiler-state");
12
+ /** The `experimental.lspProfiler` block of the server's initialize result, when present. */
13
+ function advertisedCapabilities(client) {
14
+ const experimental = client?.initializeResult?.capabilities.experimental;
15
+ const block = (0, unknown_shape_1.isRecord)(experimental) ? experimental.lspProfiler : undefined;
16
+ return isProfilerCapabilities(block) ? block : undefined;
17
+ }
18
+ /** A capabilities block: a runtime list, each runtime naming its id ([PROF-UI-CAPABILITIES]). */
19
+ function isProfilerCapabilities(block) {
20
+ return (0, unknown_shape_1.isRecord)(block) && Array.isArray(block.runtimes)
21
+ && block.runtimes.every((runtime) => (0, unknown_shape_1.isRecord)(runtime) && typeof runtime.id === "string");
22
+ }
23
+ /** What the advertised runtimes can do; before the server advertises, nothing is ruled out. */
24
+ function runtimeQueries(capabilities) {
25
+ const find = (runtime) => capabilities.value?.runtimes.find((info) => info.id === runtime);
26
+ return {
27
+ memoryIsDirect: (runtime) => find(runtime)?.memory?.mode.kind === "Direct",
28
+ memoryOffered: () => capabilities.value?.runtimes.some((info) => info.memory !== undefined) ?? true,
29
+ tracksMemory: (runtime) => capabilities.value === undefined || find(runtime)?.memory !== undefined,
30
+ runtimeName: (runtime) => find(runtime)?.display_name ?? runtime,
31
+ sourceEntries: (runtime) => find(runtime)?.source_entries === true,
32
+ };
33
+ }
34
+ /** Create the profiler's reactive state bound to `host`. Factory, never a singleton. */
35
+ function createProfilerStore(host) {
36
+ (0, bind_host_1.bindHost)(host);
37
+ const profiler = (0, signals_core_1.signal)(profiler_state_1.IDLE_PROFILER_SESSION);
38
+ const processes = (0, signals_core_1.signal)(processes_state_1.IDLE_PROCESS_PANEL);
39
+ const capabilities = (0, signals_core_1.computed)(() => advertisedCapabilities(host.client.value));
40
+ return {
41
+ capabilities,
42
+ ...runtimeQueries(capabilities),
43
+ host,
44
+ client: host.client,
45
+ sessionIdToPid: host.sessionIdToPid,
46
+ getDebuggeeProcessId: (sessionId) => host.sessionIdToPid.value.get(sessionId),
47
+ ...sessionState(profiler),
48
+ processes,
49
+ processesRevision: (0, signals_core_1.computed)(() => processes.value.revision),
50
+ ...(0, processes_state_1.createProcessPanelActions)(processes),
51
+ reset() { profiler.value = profiler_state_1.IDLE_PROFILER_SESSION; processes.value = processes_state_1.IDLE_PROCESS_PANEL; },
52
+ };
53
+ }
54
+ /** The session signal, what it says about each leg, and the only way to change it. */
55
+ function sessionState(profiler) {
56
+ return {
57
+ profiler,
58
+ profilerBusy: (0, signals_core_1.computed)(() => (0, profiler_state_1.isProfilerBusy)(profiler.value)),
59
+ cpuBusy: (0, signals_core_1.computed)(() => (0, profiler_state_1.isCpuBusy)(profiler.value)),
60
+ memoryBusy: (0, signals_core_1.computed)(() => (0, profiler_state_1.isMemoryBusy)(profiler.value)),
61
+ ...(0, profiler_state_1.createProfilerActions)(profiler),
62
+ };
63
+ }
64
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,yEAAyE;AACzE,uEAAuE;;;AAEvE,uDAAwD;AAGxD,mDAA2C;AAG3C,2CAAuC;AACvC,uDAAkF;AAElF,qDAAyH;AA8BzH,4FAA4F;AAC5F,SAAS,sBAAsB,CAAC,MAAkC;IAChE,MAAM,YAAY,GAAY,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,YAAY,CAAC;IAClF,MAAM,KAAK,GAAG,IAAA,wBAAQ,EAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3D,CAAC;AAED,iGAAiG;AACjG,SAAS,sBAAsB,CAAC,KAAc;IAC5C,OAAO,IAAA,wBAAQ,EAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;WAClD,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,wBAAQ,EAAC,OAAO,CAAC,IAAI,OAAO,OAAO,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;AAC9F,CAAC;AAID,+FAA+F;AAC/F,SAAS,cAAc,CAAC,YAA8D;IACpF,MAAM,IAAI,GAAG,CAAC,OAAe,EAA2B,EAAE,C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AE,IAAI,CAAC,cAAc;QACnC,oBAAoB,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC;QAC7E,GAAG,YAAY,CAAC,QAAQ,CAAC;QACzB,SAAS;QACT,iBAAiB,EAAE,IAAA,uBAAQ,EAAC,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC3D,GAAG,IAAA,2CAAyB,EAAC,SAAS,CAAC;QACvC,KAAK,KAAK,QAAQ,CAAC,KAAK,GAAG,sCAAqB,CAAC,CAAC,SAAS,CAAC,KAAK,GAAG,oCAAkB,CAAC,CAAC,CAAC;KAC1F,CAAC;AACJ,CAAC;AAED,sFAAsF;AACtF,SAAS,YAAY,CAAC,QAAiC;IAErD,OAAO;QACL,QAAQ;QACR,YAAY,EAAE,IAAA,uBAAQ,EAAC,GAAG,EAAE,CAAC,IAAA,+BAAc,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC5D,OAAO,EAAE,IAAA,uBAAQ,EAAC,GAAG,EAAE,CAAC,IAAA,0BAAS,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClD,UAAU,EAAE,IAAA,uBAAQ,EAAC,GAAG,EAAE,CAAC,IAAA,6BAAY,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACxD,GAAG,IAAA,sCAAqB,EAAC,QAAQ,CAAC;KACnC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ProfileResult } from "../profiler-decorations";
2
+ /** The captured result must attribute samples to real source files and carry both artifacts. */
3
+ export declare function capturesAttributedSamples(result: ProfileResult): Promise<void>;
4
+ /**
5
+ * The real host must mount both interactive views and the expected controls.
6
+ * With `reviewHtmlPath`, the rendered panel is also written there for a human review.
7
+ */
8
+ export declare function mountsTheInteractiveViews(result: ProfileResult, reviewHtmlPath?: string): Promise<void>;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.capturesAttributedSamples = capturesAttributedSamples;
37
+ exports.mountsTheInteractiveViews = mountsTheInteractiveViews;
38
+ // Implements [PROF-TESTING]. Shared native-capture assertions for the real VSIX host.
39
+ const assert = __importStar(require("node:assert/strict"));
40
+ const fs = __importStar(require("node:fs"));
41
+ const profiler_flamegraph_html_1 = require("../profiler-flamegraph-html");
42
+ const flame_model_1 = require("../flame-model");
43
+ const unknown_shape_1 = require("../unknown-shape");
44
+ const webview_contract_helpers_1 = require("./webview-contract-helpers");
45
+ /** The captured result must attribute samples to real source files and carry both artifacts. */
46
+ async function capturesAttributedSamples(result) {
47
+ assert.ok(result.totalSamples > 0);
48
+ assert.ok(result.hotFunctions.some(fn => fn.file !== undefined && fn.file !== "" && fn.percentage > 0));
49
+ const parsed = (0, flame_model_1.parseSpeedscope)(await fs.promises.readFile(result.outputFile, "utf8"));
50
+ assert.ok(parsed.ok, parsed.ok ? "" : parsed.error);
51
+ assert.ok(result.cpuProfilePath !== undefined && result.cpuProfilePath !== "");
52
+ const cpu = JSON.parse(await fs.promises.readFile(result.cpuProfilePath, "utf8"));
53
+ assert.ok((0, unknown_shape_1.isRecord)(cpu) && Array.isArray(cpu.nodes) && cpu.nodes.length > 0 && Array.isArray(cpu.samples) && cpu.samples.length > 0);
54
+ }
55
+ /**
56
+ * The real host must mount both interactive views and the expected controls.
57
+ * With `reviewHtmlPath`, the rendered panel is also written there for a human review.
58
+ */
59
+ async function mountsTheInteractiveViews(result, reviewHtmlPath) {
60
+ await (0, profiler_flamegraph_html_1.openFlamegraphWebview)(result);
61
+ const panel = (0, profiler_flamegraph_html_1.flamegraphPanelState)();
62
+ assert.ok(panel !== undefined);
63
+ for (const id of ["flame", "btn-left", "btn-time", "fiber-select", "search", "btn-reset", "trace-actions", "fn-body", "line-body"]) {
64
+ assert.ok(panel.html.includes(`id="${id}"`), `${id} is reachable in the real host`);
65
+ }
66
+ (0, webview_contract_helpers_1.assertHardened)(panel.html, "captured profile");
67
+ if (reviewHtmlPath !== undefined && reviewHtmlPath !== "") {
68
+ await fs.promises.writeFile(reviewHtmlPath, await (0, profiler_flamegraph_html_1.buildFlamegraphHtml)(result));
69
+ }
70
+ }
71
+ //# sourceMappingURL=cpu-capture-assertions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cpu-capture-assertions.js","sourceRoot":"","sources":["../../../src/testing/cpu-capture-assertions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sFAAsF;AACtF,MAAY,MAAM,+CAA2B;AAC7C,MAAY,EAAE,oCAAgB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AK,oCAAoC,MAAqB,EAAE,cAAuB;IAC5F,MAAM,IAAA,gDAAqB,EAAC,MAAM,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,IAAA,+CAAoB,GAAE,CAAC;IACrC,MAAM,CAAC,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;IAC/B,KAAK,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,CAAC;QACnI,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,gCAAgC,CAAC,CAAC;IACtF,CAAC;IACD,IAAA,yCAAc,EAAC,KAAK,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IAC/C,IAAI,cAAc,KAAK,SAAS,IAAI,cAAc,KAAK,EAAE,EAAE,CAAC;QAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,IAAA,8CAAmB,EAAC,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;AAChJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ProfileResult } from "../profiler-decorations";
2
+ /** Options a host passes to the shared capture contract. */
3
+ export interface CpuCaptureContractOptions {
4
+ /** Where to also write the captured results panel for a human review; omitted writes nothing. */
5
+ readonly reviewHtmlPath?: string;
6
+ }
7
+ /** Register the contract against `capture`, the host's own real runtime capture. */
8
+ export declare function registerCpuCaptureContract(capture: () => Promise<ProfileResult>, options?: CpuCaptureContractOptions): void;
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.registerCpuCaptureContract = registerCpuCaptureContract;
37
+ // Implements [PROF-TESTING]. Identical native-capture assertions in each real VSIX host.
38
+ const assert = __importStar(require("node:assert/strict"));
39
+ const fs = __importStar(require("node:fs"));
40
+ const vscode = __importStar(require("vscode"));
41
+ const ids_1 = require("../ids");
42
+ const editor_path_key_1 = require("../editor-path-key");
43
+ const profiler_webview_1 = require("../profiler-webview");
44
+ const webview_contract_helpers_1 = require("./webview-contract-helpers");
45
+ const cpu_capture_assertions_1 = require("./cpu-capture-assertions");
46
+ /** A panel whose script reports `--prof-critical` back each time the palette is repainted. */
47
+ function paletteProbe() {
48
+ return (0, profiler_webview_1.buildWebviewDocument)({ title: "Palette", css: "", body: "", script: `
49
+ const api = globalThis.profilerVsCodeApi || (globalThis.profilerVsCodeApi = acquireVsCodeApi());
50
+ window.addEventListener('message', event => { if(event.data.type === 'profilerPalette')
51
+ api.postMessage({type:'palette', file:document.documentElement.style.getPropertyValue('--prof-critical')}); });
52
+ api.postMessage({type:'ready', file:'ready'});` });
53
+ }
54
+ async function paletteOverridesRepaintOpenPanels() {
55
+ const config = vscode.workspace.getConfiguration((0, ids_1.configSection)());
56
+ const previous = config.inspect("profiler.palette")?.globalValue;
57
+ let observed = undefined;
58
+ const panel = new profiler_webview_1.SingletonWebviewPanel(() => "profiler.palette.contract", message => { observed = message.file; });
59
+ panel.show("Palette contract", paletteProbe());
60
+ try {
61
+ await repaintPaletteProbe(config, () => observed);
62
+ }
63
+ finally {
64
+ panel.dispose();
65
+ await config.update("profiler.palette", previous, vscode.ConfigurationTarget.Global);
66
+ }
67
+ }
68
+ /** Change the palette and wait for the open panel to repaint with it. */
69
+ async function repaintPaletteProbe(config, observed) {
70
+ await (0, webview_contract_helpers_1.pollUntilResult)(observed, value => value === "ready");
71
+ await config.update("profiler.palette", { critical: "#74824f" }, vscode.ConfigurationTarget.Global);
72
+ await (0, webview_contract_helpers_1.pollUntilResult)(observed, value => value === "#74824f");
73
+ assert.equal(observed(), "#74824f");
74
+ }
75
+ async function fileExists(filePath) {
76
+ try {
77
+ await fs.promises.access(filePath);
78
+ return true;
79
+ }
80
+ catch {
81
+ return false;
82
+ }
83
+ }
84
+ /** The active editor and its path key, read together so a poll sees one consistent pair. */
85
+ async function activeKey() {
86
+ const active = vscode.window.activeTextEditor;
87
+ return { editor: active, key: active === undefined ? undefined : await (0, editor_path_key_1.editorPathKey)(active.document.uri.fsPath) };
88
+ }
89
+ async function hotLinesNavigateToTheirSource(result) {
90
+ const located = await Promise.all(result.hotLines
91
+ .filter(item => item.line > 0)
92
+ .map(async (item) => ({ item, exists: await fileExists(item.file) })));
93
+ const line = located.find(entry => entry.exists)?.item;
94
+ assert.ok(line !== undefined, "capture must attribute a real source line");
95
+ assert.equal((0, profiler_webview_1.handleSourceNavigation)({ type: "navigateToSource", file: line.file, line: line.line }), true);
96
+ // The editor spells a Windows drive in lower case; the runtime reports it as built.
97
+ const expected = await (0, editor_path_key_1.editorPathKey)(line.file);
98
+ const { editor, key } = await (0, webview_contract_helpers_1.pollUntilResult)(activeKey, seen => seen.key === expected && seen.editor?.selection.active.line === line.line - 1);
99
+ assert.equal(key, expected, `the hot line's own file opens: ${line.file}`);
100
+ assert.equal(editor?.selection.active.line, line.line - 1);
101
+ }
102
+ /** How long the one real CPU capture may take on a cold CI runner. */
103
+ const CPU_CAPTURE_TIMEOUT_MS = 120_000;
104
+ /** Register the contract against `capture`, the host's own real runtime capture. */
105
+ function registerCpuCaptureContract(capture, options = {}) {
106
+ suite("Shared profiler VSIX — real runtime capture", () => {
107
+ const captured = { result: undefined };
108
+ suiteSetup(async function captureProfile() { this.timeout(CPU_CAPTURE_TIMEOUT_MS); captured.result = await capture(); });
109
+ suiteTeardown(webview_contract_helpers_1.closeAllEditors);
110
+ test("captures attributed CPU samples and valid native trace artifacts", async () => { await (0, cpu_capture_assertions_1.capturesAttributedSamples)(contractResult(captured)); });
111
+ test("mounts both interactive views, search, fiber selection and trace actions", async () => { await (0, cpu_capture_assertions_1.mountsTheInteractiveViews)(contractResult(captured), options.reviewHtmlPath); });
112
+ test("palette overrides update an already-open webview", paletteOverridesRepaintOpenPanels);
113
+ test("a measured hot line navigates to the actual runtime source", async () => { await hotLinesNavigateToTheirSource(contractResult(captured)); });
114
+ });
115
+ }
116
+ /** The captured result, failing loudly when the suite setup never produced one. */
117
+ function contractResult(captured) {
118
+ if (captured.result === undefined) {
119
+ throw new Error("the capture suite setup did not produce a result");
120
+ }
121
+ return captured.result;
122
+ }
123
+ //# sourceMappingURL=cpu-capture-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cpu-capture-contract.js","sourceRoot":"","sources":["../../../src/testing/cpu-capture-contract.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yFAAyF;AACzF,MAAY,MAAM,+C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,CAAC,sBAAsB,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACzH,aAAa,CAAC,0CAAe,CAAC,CAAC;QAC/B,IAAI,CAAC,kEAAkE,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,IAAA,kDAAyB,EAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrJ,IAAI,CAAC,0EAA0E,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,IAAA,kDAAyB,EAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrL,IAAI,CAAC,kDAAkD,EAAE,iCAAiC,CAAC,CAAC;QAC5F,IAAI,CAAC,4DAA4D,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,6BAA6B,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,mFAAmF;AACnF,SAAS,cAAc,CAAC,QAA+C;IACrE,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAAC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAAC,CAAC;IAC3G,OAAO,QAAQ,CAAC,MAAM,CAAC;AACzB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { ProfileResult } from '../profiler-decorations';
2
+ import type { MemoryDashboardSnapshot } from '../memory-dashboard';
3
+ /** A payload that closes the surrounding <script> if embedding is unescaped. */
4
+ export declare const HOSTILE = "</script><img src=x onerror=alert(1)>";
5
+ export interface PollOptions<Value> {
6
+ readonly fn: () => Promise<Value> | Value;
7
+ readonly until: (value: Value) => boolean;
8
+ readonly timeoutMs: number;
9
+ readonly intervalMs?: number;
10
+ readonly description?: string;
11
+ }
12
+ /** Poll until `until` accepts the value; the two-argument form uses a 10s budget. */
13
+ export declare function pollUntilResult<Value>(options: PollOptions<Value>): Promise<Value>;
14
+ export declare function pollUntilResult<Value>(fn: () => Promise<Value> | Value, until: (value: Value) => boolean): Promise<Value>;
15
+ export declare function closeAllEditors(): Promise<void>;
16
+ export declare function removeTestDir(dir: string): Promise<void>;
17
+ /** A CPU result, overriding the fields a test cares about. */
18
+ export declare function profileResult(overrides?: Partial<ProfileResult>): ProfileResult;
19
+ /** Assert `html` contains every key (or, with `present` false, none), failing with its reason. */
20
+ export declare function assertHtml(html: string, checks: Record<string, string>, present?: boolean): void;
21
+ /** Assert a webview declares a CSP, nonce-gates its script, and kept hostile data inert. */
22
+ export declare function assertHardened(html: string, what: string): void;
23
+ /** A minimal dashboard snapshot (fresh session: one capture, no diff yet). */
24
+ export declare function dashboardSnapshot(overrides?: Partial<MemoryDashboardSnapshot>): MemoryDashboardSnapshot;