@flanksource/clicky-ui 0.3.49 → 0.3.50

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 (384) hide show
  1. package/dist/connections/ConnectionsPage.cjs +219 -0
  2. package/dist/connections/ConnectionsPage.cjs.map +1 -0
  3. package/dist/connections/ConnectionsPage.d.ts +23 -0
  4. package/dist/connections/ConnectionsPage.d.ts.map +1 -0
  5. package/dist/connections/ConnectionsPage.js +219 -0
  6. package/dist/connections/ConnectionsPage.js.map +1 -0
  7. package/dist/connections/connectionActionStatus.cjs +43 -0
  8. package/dist/connections/connectionActionStatus.cjs.map +1 -0
  9. package/dist/connections/connectionActionStatus.d.ts +5 -0
  10. package/dist/connections/connectionActionStatus.d.ts.map +1 -0
  11. package/dist/connections/connectionActionStatus.js +43 -0
  12. package/dist/connections/connectionActionStatus.js.map +1 -0
  13. package/dist/connections/connectionActionTypes.cjs +24 -0
  14. package/dist/connections/connectionActionTypes.cjs.map +1 -0
  15. package/dist/connections/connectionActionTypes.d.ts +36 -0
  16. package/dist/connections/connectionActionTypes.d.ts.map +1 -0
  17. package/dist/connections/connectionActionTypes.js +24 -0
  18. package/dist/connections/connectionActionTypes.js.map +1 -0
  19. package/dist/connections/connectionActions.cjs +11 -0
  20. package/dist/connections/connectionActions.cjs.map +1 -0
  21. package/dist/connections/connectionActions.d.ts +15 -0
  22. package/dist/connections/connectionActions.d.ts.map +1 -0
  23. package/dist/connections/connectionActions.js +11 -0
  24. package/dist/connections/connectionActions.js.map +1 -0
  25. package/dist/connections/connectionDashboard.cjs +185 -0
  26. package/dist/connections/connectionDashboard.cjs.map +1 -0
  27. package/dist/connections/connectionDashboard.d.ts +25 -0
  28. package/dist/connections/connectionDashboard.d.ts.map +1 -0
  29. package/dist/connections/connectionDashboard.js +185 -0
  30. package/dist/connections/connectionDashboard.js.map +1 -0
  31. package/dist/connections/connectionDashboardModel.cjs +43 -0
  32. package/dist/connections/connectionDashboardModel.cjs.map +1 -0
  33. package/dist/connections/connectionDashboardModel.d.ts +75 -0
  34. package/dist/connections/connectionDashboardModel.d.ts.map +1 -0
  35. package/dist/connections/connectionDashboardModel.js +43 -0
  36. package/dist/connections/connectionDashboardModel.js.map +1 -0
  37. package/dist/connections/connectionDashboardRenderer.cjs +21 -0
  38. package/dist/connections/connectionDashboardRenderer.cjs.map +1 -0
  39. package/dist/connections/connectionDashboardRenderer.d.ts +15 -0
  40. package/dist/connections/connectionDashboardRenderer.d.ts.map +1 -0
  41. package/dist/connections/connectionDashboardRenderer.js +21 -0
  42. package/dist/connections/connectionDashboardRenderer.js.map +1 -0
  43. package/dist/connections/connectionDashboardRow.cjs +169 -0
  44. package/dist/connections/connectionDashboardRow.cjs.map +1 -0
  45. package/dist/connections/connectionDashboardRow.d.ts +12 -0
  46. package/dist/connections/connectionDashboardRow.d.ts.map +1 -0
  47. package/dist/connections/connectionDashboardRow.js +169 -0
  48. package/dist/connections/connectionDashboardRow.js.map +1 -0
  49. package/dist/connections/connectionErrorView.cjs +8 -0
  50. package/dist/connections/connectionErrorView.cjs.map +1 -0
  51. package/dist/connections/connectionErrorView.d.ts +4 -0
  52. package/dist/connections/connectionErrorView.d.ts.map +1 -0
  53. package/dist/connections/connectionErrorView.js +8 -0
  54. package/dist/connections/connectionErrorView.js.map +1 -0
  55. package/dist/connections/connectionHealth.cjs +82 -0
  56. package/dist/connections/connectionHealth.cjs.map +1 -0
  57. package/dist/connections/connectionHealth.d.ts +33 -0
  58. package/dist/connections/connectionHealth.d.ts.map +1 -0
  59. package/dist/connections/connectionHealth.js +82 -0
  60. package/dist/connections/connectionHealth.js.map +1 -0
  61. package/dist/connections/connectionLogging.cjs +29 -0
  62. package/dist/connections/connectionLogging.cjs.map +1 -0
  63. package/dist/connections/connectionLogging.d.ts +11 -0
  64. package/dist/connections/connectionLogging.d.ts.map +1 -0
  65. package/dist/connections/connectionLogging.js +29 -0
  66. package/dist/connections/connectionLogging.js.map +1 -0
  67. package/dist/connections/connectionLoggingField.cjs +37 -0
  68. package/dist/connections/connectionLoggingField.cjs.map +1 -0
  69. package/dist/connections/connectionLoggingField.d.ts +12 -0
  70. package/dist/connections/connectionLoggingField.d.ts.map +1 -0
  71. package/dist/connections/connectionLoggingField.js +37 -0
  72. package/dist/connections/connectionLoggingField.js.map +1 -0
  73. package/dist/connections/connectionLoggingModel.cjs +16 -0
  74. package/dist/connections/connectionLoggingModel.cjs.map +1 -0
  75. package/dist/connections/connectionLoggingModel.d.ts +6 -0
  76. package/dist/connections/connectionLoggingModel.d.ts.map +1 -0
  77. package/dist/connections/connectionLoggingModel.js +16 -0
  78. package/dist/connections/connectionLoggingModel.js.map +1 -0
  79. package/dist/connections/connectionResolveView.cjs +24 -0
  80. package/dist/connections/connectionResolveView.cjs.map +1 -0
  81. package/dist/connections/connectionResolveView.d.ts +5 -0
  82. package/dist/connections/connectionResolveView.d.ts.map +1 -0
  83. package/dist/connections/connectionResolveView.js +24 -0
  84. package/dist/connections/connectionResolveView.js.map +1 -0
  85. package/dist/connections/connectionTestButton.cjs +58 -0
  86. package/dist/connections/connectionTestButton.cjs.map +1 -0
  87. package/dist/connections/connectionTestButton.d.ts +6 -0
  88. package/dist/connections/connectionTestButton.d.ts.map +1 -0
  89. package/dist/connections/connectionTestButton.js +58 -0
  90. package/dist/connections/connectionTestButton.js.map +1 -0
  91. package/dist/connections/connectionTestView.cjs +12 -0
  92. package/dist/connections/connectionTestView.cjs.map +1 -0
  93. package/dist/connections/connectionTestView.d.ts +5 -0
  94. package/dist/connections/connectionTestView.d.ts.map +1 -0
  95. package/dist/connections/connectionTestView.js +12 -0
  96. package/dist/connections/connectionTestView.js.map +1 -0
  97. package/dist/connections/connectionsPageModel.cjs +33 -0
  98. package/dist/connections/connectionsPageModel.cjs.map +1 -0
  99. package/dist/connections/connectionsPageModel.d.ts +24 -0
  100. package/dist/connections/connectionsPageModel.d.ts.map +1 -0
  101. package/dist/connections/connectionsPageModel.js +33 -0
  102. package/dist/connections/connectionsPageModel.js.map +1 -0
  103. package/dist/connections/iconProvider.cjs +20 -0
  104. package/dist/connections/iconProvider.cjs.map +1 -0
  105. package/dist/connections/iconProvider.d.ts +7 -0
  106. package/dist/connections/iconProvider.d.ts.map +1 -0
  107. package/dist/connections/iconProvider.js +20 -0
  108. package/dist/connections/iconProvider.js.map +1 -0
  109. package/dist/connections.cjs +45 -0
  110. package/dist/connections.cjs.map +1 -0
  111. package/dist/connections.d.ts +34 -0
  112. package/dist/connections.d.ts.map +1 -0
  113. package/dist/connections.js +45 -0
  114. package/dist/connections.js.map +1 -0
  115. package/dist/data/diagnostics/DiagnosticsDetailPanel.cjs +52 -295
  116. package/dist/data/diagnostics/DiagnosticsDetailPanel.cjs.map +1 -1
  117. package/dist/data/diagnostics/DiagnosticsDetailPanel.d.ts.map +1 -1
  118. package/dist/data/diagnostics/DiagnosticsDetailPanel.js +47 -290
  119. package/dist/data/diagnostics/DiagnosticsDetailPanel.js.map +1 -1
  120. package/dist/data/diagnostics/MetricTile.cjs +44 -0
  121. package/dist/data/diagnostics/MetricTile.cjs.map +1 -0
  122. package/dist/data/diagnostics/MetricTile.d.ts +13 -0
  123. package/dist/data/diagnostics/MetricTile.d.ts.map +1 -0
  124. package/dist/data/diagnostics/MetricTile.js +44 -0
  125. package/dist/data/diagnostics/MetricTile.js.map +1 -0
  126. package/dist/data/diagnostics/StackDumpView.cjs +227 -0
  127. package/dist/data/diagnostics/StackDumpView.cjs.map +1 -0
  128. package/dist/data/diagnostics/StackDumpView.d.ts +53 -0
  129. package/dist/data/diagnostics/StackDumpView.d.ts.map +1 -0
  130. package/dist/data/diagnostics/StackDumpView.js +227 -0
  131. package/dist/data/diagnostics/StackDumpView.js.map +1 -0
  132. package/dist/data/diagnostics/fixtures.d.ts +1 -0
  133. package/dist/data/diagnostics/fixtures.d.ts.map +1 -1
  134. package/dist/data/diagnostics/metric-tone.cjs +18 -0
  135. package/dist/data/diagnostics/metric-tone.cjs.map +1 -0
  136. package/dist/data/diagnostics/metric-tone.d.ts +6 -0
  137. package/dist/data/diagnostics/metric-tone.d.ts.map +1 -0
  138. package/dist/data/diagnostics/metric-tone.js +18 -0
  139. package/dist/data/diagnostics/metric-tone.js.map +1 -0
  140. package/dist/data/diagnostics/stacktrace.cjs +44 -0
  141. package/dist/data/diagnostics/stacktrace.cjs.map +1 -1
  142. package/dist/data/diagnostics/stacktrace.d.ts +7 -0
  143. package/dist/data/diagnostics/stacktrace.d.ts.map +1 -1
  144. package/dist/data/diagnostics/stacktrace.js +44 -0
  145. package/dist/data/diagnostics/stacktrace.js.map +1 -1
  146. package/dist/data/diagnostics/types.d.ts +2 -8
  147. package/dist/data/diagnostics/types.d.ts.map +1 -1
  148. package/dist/data/lint/LintDetail.cjs +339 -0
  149. package/dist/data/lint/LintDetail.cjs.map +1 -0
  150. package/dist/data/lint/LintDetail.d.ts +17 -0
  151. package/dist/data/lint/LintDetail.d.ts.map +1 -0
  152. package/dist/data/lint/LintDetail.js +339 -0
  153. package/dist/data/lint/LintDetail.js.map +1 -0
  154. package/dist/data/lint/LintFilterBar.cjs +103 -0
  155. package/dist/data/lint/LintFilterBar.cjs.map +1 -0
  156. package/dist/data/lint/LintFilterBar.d.ts +16 -0
  157. package/dist/data/lint/LintFilterBar.d.ts.map +1 -0
  158. package/dist/data/lint/LintFilterBar.js +103 -0
  159. package/dist/data/lint/LintFilterBar.js.map +1 -0
  160. package/dist/data/lint/LintResults.cjs +144 -0
  161. package/dist/data/lint/LintResults.cjs.map +1 -0
  162. package/dist/data/lint/LintResults.d.ts +39 -0
  163. package/dist/data/lint/LintResults.d.ts.map +1 -0
  164. package/dist/data/lint/LintResults.fixtures.d.ts +10 -0
  165. package/dist/data/lint/LintResults.fixtures.d.ts.map +1 -0
  166. package/dist/data/lint/LintResults.js +144 -0
  167. package/dist/data/lint/LintResults.js.map +1 -0
  168. package/dist/data/lint/LintTreeNode.cjs +66 -0
  169. package/dist/data/lint/LintTreeNode.cjs.map +1 -0
  170. package/dist/data/lint/LintTreeNode.d.ts +7 -0
  171. package/dist/data/lint/LintTreeNode.d.ts.map +1 -0
  172. package/dist/data/lint/LintTreeNode.js +66 -0
  173. package/dist/data/lint/LintTreeNode.js.map +1 -0
  174. package/dist/data/lint/actions.cjs +195 -0
  175. package/dist/data/lint/actions.cjs.map +1 -0
  176. package/dist/data/lint/actions.d.ts +29 -0
  177. package/dist/data/lint/actions.d.ts.map +1 -0
  178. package/dist/data/lint/actions.js +195 -0
  179. package/dist/data/lint/actions.js.map +1 -0
  180. package/dist/data/lint/grouping-options.cjs +14 -0
  181. package/dist/data/lint/grouping-options.cjs.map +1 -0
  182. package/dist/data/lint/grouping-options.d.ts +9 -0
  183. package/dist/data/lint/grouping-options.d.ts.map +1 -0
  184. package/dist/data/lint/grouping-options.js +14 -0
  185. package/dist/data/lint/grouping-options.js.map +1 -0
  186. package/dist/data/lint/grouping.cjs +450 -0
  187. package/dist/data/lint/grouping.cjs.map +1 -0
  188. package/dist/data/lint/grouping.d.ts +10 -0
  189. package/dist/data/lint/grouping.d.ts.map +1 -0
  190. package/dist/data/lint/grouping.js +450 -0
  191. package/dist/data/lint/grouping.js.map +1 -0
  192. package/dist/data/lint/index.d.ts +10 -0
  193. package/dist/data/lint/index.d.ts.map +1 -0
  194. package/dist/data/lint/paths.cjs +35 -0
  195. package/dist/data/lint/paths.cjs.map +1 -0
  196. package/dist/data/lint/paths.d.ts +13 -0
  197. package/dist/data/lint/paths.d.ts.map +1 -0
  198. package/dist/data/lint/paths.js +35 -0
  199. package/dist/data/lint/paths.js.map +1 -0
  200. package/dist/data/lint/stats.cjs +76 -0
  201. package/dist/data/lint/stats.cjs.map +1 -0
  202. package/dist/data/lint/stats.d.ts +19 -0
  203. package/dist/data/lint/stats.d.ts.map +1 -0
  204. package/dist/data/lint/stats.js +76 -0
  205. package/dist/data/lint/stats.js.map +1 -0
  206. package/dist/data/lint/types.cjs +16 -0
  207. package/dist/data/lint/types.cjs.map +1 -0
  208. package/dist/data/lint/types.d.ts +93 -0
  209. package/dist/data/lint/types.d.ts.map +1 -0
  210. package/dist/data/lint/types.js +16 -0
  211. package/dist/data/lint/types.js.map +1 -0
  212. package/dist/data/test-runner/TestAttemptDetail.cjs +113 -0
  213. package/dist/data/test-runner/TestAttemptDetail.cjs.map +1 -0
  214. package/dist/data/test-runner/TestAttemptDetail.d.ts +19 -0
  215. package/dist/data/test-runner/TestAttemptDetail.d.ts.map +1 -0
  216. package/dist/data/test-runner/TestAttemptDetail.js +113 -0
  217. package/dist/data/test-runner/TestAttemptDetail.js.map +1 -0
  218. package/dist/data/test-runner/TestAttempts.cjs +36 -0
  219. package/dist/data/test-runner/TestAttempts.cjs.map +1 -0
  220. package/dist/data/test-runner/TestAttempts.d.ts +5 -0
  221. package/dist/data/test-runner/TestAttempts.d.ts.map +1 -0
  222. package/dist/data/test-runner/TestAttempts.js +36 -0
  223. package/dist/data/test-runner/TestAttempts.js.map +1 -0
  224. package/dist/data/test-runner/TestDetailPanel.cjs +13 -3
  225. package/dist/data/test-runner/TestDetailPanel.cjs.map +1 -1
  226. package/dist/data/test-runner/TestDetailPanel.d.ts.map +1 -1
  227. package/dist/data/test-runner/TestDetailPanel.js +14 -4
  228. package/dist/data/test-runner/TestDetailPanel.js.map +1 -1
  229. package/dist/data/test-runner/TestFailureDetail.cjs +9 -29
  230. package/dist/data/test-runner/TestFailureDetail.cjs.map +1 -1
  231. package/dist/data/test-runner/TestFailureDetail.d.ts +6 -6
  232. package/dist/data/test-runner/TestFailureDetail.d.ts.map +1 -1
  233. package/dist/data/test-runner/TestFailureDetail.js +9 -29
  234. package/dist/data/test-runner/TestFailureDetail.js.map +1 -1
  235. package/dist/data/test-runner/TestRunSummary.cjs +33 -0
  236. package/dist/data/test-runner/TestRunSummary.cjs.map +1 -1
  237. package/dist/data/test-runner/TestRunSummary.d.ts.map +1 -1
  238. package/dist/data/test-runner/TestRunSummary.js +34 -1
  239. package/dist/data/test-runner/TestRunSummary.js.map +1 -1
  240. package/dist/data/test-runner/TestRunner.cjs +3 -0
  241. package/dist/data/test-runner/TestRunner.cjs.map +1 -1
  242. package/dist/data/test-runner/TestRunner.d.ts +8 -1
  243. package/dist/data/test-runner/TestRunner.d.ts.map +1 -1
  244. package/dist/data/test-runner/TestRunner.js +3 -0
  245. package/dist/data/test-runner/TestRunner.js.map +1 -1
  246. package/dist/data/test-runner/TestTreeNode.cjs +3 -1
  247. package/dist/data/test-runner/TestTreeNode.cjs.map +1 -1
  248. package/dist/data/test-runner/TestTreeNode.d.ts.map +1 -1
  249. package/dist/data/test-runner/TestTreeNode.js +3 -1
  250. package/dist/data/test-runner/TestTreeNode.js.map +1 -1
  251. package/dist/data/test-runner/adapter.cjs +9 -1
  252. package/dist/data/test-runner/adapter.cjs.map +1 -1
  253. package/dist/data/test-runner/adapter.d.ts +5 -0
  254. package/dist/data/test-runner/adapter.d.ts.map +1 -1
  255. package/dist/data/test-runner/adapter.js +9 -1
  256. package/dist/data/test-runner/adapter.js.map +1 -1
  257. package/dist/data/test-runner/attempts.cjs +62 -0
  258. package/dist/data/test-runner/attempts.cjs.map +1 -0
  259. package/dist/data/test-runner/attempts.d.ts +13 -0
  260. package/dist/data/test-runner/attempts.d.ts.map +1 -0
  261. package/dist/data/test-runner/attempts.js +62 -0
  262. package/dist/data/test-runner/attempts.js.map +1 -0
  263. package/dist/data/test-runner/context.cjs.map +1 -1
  264. package/dist/data/test-runner/context.d.ts +6 -0
  265. package/dist/data/test-runner/context.d.ts.map +1 -1
  266. package/dist/data/test-runner/context.js.map +1 -1
  267. package/dist/data/test-runner/index.d.ts +5 -1
  268. package/dist/data/test-runner/index.d.ts.map +1 -1
  269. package/dist/data/test-runner/marks.cjs +2 -0
  270. package/dist/data/test-runner/marks.cjs.map +1 -1
  271. package/dist/data/test-runner/marks.d.ts.map +1 -1
  272. package/dist/data/test-runner/marks.js +2 -0
  273. package/dist/data/test-runner/marks.js.map +1 -1
  274. package/dist/data/test-runner/process-metrics.cjs +15 -0
  275. package/dist/data/test-runner/process-metrics.cjs.map +1 -0
  276. package/dist/data/test-runner/process-metrics.d.ts +22 -0
  277. package/dist/data/test-runner/process-metrics.d.ts.map +1 -0
  278. package/dist/data/test-runner/process-metrics.js +15 -0
  279. package/dist/data/test-runner/process-metrics.js.map +1 -0
  280. package/dist/data/test-runner/status.cjs +11 -3
  281. package/dist/data/test-runner/status.cjs.map +1 -1
  282. package/dist/data/test-runner/status.d.ts +3 -1
  283. package/dist/data/test-runner/status.d.ts.map +1 -1
  284. package/dist/data/test-runner/status.js +11 -3
  285. package/dist/data/test-runner/status.js.map +1 -1
  286. package/dist/data/test-runner/types.d.ts +14 -0
  287. package/dist/data/test-runner/types.d.ts.map +1 -1
  288. package/dist/data/traces/GoProfileView.cjs +176 -0
  289. package/dist/data/traces/GoProfileView.cjs.map +1 -0
  290. package/dist/data/traces/GoProfileView.d.ts +30 -0
  291. package/dist/data/traces/GoProfileView.d.ts.map +1 -0
  292. package/dist/data/traces/GoProfileView.js +176 -0
  293. package/dist/data/traces/GoProfileView.js.map +1 -0
  294. package/dist/data/traces/ProcessFacetTable.cjs +79 -0
  295. package/dist/data/traces/ProcessFacetTable.cjs.map +1 -0
  296. package/dist/data/traces/ProcessFacetTable.d.ts +21 -0
  297. package/dist/data/traces/ProcessFacetTable.d.ts.map +1 -0
  298. package/dist/data/traces/ProcessFacetTable.js +79 -0
  299. package/dist/data/traces/ProcessFacetTable.js.map +1 -0
  300. package/dist/data/traces/ProcessRecordViews.cjs +41 -0
  301. package/dist/data/traces/ProcessRecordViews.cjs.map +1 -0
  302. package/dist/data/traces/ProcessRecordViews.d.ts +16 -0
  303. package/dist/data/traces/ProcessRecordViews.d.ts.map +1 -0
  304. package/dist/data/traces/ProcessRecordViews.js +41 -0
  305. package/dist/data/traces/ProcessRecordViews.js.map +1 -0
  306. package/dist/data/traces/ProcessTraceDetail.cjs +316 -0
  307. package/dist/data/traces/ProcessTraceDetail.cjs.map +1 -0
  308. package/dist/data/traces/ProcessTraceDetail.d.ts +39 -0
  309. package/dist/data/traces/ProcessTraceDetail.d.ts.map +1 -0
  310. package/dist/data/traces/ProcessTraceDetail.js +316 -0
  311. package/dist/data/traces/ProcessTraceDetail.js.map +1 -0
  312. package/dist/data/traces/ProcessTraceTree.cjs +76 -34
  313. package/dist/data/traces/ProcessTraceTree.cjs.map +1 -1
  314. package/dist/data/traces/ProcessTraceTree.d.ts +21 -4
  315. package/dist/data/traces/ProcessTraceTree.d.ts.map +1 -1
  316. package/dist/data/traces/ProcessTraceTree.js +72 -30
  317. package/dist/data/traces/ProcessTraceTree.js.map +1 -1
  318. package/dist/data/traces/Sparkline.cjs +27 -5
  319. package/dist/data/traces/Sparkline.cjs.map +1 -1
  320. package/dist/data/traces/Sparkline.d.ts +17 -1
  321. package/dist/data/traces/Sparkline.d.ts.map +1 -1
  322. package/dist/data/traces/Sparkline.js +28 -6
  323. package/dist/data/traces/Sparkline.js.map +1 -1
  324. package/dist/data/traces/TraceView.cjs +9 -0
  325. package/dist/data/traces/TraceView.cjs.map +1 -1
  326. package/dist/data/traces/TraceView.d.ts +4 -2
  327. package/dist/data/traces/TraceView.d.ts.map +1 -1
  328. package/dist/data/traces/TraceView.js +9 -0
  329. package/dist/data/traces/TraceView.js.map +1 -1
  330. package/dist/data/traces/TraceWindowList.cjs +117 -0
  331. package/dist/data/traces/TraceWindowList.cjs.map +1 -0
  332. package/dist/data/traces/TraceWindowList.d.ts +48 -0
  333. package/dist/data/traces/TraceWindowList.d.ts.map +1 -0
  334. package/dist/data/traces/TraceWindowList.js +117 -0
  335. package/dist/data/traces/TraceWindowList.js.map +1 -0
  336. package/dist/data/traces/fixtures.d.ts +25 -1
  337. package/dist/data/traces/fixtures.d.ts.map +1 -1
  338. package/dist/data/traces/index.d.ts +10 -3
  339. package/dist/data/traces/index.d.ts.map +1 -1
  340. package/dist/data/traces/process-facets.cjs +48 -0
  341. package/dist/data/traces/process-facets.cjs.map +1 -0
  342. package/dist/data/traces/process-facets.d.ts +38 -0
  343. package/dist/data/traces/process-facets.d.ts.map +1 -0
  344. package/dist/data/traces/process-facets.js +48 -0
  345. package/dist/data/traces/process-facets.js.map +1 -0
  346. package/dist/data/traces/process-tree.cjs +36 -4
  347. package/dist/data/traces/process-tree.cjs.map +1 -1
  348. package/dist/data/traces/process-tree.d.ts +20 -1
  349. package/dist/data/traces/process-tree.d.ts.map +1 -1
  350. package/dist/data/traces/process-tree.js +36 -4
  351. package/dist/data/traces/process-tree.js.map +1 -1
  352. package/dist/data/traces/profile-aggregate.cjs +78 -0
  353. package/dist/data/traces/profile-aggregate.cjs.map +1 -0
  354. package/dist/data/traces/profile-aggregate.d.ts +41 -0
  355. package/dist/data/traces/profile-aggregate.d.ts.map +1 -0
  356. package/dist/data/traces/profile-aggregate.js +78 -0
  357. package/dist/data/traces/profile-aggregate.js.map +1 -0
  358. package/dist/data/traces/stack-checkpoints.cjs +22 -0
  359. package/dist/data/traces/stack-checkpoints.cjs.map +1 -0
  360. package/dist/data/traces/stack-checkpoints.d.ts +18 -0
  361. package/dist/data/traces/stack-checkpoints.d.ts.map +1 -0
  362. package/dist/data/traces/stack-checkpoints.js +22 -0
  363. package/dist/data/traces/stack-checkpoints.js.map +1 -0
  364. package/dist/data/traces/types.d.ts +120 -5
  365. package/dist/data/traces/types.d.ts.map +1 -1
  366. package/dist/data/verification/adapters.cjs +1 -0
  367. package/dist/data/verification/adapters.cjs.map +1 -1
  368. package/dist/data/verification/adapters.d.ts.map +1 -1
  369. package/dist/data/verification/adapters.js +1 -0
  370. package/dist/data/verification/adapters.js.map +1 -1
  371. package/dist/data/version-info.cjs +3 -3
  372. package/dist/data/version-info.js +3 -3
  373. package/dist/data.cjs +85 -7
  374. package/dist/data.cjs.map +1 -1
  375. package/dist/data.d.ts +4 -0
  376. package/dist/data.d.ts.map +1 -1
  377. package/dist/data.js +81 -3
  378. package/dist/data.js.map +1 -1
  379. package/dist/index.cjs +87 -9
  380. package/dist/index.cjs.map +1 -1
  381. package/dist/index.js +81 -3
  382. package/dist/index.js.map +1 -1
  383. package/dist/styles.css +1 -1
  384. package/package.json +6 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/traces/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,QAAQ,GACT,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/traces/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;A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ACf,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC3G,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,QAAQ,GACT,MAAM,SAAS,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const SAMPLE_FACETS = {
4
+ openFiles: { label: "Open files", countKey: "openFiles", listKey: "openFileList", empty: "No open files" },
5
+ sockets: { label: "Sockets", countKey: "sockets", listKey: "socketList", empty: "No open sockets" },
6
+ ports: { label: "Ports", countKey: "ports", listKey: "portList", empty: "Not listening on any port" },
7
+ connections: {
8
+ label: "Connections",
9
+ countKey: "connections",
10
+ listKey: "connectionList",
11
+ empty: "No network connections"
12
+ }
13
+ };
14
+ const SAMPLE_FACET_ORDER = ["openFiles", "sockets", "ports", "connections"];
15
+ const inTickOrder = (samples, key) => samples.filter((sample) => sample.key === key).sort((a, b) => a.tick - b.tick);
16
+ function armedFacets(samples) {
17
+ return SAMPLE_FACET_ORDER.filter((facet) => samples.some((sample) => sample[SAMPLE_FACETS[facet].countKey] !== void 0));
18
+ }
19
+ function facetCountSeries(samples, key, facet) {
20
+ const { countKey } = SAMPLE_FACETS[facet];
21
+ return inTickOrder(samples, key).flatMap((sample) => sample[countKey] === void 0 ? [] : [sample[countKey]]);
22
+ }
23
+ function latestFacetReading(samples, key, facet) {
24
+ const { countKey, listKey } = SAMPLE_FACETS[facet];
25
+ let reading;
26
+ for (const sample of inTickOrder(samples, key)) {
27
+ const list = sample[listKey];
28
+ if (list) reading = { rows: list, readAt: sample.sampledAt };
29
+ else if (sample[countKey] === 0 && (!reading || reading.rows.length > 0)) {
30
+ reading = { rows: [], readAt: sample.sampledAt };
31
+ }
32
+ }
33
+ return reading;
34
+ }
35
+ function diskSeries(samples, key) {
36
+ const own = inTickOrder(samples, key);
37
+ return {
38
+ read: own.flatMap((sample) => sample.diskReadBytes === void 0 ? [] : [sample.diskReadBytes]),
39
+ write: own.flatMap((sample) => sample.diskWriteBytes === void 0 ? [] : [sample.diskWriteBytes])
40
+ };
41
+ }
42
+ exports.SAMPLE_FACETS = SAMPLE_FACETS;
43
+ exports.SAMPLE_FACET_ORDER = SAMPLE_FACET_ORDER;
44
+ exports.armedFacets = armedFacets;
45
+ exports.diskSeries = diskSeries;
46
+ exports.facetCountSeries = facetCountSeries;
47
+ exports.latestFacetReading = latestFacetReading;
48
+ //# sourceMappingURL=process-facets.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-facets.cjs","sources":["../../../src/data/traces/process-facets.ts"],"sourcesContent":["import type { ProcessDescriptor, ProcessSampleFacet, ProcessSampleRow } from \"./types\";\n\ntype FacetSpec = {\n label: string;\n countKey: \"openFiles\" | \"sockets\" | \"ports\" | \"connections\";\n listKey: \"openFileList\" | \"socketList\" | \"portList\" | \"connectionList\";\n empty: string;\n};\n\n/** The facets of `process_samples` in tab order, with the record fields that carry each one. */\nexport const SAMPLE_FACETS: Record<ProcessSampleFacet, FacetSpec> = {\n openFiles: { label: \"Open files\", countKey: \"openFiles\", listKey: \"openFileList\", empty: \"No open files\" },\n sockets: { label: \"Sockets\", countKey: \"sockets\", listKey: \"socketList\", empty: \"No open sockets\" },\n ports: { label: \"Ports\", countKey: \"ports\", listKey: \"portList\", empty: \"Not listening on any port\" },\n connections: {\n label: \"Connections\",\n countKey: \"connections\",\n listKey: \"connectionList\",\n empty: \"No network connections\",\n },\n};\n\nexport const SAMPLE_FACET_ORDER: ProcessSampleFacet[] = [\"openFiles\", \"sockets\", \"ports\", \"connections\"];\n\nconst inTickOrder = (samples: ProcessSampleRow[], key: string) =>\n samples.filter((sample) => sample.key === key).sort((a, b) => a.tick - b.tick);\n\n/**\n * The facets the session armed: those whose count some sample carries. A sample\n * carries a facet's count on every tick once it is armed and never otherwise, so\n * this is a property of the session, not of one process.\n */\nexport function armedFacets(samples: ProcessSampleRow[]): ProcessSampleFacet[] {\n return SAMPLE_FACET_ORDER.filter((facet) => samples.some((sample) => sample[SAMPLE_FACETS[facet].countKey] !== undefined));\n}\n\n/** One process's count of a facet over its samples, in tick order. */\nexport function facetCountSeries(samples: ProcessSampleRow[], key: string, facet: ProcessSampleFacet): number[] {\n const { countKey } = SAMPLE_FACETS[facet];\n return inTickOrder(samples, key).flatMap((sample) => (sample[countKey] === undefined ? [] : [sample[countKey]]));\n}\n\nexport type FacetReading = {\n rows: ProcessDescriptor[];\n /** When this list was stored: the first tick it held, not the last tick it was still true. */\n readAt: string;\n};\n\n/**\n * The latest stored list of a facet for one process. Lists are stored only when\n * they change, so this is the list on the latest sample that carries one. An\n * empty list is never stored, so a sample whose count is 0 with no list ends a\n * non-empty reading with an empty one. Undefined when nothing was stored and no\n * count says the list is empty.\n */\nexport function latestFacetReading(\n samples: ProcessSampleRow[],\n key: string,\n facet: ProcessSampleFacet,\n): FacetReading | undefined {\n const { countKey, listKey } = SAMPLE_FACETS[facet];\n let reading: FacetReading | undefined;\n for (const sample of inTickOrder(samples, key)) {\n const list = sample[listKey];\n if (list) reading = { rows: list, readAt: sample.sampledAt };\n else if (sample[countKey] === 0 && (!reading || reading.rows.length > 0)) {\n reading = { rows: [], readAt: sample.sampledAt };\n }\n }\n return reading;\n}\n\n/** One process's cumulative disk read and write bytes over the samples that carry them, in tick order. */\nexport function diskSeries(samples: ProcessSampleRow[], key: string): { read: number[]; write: number[] } {\n const own = inTickOrder(samples, key);\n return {\n read: own.flatMap((sample) => (sample.diskReadBytes === undefined ? [] : [sample.diskReadBytes])),\n write: own.flatMap((sample) => (sample.diskWriteBytes === undefined ? [] : [sample.diskWriteBytes])),\n };\n}\n"],"names":[],"mappings":";;AAUO,MAAM,gBAAuD;AAAA,EAClE,WAAW,EAAE,OAAO,cAAc,UAAU,aAAa,SAAS,gBAAgB,OAAO,gBAAA;AAAA,EACzF,SAAS,EAAE,OAAO,WAAW,UAAU,WAAW,SAAS,cAAc,OAAO,kBAAA;AAAA,EAChF,OAAO,EAAE,OAAO,SAAS,UAAU,SAAS,SAAS,YAAY,OAAO,4BAAA;AAAA,EACxE,aAAa;AAAA,IACX,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EAAA;AAEX;AAEO,MAAM,qBAA2C,CAAC,aAAa,WAAW,SAAS,aAAa;AAEvG,MAAM,cAAc,CAAC,SAA6B,QAChD,QAAQ,OAAO,CAAC,WAAW,OAAO,QAAQ,GAAG,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI;AAOxE,SAAS,YAAY,SAAmD;AAC7E,SAAO,mBAAmB,OAAO,CAAC,UAAU,QAAQ,KAAK,CAAC,WAAW,OAAO,cAAc,KAAK,EAAE,QAAQ,MAAM,MAAS,CAAC;AAC3H;AAGO,SAAS,iBAAiB,SAA6B,KAAa,OAAqC;AAC9G,QAAM,EAAE,SAAA,IAAa,cAAc,KAAK;AACxC,SAAO,YAAY,SAAS,GAAG,EAAE,QAAQ,CAAC,WAAY,OAAO,QAAQ,MAAM,SAAY,CAAA,IAAK,CAAC,OAAO,QAAQ,CAAC,CAAE;AACjH;AAeO,SAAS,mBACd,SACA,KACA,OAC0B;AAC1B,QAAM,EAAE,UAAU,YAAY,cAAc,KAAK;AACjD,MAAI;AACJ,aAAW,UAAU,YAAY,SAAS,GAAG,GAAG;AAC9C,UAAM,OAAO,OAAO,OAAO;AAC3B,QAAI,KAAM,WAAU,EAAE,MAAM,MAAM,QAAQ,OAAO,UAAA;AAAA,aACxC,OAAO,QAAQ,MAAM,MAAM,CAAC,WAAW,QAAQ,KAAK,SAAS,IAAI;AACxE,gBAAU,EAAE,MAAM,CAAA,GAAI,QAAQ,OAAO,UAAA;AAAA,IACvC;AAAA,EACF;AACA,SAAO;AACT;AAGO,SAAS,WAAW,SAA6B,KAAkD;AACxG,QAAM,MAAM,YAAY,SAAS,GAAG;AACpC,SAAO;AAAA,IACL,MAAM,IAAI,QAAQ,CAAC,WAAY,OAAO,kBAAkB,SAAY,CAAA,IAAK,CAAC,OAAO,aAAa,CAAE;AAAA,IAChG,OAAO,IAAI,QAAQ,CAAC,WAAY,OAAO,mBAAmB,SAAY,CAAA,IAAK,CAAC,OAAO,cAAc,CAAE;AAAA,EAAA;AAEvG;;;;;;;"}
@@ -0,0 +1,38 @@
1
+ import { ProcessDescriptor, ProcessSampleFacet, ProcessSampleRow } from './types.js';
2
+ type FacetSpec = {
3
+ label: string;
4
+ countKey: "openFiles" | "sockets" | "ports" | "connections";
5
+ listKey: "openFileList" | "socketList" | "portList" | "connectionList";
6
+ empty: string;
7
+ };
8
+ /** The facets of `process_samples` in tab order, with the record fields that carry each one. */
9
+ export declare const SAMPLE_FACETS: Record<ProcessSampleFacet, FacetSpec>;
10
+ export declare const SAMPLE_FACET_ORDER: ProcessSampleFacet[];
11
+ /**
12
+ * The facets the session armed: those whose count some sample carries. A sample
13
+ * carries a facet's count on every tick once it is armed and never otherwise, so
14
+ * this is a property of the session, not of one process.
15
+ */
16
+ export declare function armedFacets(samples: ProcessSampleRow[]): ProcessSampleFacet[];
17
+ /** One process's count of a facet over its samples, in tick order. */
18
+ export declare function facetCountSeries(samples: ProcessSampleRow[], key: string, facet: ProcessSampleFacet): number[];
19
+ export type FacetReading = {
20
+ rows: ProcessDescriptor[];
21
+ /** When this list was stored: the first tick it held, not the last tick it was still true. */
22
+ readAt: string;
23
+ };
24
+ /**
25
+ * The latest stored list of a facet for one process. Lists are stored only when
26
+ * they change, so this is the list on the latest sample that carries one. An
27
+ * empty list is never stored, so a sample whose count is 0 with no list ends a
28
+ * non-empty reading with an empty one. Undefined when nothing was stored and no
29
+ * count says the list is empty.
30
+ */
31
+ export declare function latestFacetReading(samples: ProcessSampleRow[], key: string, facet: ProcessSampleFacet): FacetReading | undefined;
32
+ /** One process's cumulative disk read and write bytes over the samples that carry them, in tick order. */
33
+ export declare function diskSeries(samples: ProcessSampleRow[], key: string): {
34
+ read: number[];
35
+ write: number[];
36
+ };
37
+ export {};
38
+ //# sourceMappingURL=process-facets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-facets.d.ts","sourceRoot":"","sources":["../../../src/data/traces/process-facets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEvF,KAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;IAC5D,OAAO,EAAE,cAAc,GAAG,YAAY,GAAG,UAAU,GAAG,gBAAgB,CAAC;IACvE,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,kBAAkB,EAAE,SAAS,CAU/D,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,kBAAkB,EAAqD,CAAC;AAKzG;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,EAAE,CAE7E;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAG9G;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAC1B,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,gBAAgB,EAAE,EAC3B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,kBAAkB,GACxB,YAAY,GAAG,SAAS,CAW1B;AAED,0GAA0G;AAC1G,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAMxG"}
@@ -0,0 +1,48 @@
1
+ const SAMPLE_FACETS = {
2
+ openFiles: { label: "Open files", countKey: "openFiles", listKey: "openFileList", empty: "No open files" },
3
+ sockets: { label: "Sockets", countKey: "sockets", listKey: "socketList", empty: "No open sockets" },
4
+ ports: { label: "Ports", countKey: "ports", listKey: "portList", empty: "Not listening on any port" },
5
+ connections: {
6
+ label: "Connections",
7
+ countKey: "connections",
8
+ listKey: "connectionList",
9
+ empty: "No network connections"
10
+ }
11
+ };
12
+ const SAMPLE_FACET_ORDER = ["openFiles", "sockets", "ports", "connections"];
13
+ const inTickOrder = (samples, key) => samples.filter((sample) => sample.key === key).sort((a, b) => a.tick - b.tick);
14
+ function armedFacets(samples) {
15
+ return SAMPLE_FACET_ORDER.filter((facet) => samples.some((sample) => sample[SAMPLE_FACETS[facet].countKey] !== void 0));
16
+ }
17
+ function facetCountSeries(samples, key, facet) {
18
+ const { countKey } = SAMPLE_FACETS[facet];
19
+ return inTickOrder(samples, key).flatMap((sample) => sample[countKey] === void 0 ? [] : [sample[countKey]]);
20
+ }
21
+ function latestFacetReading(samples, key, facet) {
22
+ const { countKey, listKey } = SAMPLE_FACETS[facet];
23
+ let reading;
24
+ for (const sample of inTickOrder(samples, key)) {
25
+ const list = sample[listKey];
26
+ if (list) reading = { rows: list, readAt: sample.sampledAt };
27
+ else if (sample[countKey] === 0 && (!reading || reading.rows.length > 0)) {
28
+ reading = { rows: [], readAt: sample.sampledAt };
29
+ }
30
+ }
31
+ return reading;
32
+ }
33
+ function diskSeries(samples, key) {
34
+ const own = inTickOrder(samples, key);
35
+ return {
36
+ read: own.flatMap((sample) => sample.diskReadBytes === void 0 ? [] : [sample.diskReadBytes]),
37
+ write: own.flatMap((sample) => sample.diskWriteBytes === void 0 ? [] : [sample.diskWriteBytes])
38
+ };
39
+ }
40
+ export {
41
+ SAMPLE_FACETS,
42
+ SAMPLE_FACET_ORDER,
43
+ armedFacets,
44
+ diskSeries,
45
+ facetCountSeries,
46
+ latestFacetReading
47
+ };
48
+ //# sourceMappingURL=process-facets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-facets.js","sources":["../../../src/data/traces/process-facets.ts"],"sourcesContent":["import type { ProcessDescriptor, ProcessSampleFacet, ProcessSampleRow } from \"./types\";\n\ntype FacetSpec = {\n label: string;\n countKey: \"openFiles\" | \"sockets\" | \"ports\" | \"connections\";\n listKey: \"openFileList\" | \"socketList\" | \"portList\" | \"connectionList\";\n empty: string;\n};\n\n/** The facets of `process_samples` in tab order, with the record fields that carry each one. */\nexport const SAMPLE_FACETS: Record<ProcessSampleFacet, FacetSpec> = {\n openFiles: { label: \"Open files\", countKey: \"openFiles\", listKey: \"openFileList\", empty: \"No open files\" },\n sockets: { label: \"Sockets\", countKey: \"sockets\", listKey: \"socketList\", empty: \"No open sockets\" },\n ports: { label: \"Ports\", countKey: \"ports\", listKey: \"portList\", empty: \"Not listening on any port\" },\n connections: {\n label: \"Connections\",\n countKey: \"connections\",\n listKey: \"connectionList\",\n empty: \"No network connections\",\n },\n};\n\nexport const SAMPLE_FACET_ORDER: ProcessSampleFacet[] = [\"openFiles\", \"sockets\", \"ports\", \"connections\"];\n\nconst inTickOrder = (samples: ProcessSampleRow[], key: string) =>\n samples.filter((sample) => sample.key === key).sort((a, b) => a.tick - b.tick);\n\n/**\n * The facets the session armed: those whose count some sample carries. A sample\n * carries a facet's count on every tick once it is armed and never otherwise, so\n * this is a property of the session, not of one process.\n */\nexport function armedFacets(samples: ProcessSampleRow[]): ProcessSampleFacet[] {\n return SAMPLE_FACET_ORDER.filter((facet) => samples.some((sample) => sample[SAMPLE_FACETS[facet].countKey] !== undefined));\n}\n\n/** One process's count of a facet over its samples, in tick order. */\nexport function facetCountSeries(samples: ProcessSampleRow[], key: string, facet: ProcessSampleFacet): number[] {\n const { countKey } = SAMPLE_FACETS[facet];\n return inTickOrder(samples, key).flatMap((sample) => (sample[countKey] === undefined ? [] : [sample[countKey]]));\n}\n\nexport type FacetReading = {\n rows: ProcessDescriptor[];\n /** When this list was stored: the first tick it held, not the last tick it was still true. */\n readAt: string;\n};\n\n/**\n * The latest stored list of a facet for one process. Lists are stored only when\n * they change, so this is the list on the latest sample that carries one. An\n * empty list is never stored, so a sample whose count is 0 with no list ends a\n * non-empty reading with an empty one. Undefined when nothing was stored and no\n * count says the list is empty.\n */\nexport function latestFacetReading(\n samples: ProcessSampleRow[],\n key: string,\n facet: ProcessSampleFacet,\n): FacetReading | undefined {\n const { countKey, listKey } = SAMPLE_FACETS[facet];\n let reading: FacetReading | undefined;\n for (const sample of inTickOrder(samples, key)) {\n const list = sample[listKey];\n if (list) reading = { rows: list, readAt: sample.sampledAt };\n else if (sample[countKey] === 0 && (!reading || reading.rows.length > 0)) {\n reading = { rows: [], readAt: sample.sampledAt };\n }\n }\n return reading;\n}\n\n/** One process's cumulative disk read and write bytes over the samples that carry them, in tick order. */\nexport function diskSeries(samples: ProcessSampleRow[], key: string): { read: number[]; write: number[] } {\n const own = inTickOrder(samples, key);\n return {\n read: own.flatMap((sample) => (sample.diskReadBytes === undefined ? [] : [sample.diskReadBytes])),\n write: own.flatMap((sample) => (sample.diskWriteBytes === undefined ? [] : [sample.diskWriteBytes])),\n };\n}\n"],"names":[],"mappings":"AAUO,MAAM,gBAAuD;AAAA,EAClE,WAAW,EAAE,OAAO,cAAc,UAAU,aAAa,SAAS,gBAAgB,OAAO,gBAAA;AA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QAAM,MAAM,YAAY,SAAS,GAAG;AACpC,SAAO;AAAA,IACL,MAAM,IAAI,QAAQ,CAAC,WAAY,OAAO,kBAAkB,SAAY,CAAA,IAAK,CAAC,OAAO,aAAa,CAAE;AAAA,IAChG,OAAO,IAAI,QAAQ,CAAC,WAAY,OAAO,mBAAmB,SAAY,CAAA,IAAK,CAAC,OAAO,cAAc,CAAE;AAAA,EAAA;AAEvG;"}
@@ -5,7 +5,7 @@ function buildProcessForest(rows) {
5
5
  const nodes = /* @__PURE__ */ new Map();
6
6
  for (const row of rows) {
7
7
  if (nodes.has(row.key)) throw new Error(`process tree key "${row.key}" appears twice`);
8
- nodes.set(row.key, { row, children: [], exited: row.status === "exited" || Boolean(row.exitedAt) });
8
+ nodes.set(row.key, { row, children: [], exited: isProcessExited(row) });
9
9
  }
10
10
  const roots = [];
11
11
  for (const node of nodes.values()) {
@@ -21,6 +21,24 @@ function buildProcessForest(rows) {
21
21
  for (const node of nodes.values()) node.children.sort(byStart);
22
22
  return roots;
23
23
  }
24
+ function pruneExitedProcesses(roots) {
25
+ return roots.flatMap((node) => {
26
+ const children = pruneExitedProcesses(node.children);
27
+ return node.exited && children.length === 0 ? [] : [{ ...node, children }];
28
+ });
29
+ }
30
+ function processLifetimeMs(row) {
31
+ return Date.parse(row.exitedAt ?? row.lastSeenAt) - Date.parse(row.startedAt);
32
+ }
33
+ function formatProcessTimestamp(iso) {
34
+ const date = new Date(iso);
35
+ if (Number.isNaN(date.getTime())) return iso;
36
+ const pad = (n) => String(n).padStart(2, "0");
37
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
38
+ }
39
+ function isProcessExited(row) {
40
+ return row.status === "exited" || Boolean(row.exitedAt);
41
+ }
24
42
  function flattenForest(roots) {
25
43
  const flat = [];
26
44
  const visit = (node) => {
@@ -30,12 +48,20 @@ function flattenForest(roots) {
30
48
  roots.forEach(visit);
31
49
  return flat;
32
50
  }
51
+ function formatCpuPercent(value) {
52
+ return value == null ? "—" : `${value.toFixed(1)}%`;
53
+ }
54
+ function knownCpu(samples) {
55
+ return samples.flatMap((sample) => sample.cpuPercent == null ? [] : [sample.cpuPercent]);
56
+ }
33
57
  function cpuSeriesByKey(samples) {
34
58
  const byKey = /* @__PURE__ */ new Map();
35
59
  for (const sample of samples) byKey.set(sample.key, [...byKey.get(sample.key) ?? [], sample]);
36
- return new Map(
37
- [...byKey].map(([key, list]) => [key, list.sort((a, b) => a.tick - b.tick).map((sample) => sample.cpuPercent)])
38
- );
60
+ return new Map([...byKey].map(([key, list]) => [key, knownCpu(list.sort((a, b) => a.tick - b.tick))]));
61
+ }
62
+ function processSeries(samples, key) {
63
+ const own = samples.filter((sample) => sample.key === key).sort((a, b) => a.tick - b.tick);
64
+ return { cpu: knownCpu(own), rss: own.map((sample) => sample.rssBytes) };
39
65
  }
40
66
  function sparklinePoints(values, width, height) {
41
67
  if (values.length < 2) return void 0;
@@ -49,5 +75,11 @@ function sparklinePoints(values, width, height) {
49
75
  exports.buildProcessForest = buildProcessForest;
50
76
  exports.cpuSeriesByKey = cpuSeriesByKey;
51
77
  exports.flattenForest = flattenForest;
78
+ exports.formatCpuPercent = formatCpuPercent;
79
+ exports.formatProcessTimestamp = formatProcessTimestamp;
80
+ exports.isProcessExited = isProcessExited;
81
+ exports.processLifetimeMs = processLifetimeMs;
82
+ exports.processSeries = processSeries;
83
+ exports.pruneExitedProcesses = pruneExitedProcesses;
52
84
  exports.sparklinePoints = sparklinePoints;
53
85
  //# sourceMappingURL=process-tree.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-tree.cjs","sources":["../../../src/data/traces/process-tree.ts"],"sourcesContent":["import type { ProcessNodeRow, ProcessSampleRow } from \"./types\";\n\nexport type ProcessTreeNode = {\n row: ProcessNodeRow;\n children: ProcessTreeNode[];\n /** The process has exited: by its status, or because an exit time was recorded. */\n exited: boolean;\n};\n\nconst byStart = (a: ProcessTreeNode, b: ProcessTreeNode) =>\n Date.parse(a.row.startedAt) - Date.parse(b.row.startedAt) || a.row.pid - b.row.pid;\n\n/**\n * Builds the forest a `process_tree` stream describes: each row under its\n * `parentKey`. A row whose parent was never recorded (the capture began below\n * it) becomes a root. The stream holds each process once, so a repeated key or a\n * parent cycle is a corrupt capture and throws.\n */\nexport function buildProcessForest(rows: ProcessNodeRow[]): ProcessTreeNode[] {\n const nodes = new Map<string, ProcessTreeNode>();\n for (const row of rows) {\n if (nodes.has(row.key)) throw new Error(`process tree key \"${row.key}\" appears twice`);\n nodes.set(row.key, { row, children: [], exited: row.status === \"exited\" || Boolean(row.exitedAt) });\n }\n\n const roots: ProcessTreeNode[] = [];\n for (const node of nodes.values()) {\n const parent = node.row.parentKey ? nodes.get(node.row.parentKey) : undefined;\n (parent ? parent.children : roots).push(node);\n }\n\n roots.sort((a, b) => Number(Boolean(b.row.isRoot)) - Number(Boolean(a.row.isRoot)) || byStart(a, b));\n const reached = flattenForest(roots);\n if (reached.length !== nodes.size) {\n const lost = [...nodes.keys()].filter((key) => !reached.some((node) => node.row.key === key));\n throw new Error(`process tree has a parent cycle among keys ${lost.map((key) => `\"${key}\"`).join(\", \")}`);\n }\n for (const node of nodes.values()) node.children.sort(byStart);\n return roots;\n}\n\n/** The forest depth-first, parents before children. */\nexport function flattenForest(roots: ProcessTreeNode[]): ProcessTreeNode[] {\n const flat: ProcessTreeNode[] = [];\n const visit = (node: ProcessTreeNode) => {\n flat.push(node);\n node.children.forEach(visit);\n };\n roots.forEach(visit);\n return flat;\n}\n\n/** Each process's CPU % over its samples, in tick order. */\nexport function cpuSeriesByKey(samples: ProcessSampleRow[]): Map<string, number[]> {\n const byKey = new Map<string, ProcessSampleRow[]>();\n for (const sample of samples) byKey.set(sample.key, [...(byKey.get(sample.key) ?? []), sample]);\n return new Map(\n [...byKey].map(([key, list]) => [key, list.sort((a, b) => a.tick - b.tick).map((sample) => sample.cpuPercent)]),\n );\n}\n\n/** SVG polyline points for `values` in a `width` x `height` box, zero at the bottom and the maximum at the top. */\nexport function sparklinePoints(values: number[], width: number, height: number): string | undefined {\n if (values.length < 2) return undefined;\n const max = Math.max(...values);\n return values\n .map((value, index) => {\n const x = (index / (values.length - 1)) * width;\n const y = max === 0 ? height : height - (value / max) * height;\n return `${x.toFixed(1)},${y.toFixed(1)}`;\n })\n .join(\" \");\n}\n"],"names":[],"mappings":";;AASA,MAAM,UAAU,CAAC,GAAoB,MACnC,KAAK,MAAM,EAAE,IAAI,SAAS,IAAI,KAAK,MAAM,EAAE,IAAI,SAAS,KAAK,EAAE,IAAI,MAAM,EAAE,IAAI;AAQ1E,SAAS,mBAAmB,MAA2C;AAC5E,QAAM,4BAAY,IAAA;AAClB,aAAW,OAAO,MAAM;AACtB,QAAI,MAAM,IAAI,IAAI,GAAG,EAAG,OAAM,IAAI,MAAM,qBAAqB,IAAI,GAAG,iBAAiB;AACrF,UAAM,IAAI,IAAI,KAAK,EAAE,KAAK,UAAU,CAAA,GAAI,QAAQ,IAAI,WAAW,YAAY,QAAQ,IAAI,QAAQ,GAAG;AAAA,EACpG;AAEA,QAAM,QAA2B,CAAA;AACjC,aAAW,QAAQ,MAAM,UAAU;AACjC,UAAM,SAAS,KAAK,IAAI,YAAY,MAAM,IAAI,KAAK,IAAI,SAAS,IAAI;AACpE,KAAC,SAAS,OAAO,WAAW,OAAO,KAAK,IAAI;AAAA,EAC9C;AAEA,QAAM,KAAK,CAAC,GAAG,MAAM,OAAO,QAAQ,EAAE,IAAI,MAAM,CAAC,IAAI,OAAO,QAAQ,EAAE,IAAI,MAAM,CAAC,KAAK,QAAQ,GAAG,CAAC,CAAC;AACnG,QAAM,UAAU,cAAc,KAAK;AACnC,MAAI,QAAQ,WAAW,MAAM,MAAM;AACjC,UAAM,OAAO,CAAC,GAAG,MAAM,KAAA,CAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,KAAK,CAAC,SAAS,KAAK,IAAI,QAAQ,GAAG,C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":["import type { ProcessNodeRow, ProcessSampleRow } from \"./types\";\n\nexport type ProcessTreeNode = {\n row: ProcessNodeRow;\n children: ProcessTreeNode[];\n /** The process has exited: by its status, or because an exit time was recorded. */\n exited: boolean;\n};\n\nconst byStart = (a: ProcessTreeNode, b: ProcessTreeNode) =>\n Date.parse(a.row.startedAt) - Date.parse(b.row.startedAt) || a.row.pid - b.row.pid;\n\n/**\n * Builds the forest a `process_tree` stream describes: each row under its\n * `parentKey`. A row whose parent was never recorded (the capture began below\n * it) becomes a root. The stream holds each process once, so a repeated key or a\n * parent cycle is a corrupt capture and throws.\n */\nexport function buildProcessForest(rows: ProcessNodeRow[]): ProcessTreeNode[] {\n const nodes = new Map<string, ProcessTreeNode>();\n for (const row of rows) {\n if (nodes.has(row.key)) throw new Error(`process tree key \"${row.key}\" appears twice`);\n nodes.set(row.key, { row, children: [], exited: isProcessExited(row) });\n }\n\n const roots: ProcessTreeNode[] = [];\n for (const node of nodes.values()) {\n const parent = node.row.parentKey ? nodes.get(node.row.parentKey) : undefined;\n (parent ? parent.children : roots).push(node);\n }\n\n roots.sort((a, b) => Number(Boolean(b.row.isRoot)) - Number(Boolean(a.row.isRoot)) || byStart(a, b));\n const reached = flattenForest(roots);\n if (reached.length !== nodes.size) {\n const lost = [...nodes.keys()].filter((key) => !reached.some((node) => node.row.key === key));\n throw new Error(`process tree has a parent cycle among keys ${lost.map((key) => `\"${key}\"`).join(\", \")}`);\n }\n for (const node of nodes.values()) node.children.sort(byStart);\n return roots;\n}\n\n/**\n * Drops exited processes from a forest, keeping an exited process only while it\n * still has a live descendant to hang off. Returns new nodes; the input is not\n * modified.\n */\nexport function pruneExitedProcesses(roots: ProcessTreeNode[]): ProcessTreeNode[] {\n return roots.flatMap((node) => {\n const children = pruneExitedProcesses(node.children);\n return node.exited && children.length === 0 ? [] : [{ ...node, children }];\n });\n}\n\n/** How long the process lived: to its exit, else to the last time it was seen. */\nexport function processLifetimeMs(row: ProcessNodeRow): number {\n return Date.parse(row.exitedAt ?? row.lastSeenAt) - Date.parse(row.startedAt);\n}\n\n/** A trace timestamp as local `YYYY-MM-DD HH:MM:SS`; text that is not a date is returned unchanged. */\nexport function formatProcessTimestamp(iso: string): string {\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) return iso;\n const pad = (n: number) => String(n).padStart(2, \"0\");\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;\n}\n\n/** The process has exited: by its status, or because an exit time was recorded. */\nexport function isProcessExited(row: ProcessNodeRow): boolean {\n return row.status === \"exited\" || Boolean(row.exitedAt);\n}\n\n/** The forest depth-first, parents before children. */\nexport function flattenForest(roots: ProcessTreeNode[]): ProcessTreeNode[] {\n const flat: ProcessTreeNode[] = [];\n const visit = (node: ProcessTreeNode) => {\n flat.push(node);\n node.children.forEach(visit);\n };\n roots.forEach(visit);\n return flat;\n}\n\n/** A CPU % for display, \"—\" while it is still unknown. */\nexport function formatCpuPercent(value: number | null | undefined): string {\n return value == null ? \"—\" : `${value.toFixed(1)}%`;\n}\n\nfunction knownCpu(samples: ProcessSampleRow[]): number[] {\n return samples.flatMap((sample) => (sample.cpuPercent == null ? [] : [sample.cpuPercent]));\n}\n\n/** Each process's known CPU % over its samples, in tick order. */\nexport function cpuSeriesByKey(samples: ProcessSampleRow[]): Map<string, number[]> {\n const byKey = new Map<string, ProcessSampleRow[]>();\n for (const sample of samples) byKey.set(sample.key, [...(byKey.get(sample.key) ?? []), sample]);\n return new Map([...byKey].map(([key, list]) => [key, knownCpu(list.sort((a, b) => a.tick - b.tick))]));\n}\n\n/** One process's known CPU % and RSS bytes over its samples, in tick order. */\nexport function processSeries(samples: ProcessSampleRow[], key: string): { cpu: number[]; rss: number[] } {\n const own = samples.filter((sample) => sample.key === key).sort((a, b) => a.tick - b.tick);\n return { cpu: knownCpu(own), rss: own.map((sample) => sample.rssBytes) };\n}\n\n/** SVG polyline points for `values` in a `width` x `height` box, zero at the bottom and the maximum at the top. */\nexport function sparklinePoints(values: number[], width: number, height: number): string | undefined {\n if (values.length < 2) return undefined;\n const max = Math.max(...values);\n return values\n .map((value, index) => {\n const x = (index / (values.length - 1)) * width;\n const y = max === 0 ? height : height - (value / max) * height;\n return `${x.toFixed(1)},${y.toFixed(1)}`;\n })\n .join(\" \");\n}\n"],"names":[],"mappings":";;AASA,MAAM,UAAU,CAAC,GAAoB,MACnC,KAAK,MAAM,EAAE,IAAI,SAAS,IAAI,KAAK,MAAM,EAAE,IAAI,SAAS,KAAK,EAAE,IAAI,MAAM,EAAE,IAAI;AAQ1E,SAAS,mBAAmB,MAA2C;AAC5E,QAAM,4BAAY,IAAA;AAClB,aAAW,OAAO,MAAM;AACtB,QAAI,MAAM,IAAI,IAAI,GAAG,EAAG,OAAM,IAAI,MAAM,qBAAqB,IAAI,GAAG,iBAAiB;AACrF,UAAM,IAAI,IAAI,KAAK,EAAE,KAAK,UAAU,CAAA,GAAI,QAAQ,gBAAgB,GAAG,EAAA,CAAG;AAAA,EACxE;AAEA,QAAM,QAA2B,CAAA;AACjC,aAAW,QAAQ,MAAM,UAAU;AACjC,UAAM,SAAS,KAAK,IAAI,YAAY,MAAM,IAAI,KAAK,IAAI,SAAS,IAAI;AACpE,KAAC,SAAS,OAAO,WAAW,OAAO,KAAK,IAAI;AAAA,EAC9C;AAEA,QAAM,KAAK,CAAC,GAAG,MAAM,OAAO,QAAQ,EAAE,IAAI,MAAM,CAAC,IAAI,OAAO,QAAQ,EAAE,IAAI,MAAM,CAAC,KAAK,QAAQ,GAAG,CAAC,CAAC;AACnG,QAAM,UAAU,cAAc,KAAK;AACnC,MAAI,QAAQ,WAAW,MAAM,MAAM;AACjC,UAAM,OAAO,CAAC,GAAG,MAAM,KAAA,CAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,KAAK,CAAC,SAAS,KAAK,IAAI,QAAQ,GAAG,CAAC;AAC5F,UAAM,IAAI,MAAM,8C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
13
  */
14
14
  export declare function buildProcessForest(rows: ProcessNodeRow[]): ProcessTreeNode[];
15
+ /**
16
+ * Drops exited processes from a forest, keeping an exited process only while it
17
+ * still has a live descendant to hang off. Returns new nodes; the input is not
18
+ * modified.
19
+ */
20
+ export declare function pruneExitedProcesses(roots: ProcessTreeNode[]): ProcessTreeNode[];
21
+ /** How long the process lived: to its exit, else to the last time it was seen. */
22
+ export declare function processLifetimeMs(row: ProcessNodeRow): number;
23
+ /** A trace timestamp as local `YYYY-MM-DD HH:MM:SS`; text that is not a date is returned unchanged. */
24
+ export declare function formatProcessTimestamp(iso: string): string;
25
+ /** The process has exited: by its status, or because an exit time was recorded. */
26
+ export declare function isProcessExited(row: ProcessNodeRow): boolean;
15
27
  /** The forest depth-first, parents before children. */
16
28
  export declare function flattenForest(roots: ProcessTreeNode[]): ProcessTreeNode[];
17
- /** Each process's CPU % over its samples, in tick order. */
29
+ /** A CPU % for display, "—" while it is still unknown. */
30
+ export declare function formatCpuPercent(value: number | null | undefined): string;
31
+ /** Each process's known CPU % over its samples, in tick order. */
18
32
  export declare function cpuSeriesByKey(samples: ProcessSampleRow[]): Map<string, number[]>;
33
+ /** One process's known CPU % and RSS bytes over its samples, in tick order. */
34
+ export declare function processSeries(samples: ProcessSampleRow[], key: string): {
35
+ cpu: number[];
36
+ rss: number[];
37
+ };
19
38
  /** SVG polyline points for `values` in a `width` x `height` box, zero at the bottom and the maximum at the top. */
20
39
  export declare function sparklinePoints(values: number[], width: number, height: number): string | undefined;
21
40
  //# sourceMappingURL=process-tree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-tree.d.ts","sourceRoot":"","sources":["../../../src/data/traces/process-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,cAAc,CAAC;IACpB,QAAQ,EAAE,eAAe,EAAE,CAAC;IA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E5D;AAED,uDAAuD;AACvD,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,CAQzE;AAED,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAEzE;AAMD,kEAAkE;AAClE,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAIjF;AAED,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,CAGxG;AAED,mHAAmH;AACnH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUnG"}
@@ -3,7 +3,7 @@ function buildProcessForest(rows) {
3
3
  const nodes = /* @__PURE__ */ new Map();
4
4
  for (const row of rows) {
5
5
  if (nodes.has(row.key)) throw new Error(`process tree key "${row.key}" appears twice`);
6
- nodes.set(row.key, { row, children: [], exited: row.status === "exited" || Boolean(row.exitedAt) });
6
+ nodes.set(row.key, { row, children: [], exited: isProcessExited(row) });
7
7
  }
8
8
  const roots = [];
9
9
  for (const node of nodes.values()) {
@@ -19,6 +19,24 @@ function buildProcessForest(rows) {
19
19
  for (const node of nodes.values()) node.children.sort(byStart);
20
20
  return roots;
21
21
  }
22
+ function pruneExitedProcesses(roots) {
23
+ return roots.flatMap((node) => {
24
+ const children = pruneExitedProcesses(node.children);
25
+ return node.exited && children.length === 0 ? [] : [{ ...node, children }];
26
+ });
27
+ }
28
+ function processLifetimeMs(row) {
29
+ return Date.parse(row.exitedAt ?? row.lastSeenAt) - Date.parse(row.startedAt);
30
+ }
31
+ function formatProcessTimestamp(iso) {
32
+ const date = new Date(iso);
33
+ if (Number.isNaN(date.getTime())) return iso;
34
+ const pad = (n) => String(n).padStart(2, "0");
35
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
36
+ }
37
+ function isProcessExited(row) {
38
+ return row.status === "exited" || Boolean(row.exitedAt);
39
+ }
22
40
  function flattenForest(roots) {
23
41
  const flat = [];
24
42
  const visit = (node) => {
@@ -28,12 +46,20 @@ function flattenForest(roots) {
28
46
  roots.forEach(visit);
29
47
  return flat;
30
48
  }
49
+ function formatCpuPercent(value) {
50
+ return value == null ? "—" : `${value.toFixed(1)}%`;
51
+ }
52
+ function knownCpu(samples) {
53
+ return samples.flatMap((sample) => sample.cpuPercent == null ? [] : [sample.cpuPercent]);
54
+ }
31
55
  function cpuSeriesByKey(samples) {
32
56
  const byKey = /* @__PURE__ */ new Map();
33
57
  for (const sample of samples) byKey.set(sample.key, [...byKey.get(sample.key) ?? [], sample]);
34
- return new Map(
35
- [...byKey].map(([key, list]) => [key, list.sort((a, b) => a.tick - b.tick).map((sample) => sample.cpuPercent)])
36
- );
58
+ return new Map([...byKey].map(([key, list]) => [key, knownCpu(list.sort((a, b) => a.tick - b.tick))]));
59
+ }
60
+ function processSeries(samples, key) {
61
+ const own = samples.filter((sample) => sample.key === key).sort((a, b) => a.tick - b.tick);
62
+ return { cpu: knownCpu(own), rss: own.map((sample) => sample.rssBytes) };
37
63
  }
38
64
  function sparklinePoints(values, width, height) {
39
65
  if (values.length < 2) return void 0;
@@ -48,6 +74,12 @@ export {
48
74
  buildProcessForest,
49
75
  cpuSeriesByKey,
50
76
  flattenForest,
77
+ formatCpuPercent,
78
+ formatProcessTimestamp,
79
+ isProcessExited,
80
+ processLifetimeMs,
81
+ processSeries,
82
+ pruneExitedProcesses,
51
83
  sparklinePoints
52
84
  };
53
85
  //# sourceMappingURL=process-tree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-tree.js","sources":["../../../src/data/traces/process-tree.ts"],"sourcesContent":["import type { ProcessNodeRow, ProcessSampleRow } from \"./types\";\n\nexport type ProcessTreeNode = {\n row: ProcessNodeRow;\n children: ProcessTreeNode[];\n /** The process has exited: by its status, or because an exit time was recorded. */\n exited: boolean;\n};\n\nconst byStart = (a: ProcessTreeNode, b: ProcessTreeNode) =>\n Date.parse(a.row.startedAt) - Date.parse(b.row.startedAt) || a.row.pid - b.row.pid;\n\n/**\n * Builds the forest a `process_tree` stream describes: each row under its\n * `parentKey`. A row whose parent was never recorded (the capture began below\n * it) becomes a root. The stream holds each process once, so a repeated key or a\n * parent cycle is a corrupt capture and throws.\n */\nexport function buildProcessForest(rows: ProcessNodeRow[]): ProcessTreeNode[] {\n const nodes = new Map<string, ProcessTreeNode>();\n for (const row of rows) {\n if (nodes.has(row.key)) throw new Error(`process tree key \"${row.key}\" appears twice`);\n nodes.set(row.key, { row, children: [], exited: row.status === \"exited\" || Boolean(row.exitedAt) });\n }\n\n const roots: ProcessTreeNode[] = [];\n for (const node of nodes.values()) {\n const parent = node.row.parentKey ? nodes.get(node.row.parentKey) : undefined;\n (parent ? parent.children : roots).push(node);\n }\n\n roots.sort((a, b) => Number(Boolean(b.row.isRoot)) - Number(Boolean(a.row.isRoot)) || byStart(a, b));\n const reached = flattenForest(roots);\n if (reached.length !== nodes.size) {\n const lost = [...nodes.keys()].filter((key) => !reached.some((node) => node.row.key === key));\n throw new Error(`process tree has a parent cycle among keys ${lost.map((key) => `\"${key}\"`).join(\", \")}`);\n }\n for (const node of nodes.values()) node.children.sort(byStart);\n return roots;\n}\n\n/** The forest depth-first, parents before children. */\nexport function flattenForest(roots: ProcessTreeNode[]): ProcessTreeNode[] {\n const flat: ProcessTreeNode[] = [];\n const visit = (node: ProcessTreeNode) => {\n flat.push(node);\n node.children.forEach(visit);\n };\n roots.forEach(visit);\n return flat;\n}\n\n/** Each process's CPU % over its samples, in tick order. */\nexport function cpuSeriesByKey(samples: ProcessSampleRow[]): Map<string, number[]> {\n const byKey = new Map<string, ProcessSampleRow[]>();\n for (const sample of samples) byKey.set(sample.key, [...(byKey.get(sample.key) ?? []), sample]);\n return new Map(\n [...byKey].map(([key, list]) => [key, list.sort((a, b) => a.tick - b.tick).map((sample) => sample.cpuPercent)]),\n );\n}\n\n/** SVG polyline points for `values` in a `width` x `height` box, zero at the bottom and the maximum at the top. */\nexport function sparklinePoints(values: number[], width: number, height: number): string | undefined {\n if (values.length < 2) return undefined;\n const max = Math.max(...values);\n return values\n .map((value, index) => {\n const x = (index / (values.length - 1)) * width;\n const y = max === 0 ? height : height - (value / max) * height;\n return `${x.toFixed(1)},${y.toFixed(1)}`;\n })\n .join(\" \");\n}\n"],"names":[],"mappings":"AASA,MAAM,UAAU,CAAC,GAAoB,MACnC,KAAK,MAAM,EAAE,IAAI,SAAS,IAAI,KAAK,MAAM,EAAE,IAAI,SAAS,KAAK,EAAE,IAAI,MAAM,EAAE,IAAI;AAQ1E,SAAS,mBAAmB,MAA2C;AAC5E,QAAM,4BAAY,IAAA;AAClB,aAAW,OAAO,MAAM;AACtB,QAAI,MAAM,IAAI,IAAI,GAAG,EAAG,OAAM,IAAI,MAAM,qBAAqB,IAAI,GAAG,iBAAiB;AACrF,UAAM,IAAI,IAAI,KAAK,EAAE,KAAK,UAAU,CAAA,GAAI,QAAQ,IAAI,WAAW,YAAY,QAAQ,IAAI,QAAQ,GAAG;AAAA,EACpG;AAEA,QAAM,QAA2B,CAAA;AACjC,aAAW,QAAQ,MAAM,UAAU;AACjC,UAAM,SAAS,KAAK,IAAI,YAAY,MAAM,IAAI,KAAK,IAAI,SAAS,IAAI;AACpE,KAAC,SAAS,OAAO,WAAW,OAAO,KAAK,IAAI;AAAA,EAC9C;AAEA,QAAM,KAAK,CAAC,GAAG,MAAM,OAAO,QAAQ,EAAE,IAAI,MAAM,CAAC,IAAI,OAAO,QAAQ,EAAE,IAAI,MAAM,CAA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,IAAI,QAAQ,IAAI,SAAS,SAAU,QAAQ,MAAO;AACxD,WAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAAA,EACxC,CAAC,EACA,KAAK,GAAG;AACb;"}
1
+ {"version":3,"file":"process-tree.js","sources":["../../../src/data/traces/process-tree.ts"],"sourcesContent":["import type { ProcessNodeRow, ProcessSampleRow } from \"./types\";\n\nexport type ProcessTreeNode = {\n row: ProcessNodeRow;\n children: ProcessTreeNode[];\n /** The process has exited: by its status, or because an exit time was recorded. */\n exited: boolean;\n};\n\nconst byStart = (a: ProcessTreeNode, b: ProcessTreeNode) =>\n Date.parse(a.row.startedAt) - Date.parse(b.row.startedAt) || a.row.pid - b.row.pid;\n\n/**\n * Builds the forest a `process_tree` stream describes: each row under its\n * `parentKey`. A row whose parent was never recorded (the capture began below\n * it) becomes a root. The stream holds each process once, so a repeated key or a\n * parent cycle is a corrupt capture and throws.\n */\nexport function buildProcessForest(rows: ProcessNodeRow[]): ProcessTreeNode[] {\n const nodes = new Map<string, ProcessTreeNode>();\n for (const row of rows) {\n if (nodes.has(row.key)) throw new Error(`process tree key \"${row.key}\" appears twice`);\n nodes.set(row.key, { row, children: [], exited: isProcessExited(row) });\n }\n\n const roots: ProcessTreeNode[] = [];\n for (const node of nodes.values()) {\n const parent = node.row.parentKey ? nodes.get(node.row.parentKey) : undefined;\n (parent ? parent.children : roots).push(node);\n }\n\n roots.sort((a, b) => Number(Boolean(b.row.isRoot)) - Number(Boolean(a.row.isRoot)) || byStart(a, b));\n const reached = flattenForest(roots);\n if (reached.length !== nodes.size) {\n const lost = [...nodes.keys()].filter((key) => !reached.some((node) => node.row.key === key));\n throw new Error(`process tree has a parent cycle among keys ${lost.map((key) => `\"${key}\"`).join(\", \")}`);\n }\n for (const node of nodes.values()) node.children.sort(byStart);\n return roots;\n}\n\n/**\n * Drops exited processes from a forest, keeping an exited process only while it\n * still has a live descendant to hang off. Returns new nodes; the input is not\n * modified.\n */\nexport function pruneExitedProcesses(roots: ProcessTreeNode[]): ProcessTreeNode[] {\n return roots.flatMap((node) => {\n const children = pruneExitedProcesses(node.children);\n return node.exited && children.length === 0 ? [] : [{ ...node, children }];\n });\n}\n\n/** How long the process lived: to its exit, else to the last time it was seen. */\nexport function processLifetimeMs(row: ProcessNodeRow): number {\n return Date.parse(row.exitedAt ?? row.lastSeenAt) - Date.parse(row.startedAt);\n}\n\n/** A trace timestamp as local `YYYY-MM-DD HH:MM:SS`; text that is not a date is returned unchanged. */\nexport function formatProcessTimestamp(iso: string): string {\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) return iso;\n const pad = (n: number) => String(n).padStart(2, \"0\");\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;\n}\n\n/** The process has exited: by its status, or because an exit time was recorded. */\nexport function isProcessExited(row: ProcessNodeRow): boolean {\n return row.status === \"exited\" || Boolean(row.exitedAt);\n}\n\n/** The forest depth-first, parents before children. */\nexport function flattenForest(roots: ProcessTreeNode[]): ProcessTreeNode[] {\n const flat: ProcessTreeNode[] = [];\n const visit = (node: ProcessTreeNode) => {\n flat.push(node);\n node.children.forEach(visit);\n };\n roots.forEach(visit);\n return flat;\n}\n\n/** A CPU % for display, \"—\" while it is still unknown. */\nexport function formatCpuPercent(value: number | null | undefined): string {\n return value == null ? \"—\" : `${value.toFixed(1)}%`;\n}\n\nfunction knownCpu(samples: ProcessSampleRow[]): number[] {\n return samples.flatMap((sample) => (sample.cpuPercent == null ? [] : [sample.cpuPercent]));\n}\n\n/** Each process's known CPU % over its samples, in tick order. */\nexport function cpuSeriesByKey(samples: ProcessSampleRow[]): Map<string, number[]> {\n const byKey = new Map<string, ProcessSampleRow[]>();\n for (const sample of samples) byKey.set(sample.key, [...(byKey.get(sample.key) ?? []), sample]);\n return new Map([...byKey].map(([key, list]) => [key, knownCpu(list.sort((a, b) => a.tick - b.tick))]));\n}\n\n/** One process's known CPU % and RSS bytes over its samples, in tick order. */\nexport function processSeries(samples: ProcessSampleRow[], key: string): { cpu: number[]; rss: number[] } {\n const own = samples.filter((sample) => sample.key === key).sort((a, b) => a.tick - b.tick);\n return { cpu: knownCpu(own), rss: own.map((sample) => sample.rssBytes) };\n}\n\n/** SVG polyline points for `values` in a `width` x `height` box, zero at the bottom and the maximum at the top. */\nexport function sparklinePoints(values: number[], width: number, height: number): string | undefined {\n if (values.length < 2) return undefined;\n const max = Math.max(...values);\n return values\n .map((value, index) => {\n const x = (index / (values.length - 1)) * width;\n const y = max === 0 ? height : height - (value / max) * height;\n return `${x.toFixed(1)},${y.toFixed(1)}`;\n })\n .join(\" \");\n}\n"],"names":[],"mappings":"AASA,MAAM,UAAU,CAAC,GAAoB,MACnC,KAAK,MAAM,EAAE,IAAI,SAAS,IAAI,KAAK,MAAM,EAAE,IAAI,SAAS,KAAK,EAAE,IAAI,MAAM,EAAE,IAAI;AAQ1E,SAAS,mBAAmB,MAA2C;AAC5E,QAAM,4BAAY,IAAA;AAClB,aAAW,OAAO,MAAM;AACtB,QAAI,MAAM,IAAI,IAAI,GAAG,EAAG,OAAM,IAAI,MAAM,qBAAqB,IAAI,GAAG,iBAAiB;AACrF,UAAM,IAAI,IAAI,KAAK,EAAE,KAAK,UAAU,CAAA,GAAI,QAAQ,gBAAgB,GAAG,EAAA,CAAG;AAAA,EACxE;AAEA,QAAM,QAA2B,CAAA;AACjC,aAAW,QAAQ,MAAM,UAAU;AACjC,UAAM,SAAS,KAAK,IAAI,YAAY,MAAM,IAAI,KAAK,IAAI,SAAS,IAAI;AACpE,KAAC,SAAS,OAAO,WAAW,OAAO,KAAK,IAAI;AAAA,EAC9C;AAEA,QAAM,KAAK,CAAC,GAAG,MAAM,OAAO,QAAQ,EAAE,IAAI,MAAM,CAAC,IAAI,OAAO,QAAQ,EAAE,IAAI,MAAM,CAAC,KAAK,QAAQ,GAAG,CAAC,CAAC;AACnG,Q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I,SAAS,SAAU,QAAQ,MAAO;AACxD,WAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAAA,EACxC,CAAC,EACA,KAAK,GAAG;AACb;"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const format = require("../../lib/format.cjs");
4
+ function profileValueTypes(samples) {
5
+ const seen = /* @__PURE__ */ new Map();
6
+ for (const sample of samples) {
7
+ if (!seen.has(sample.sampleType)) seen.set(sample.sampleType, { sampleType: sample.sampleType, unit: sample.unit });
8
+ }
9
+ return [...seen.values()];
10
+ }
11
+ function ofType(samples, sampleType) {
12
+ const own = samples.filter((sample) => sample.sampleType === sampleType);
13
+ const units = new Set(own.map((sample) => sample.unit));
14
+ if (units.size > 1) {
15
+ throw new Error(`sample type "${sampleType}" has mixed units ${[...units].map((unit) => `"${unit}"`).join(", ")}`);
16
+ }
17
+ for (const sample of own) {
18
+ if (sample.frames.length === 0) throw new Error(`a "${sampleType}" sample has no frames`);
19
+ }
20
+ return own;
21
+ }
22
+ function aggregateProfile(samples, sampleType) {
23
+ var _a;
24
+ const own = ofType(samples, sampleType);
25
+ const rows = /* @__PURE__ */ new Map();
26
+ let total = 0;
27
+ for (const sample of own) {
28
+ total += sample.value;
29
+ for (const frame of sample.frames) {
30
+ if (!rows.has(frame.func)) {
31
+ rows.set(frame.func, { func: frame.func, file: frame.file, line: frame.line, flat: 0, cum: 0 });
32
+ }
33
+ }
34
+ for (const func of new Set(sample.frames.map((frame) => frame.func))) rows.get(func).cum += sample.value;
35
+ rows.get(sample.frames[0].func).flat += sample.value;
36
+ }
37
+ return {
38
+ total,
39
+ unit: ((_a = own[0]) == null ? void 0 : _a.unit) ?? "",
40
+ functions: [...rows.values()].sort((a, b) => b.flat - a.flat || b.cum - a.cum || a.func.localeCompare(b.func))
41
+ };
42
+ }
43
+ function stacksThrough(samples, sampleType, func, limit) {
44
+ const stacks = /* @__PURE__ */ new Map();
45
+ for (const sample of ofType(samples, sampleType)) {
46
+ if (!sample.frames.some((frame) => frame.func === func)) continue;
47
+ const id = sample.frames.map((frame) => `${frame.func}@${frame.file}:${frame.line}`).join("\n");
48
+ const stack = stacks.get(id);
49
+ if (stack) stack.value += sample.value;
50
+ else stacks.set(id, { frames: sample.frames, value: sample.value });
51
+ }
52
+ return [...stacks.values()].sort((a, b) => b.value - a.value).slice(0, limit);
53
+ }
54
+ const NANOS_PER_MS = 1e6;
55
+ function formatProfileValue(value, unit) {
56
+ switch (unit) {
57
+ case "bytes":
58
+ return format.formatBytes(value);
59
+ case "nanoseconds":
60
+ return Math.abs(value) < NANOS_PER_MS ? `${format.formatShort(value / 1e3)} µs` : format.formatDuration(value / NANOS_PER_MS);
61
+ case "microseconds":
62
+ return Math.abs(value) < 1e3 ? `${format.formatShort(value)} µs` : format.formatDuration(value / 1e3);
63
+ case "milliseconds":
64
+ return format.formatDuration(value);
65
+ case "seconds":
66
+ return format.formatDuration(value, { from: "s" });
67
+ case "count":
68
+ case "":
69
+ return format.formatShort(value);
70
+ default:
71
+ return `${format.formatShort(value)} ${unit}`;
72
+ }
73
+ }
74
+ exports.aggregateProfile = aggregateProfile;
75
+ exports.formatProfileValue = formatProfileValue;
76
+ exports.profileValueTypes = profileValueTypes;
77
+ exports.stacksThrough = stacksThrough;
78
+ //# sourceMappingURL=profile-aggregate.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-aggregate.cjs","sources":["../../../src/data/traces/profile-aggregate.ts"],"sourcesContent":["import { formatBytes, formatDuration, formatShort } from \"../../lib/format\";\nimport type { ProfileSample, StackFrame } from \"./types\";\n\n/** A sample type of a profile with its unit, for example `cpu` in `nanoseconds`. */\nexport type ProfileValueType = { sampleType: string; unit: string };\n\n/** One function's share of a profile. */\nexport type ProfileFunctionRow = {\n func: string;\n /** Where the function was first seen in the samples. */\n file: string;\n line: number;\n /** Value of the samples whose innermost frame is this function. */\n flat: number;\n /** Value of the samples whose stack contains this function at all, counted once per sample. */\n cum: number;\n};\n\nexport type ProfileAggregate = {\n total: number;\n unit: string;\n /** Every function, sorted by `flat` descending. */\n functions: ProfileFunctionRow[];\n};\n\n/** A distinct stack and the value of all the samples that shared it. */\nexport type ProfileStack = { frames: StackFrame[]; value: number };\n\n/** The sample types present, in order of first appearance. */\nexport function profileValueTypes(samples: ProfileSample[]): ProfileValueType[] {\n const seen = new Map<string, ProfileValueType>();\n for (const sample of samples) {\n if (!seen.has(sample.sampleType)) seen.set(sample.sampleType, { sampleType: sample.sampleType, unit: sample.unit });\n }\n return [...seen.values()];\n}\n\nfunction ofType(samples: ProfileSample[], sampleType: string): ProfileSample[] {\n const own = samples.filter((sample) => sample.sampleType === sampleType);\n const units = new Set(own.map((sample) => sample.unit));\n if (units.size > 1) {\n throw new Error(`sample type \"${sampleType}\" has mixed units ${[...units].map((unit) => `\"${unit}\"`).join(\", \")}`);\n }\n for (const sample of own) {\n if (sample.frames.length === 0) throw new Error(`a \"${sampleType}\" sample has no frames`);\n }\n return own;\n}\n\n/**\n * Totals one sample type's samples per function: flat (the innermost frame) and\n * cumulative (anywhere in the stack, once per sample even when the function\n * recurses). Frames are innermost first.\n */\nexport function aggregateProfile(samples: ProfileSample[], sampleType: string): ProfileAggregate {\n const own = ofType(samples, sampleType);\n const rows = new Map<string, ProfileFunctionRow>();\n let total = 0;\n for (const sample of own) {\n total += sample.value;\n for (const frame of sample.frames) {\n if (!rows.has(frame.func)) {\n rows.set(frame.func, { func: frame.func, file: frame.file, line: frame.line, flat: 0, cum: 0 });\n }\n }\n for (const func of new Set(sample.frames.map((frame) => frame.func))) rows.get(func)!.cum += sample.value;\n rows.get(sample.frames[0]!.func)!.flat += sample.value;\n }\n return {\n total,\n unit: own[0]?.unit ?? \"\",\n functions: [...rows.values()].sort((a, b) => b.flat - a.flat || b.cum - a.cum || a.func.localeCompare(b.func)),\n };\n}\n\n/** The heaviest distinct stacks of one sample type that pass through `func`, heaviest first. */\nexport function stacksThrough(samples: ProfileSample[], sampleType: string, func: string, limit: number): ProfileStack[] {\n const stacks = new Map<string, ProfileStack>();\n for (const sample of ofType(samples, sampleType)) {\n if (!sample.frames.some((frame) => frame.func === func)) continue;\n const id = sample.frames.map((frame) => `${frame.func}@${frame.file}:${frame.line}`).join(\"\\n\");\n const stack = stacks.get(id);\n if (stack) stack.value += sample.value;\n else stacks.set(id, { frames: sample.frames, value: sample.value });\n }\n return [...stacks.values()].sort((a, b) => b.value - a.value).slice(0, limit);\n}\n\nconst NANOS_PER_MS = 1e6;\n\n/** A profile value for display in its unit: bytes, durations and plain counts. */\nexport function formatProfileValue(value: number, unit: string): string {\n switch (unit) {\n case \"bytes\":\n return formatBytes(value);\n case \"nanoseconds\":\n return Math.abs(value) < NANOS_PER_MS ? `${formatShort(value / 1e3)} µs` : formatDuration(value / NANOS_PER_MS);\n case \"microseconds\":\n return Math.abs(value) < 1e3 ? `${formatShort(value)} µs` : formatDuration(value / 1e3);\n case \"milliseconds\":\n return formatDuration(value);\n case \"seconds\":\n return formatDuration(value, { from: \"s\" });\n case \"count\":\n case \"\":\n return formatShort(value);\n default:\n return `${formatShort(value)} ${unit}`;\n }\n}\n"],"names":["formatBytes","formatShort","formatDuration"],"mappings":";;;AA6BO,SAAS,kBAAkB,SAA8C;AAC9E,QAAM,2BAAW,IAAA;AACjB,aAAW,UAAU,SAAS;AAC5B,QAAI,CAAC,KAAK,IAAI,OAAO,UAAU,EAAG,MAAK,IAAI,OAAO,YAAY,EAAE,YAAY,OAAO,YAAY,MAAM,OAAO,MAAM;AAAA,EACpH;AACA,SAAO,CAAC,GAAG,KAAK,QAAQ;AAC1B;AAEA,SAAS,OAAO,SAA0B,YAAqC;AAC7E,QAAM,MAAM,QAAQ,OAAO,CAAC,WAAW,OAAO,eAAe,UAAU;AACvE,QAAM,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW,OAAO,IAAI,CAAC;AACtD,MAAI,MAAM,OAAO,GAAG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ProfileValueType = {
4
+ sampleType: string;
5
+ unit: string;
6
+ };
7
+ /** One function's share of a profile. */
8
+ export type ProfileFunctionRow = {
9
+ func: string;
10
+ /** Where the function was first seen in the samples. */
11
+ file: string;
12
+ line: number;
13
+ /** Value of the samples whose innermost frame is this function. */
14
+ flat: number;
15
+ /** Value of the samples whose stack contains this function at all, counted once per sample. */
16
+ cum: number;
17
+ };
18
+ export type ProfileAggregate = {
19
+ total: number;
20
+ unit: string;
21
+ /** Every function, sorted by `flat` descending. */
22
+ functions: ProfileFunctionRow[];
23
+ };
24
+ /** A distinct stack and the value of all the samples that shared it. */
25
+ export type ProfileStack = {
26
+ frames: StackFrame[];
27
+ value: number;
28
+ };
29
+ /** The sample types present, in order of first appearance. */
30
+ export declare function profileValueTypes(samples: ProfileSample[]): ProfileValueType[];
31
+ /**
32
+ * Totals one sample type's samples per function: flat (the innermost frame) and
33
+ * cumulative (anywhere in the stack, once per sample even when the function
34
+ * recurses). Frames are innermost first.
35
+ */
36
+ export declare function aggregateProfile(samples: ProfileSample[], sampleType: string): ProfileAggregate;
37
+ /** The heaviest distinct stacks of one sample type that pass through `func`, heaviest first. */
38
+ export declare function stacksThrough(samples: ProfileSample[], sampleType: string, func: string, limit: number): ProfileStack[];
39
+ /** A profile value for display in its unit: bytes, durations and plain counts. */
40
+ export declare function formatProfileValue(value: number, unit: string): string;
41
+ //# sourceMappingURL=profile-aggregate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-aggregate.d.ts","sourceRoot":"","sources":["../../../src/data/traces/profile-aggregate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEzD,oFAAoF;AACpF,MAAM,MAAM,gBAAgB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE,yCAAyC;AACzC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAA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