@overkill-dev/bench 0.0.5 → 0.0.7

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 (224) hide show
  1. package/bench/benchmark-authoring.d.ts +10 -0
  2. package/bench/benchmark-authoring.d.ts.map +1 -0
  3. package/bench/benchmark-authoring.js +29 -0
  4. package/bench/benchmark-authoring.js.map +1 -0
  5. package/bench/benchmark-budget-definition.d.ts +19 -0
  6. package/bench/benchmark-budget-definition.d.ts.map +1 -0
  7. package/bench/benchmark-budget-definition.js +44 -0
  8. package/bench/benchmark-budget-definition.js.map +1 -0
  9. package/bench/benchmark-budget-evaluation.js +34 -0
  10. package/bench/benchmark-budget-evaluation.js.map +1 -0
  11. package/bench/benchmark-budget.js +123 -0
  12. package/bench/benchmark-budget.js.map +1 -0
  13. package/bench/benchmark-definition-resolution.js +93 -0
  14. package/bench/benchmark-definition-resolution.js.map +1 -0
  15. package/bench/benchmark-definition.d.ts +45 -0
  16. package/bench/benchmark-definition.d.ts.map +1 -0
  17. package/bench/benchmark-execution-context.js +35 -0
  18. package/bench/benchmark-execution-context.js.map +1 -0
  19. package/bench/benchmark-garbage-collection.js +41 -0
  20. package/bench/benchmark-garbage-collection.js.map +1 -0
  21. package/bench/benchmark-lifecycle-policy.d.ts +6 -0
  22. package/bench/benchmark-lifecycle-policy.d.ts.map +1 -0
  23. package/bench/benchmark-lifecycle-policy.js +34 -0
  24. package/bench/benchmark-lifecycle-policy.js.map +1 -0
  25. package/bench/benchmark-lifecycle.js +83 -0
  26. package/bench/benchmark-lifecycle.js.map +1 -0
  27. package/bench/benchmark-normalization.js +71 -0
  28. package/bench/benchmark-normalization.js.map +1 -0
  29. package/bench/benchmark-observation-set.js +46 -0
  30. package/bench/benchmark-observation-set.js.map +1 -0
  31. package/bench/benchmark-observations.js +76 -0
  32. package/bench/benchmark-observations.js.map +1 -0
  33. package/bench/benchmark-resource-envelope.js +67 -0
  34. package/bench/benchmark-resource-envelope.js.map +1 -0
  35. package/bench/benchmark-runtime-cooldown.js +136 -0
  36. package/bench/benchmark-runtime-cooldown.js.map +1 -0
  37. package/bench/benchmark-sample-lifetime.js +134 -0
  38. package/bench/benchmark-sample-lifetime.js.map +1 -0
  39. package/bench/benchmark-sampling-evidence.js +54 -0
  40. package/bench/benchmark-sampling-evidence.js.map +1 -0
  41. package/bench/benchmark-sampling-state.js +90 -0
  42. package/bench/benchmark-sampling-state.js.map +1 -0
  43. package/bench/benchmark-sampling.js +75 -0
  44. package/bench/benchmark-sampling.js.map +1 -0
  45. package/bench/calibrated-measurement.d.ts +11 -0
  46. package/bench/calibrated-measurement.d.ts.map +1 -0
  47. package/bench/calibrated-measurement.js +58 -0
  48. package/bench/calibrated-measurement.js.map +1 -0
  49. package/bench/calibration-definition.d.ts +38 -0
  50. package/bench/calibration-definition.d.ts.map +1 -0
  51. package/bench/calibration-failure.js +18 -0
  52. package/bench/calibration-failure.js.map +1 -0
  53. package/bench/calibration-observations.js +64 -0
  54. package/bench/calibration-observations.js.map +1 -0
  55. package/bench/calibration-references.js +55 -0
  56. package/bench/calibration-references.js.map +1 -0
  57. package/bench/calibration-resource-body.js +59 -0
  58. package/bench/calibration-resource-body.js.map +1 -0
  59. package/bench/calibration-resource.d.ts +5 -0
  60. package/bench/calibration-resource.d.ts.map +1 -0
  61. package/bench/calibration-resource.js +63 -0
  62. package/bench/calibration-resource.js.map +1 -0
  63. package/bench/calibration-sampling.js +103 -0
  64. package/bench/calibration-sampling.js.map +1 -0
  65. package/bench/canonical-calibration.js +18 -0
  66. package/bench/canonical-calibration.js.map +1 -0
  67. package/bench/cpu-calibration.d.ts +3 -0
  68. package/bench/cpu-calibration.d.ts.map +1 -0
  69. package/bench/cpu-calibration.js +31 -0
  70. package/bench/cpu-calibration.js.map +1 -0
  71. package/bench/default-normalization.js +37 -0
  72. package/bench/default-normalization.js.map +1 -0
  73. package/bench/measurement-contract-error.js +7 -0
  74. package/bench/measurement-contract-error.js.map +1 -0
  75. package/bench/measurement-definition.d.ts +19 -0
  76. package/bench/measurement-definition.d.ts.map +1 -0
  77. package/bench/measurement-definition.js +22 -0
  78. package/bench/measurement-definition.js.map +1 -0
  79. package/bench/measurement-region.js +159 -0
  80. package/bench/measurement-region.js.map +1 -0
  81. package/bench/measurement-resources.js +113 -0
  82. package/bench/measurement-resources.js.map +1 -0
  83. package/bench/measurement-strategy.d.ts +5 -0
  84. package/bench/measurement-strategy.d.ts.map +1 -0
  85. package/bench/measurement-strategy.js +35 -0
  86. package/bench/measurement-strategy.js.map +1 -0
  87. package/bench/measurement-types.d.ts +61 -0
  88. package/bench/measurement-types.d.ts.map +1 -0
  89. package/bench/measurement-units.js +5 -0
  90. package/bench/measurement-units.js.map +1 -0
  91. package/bench/metric-normalization-evidence.js +7 -0
  92. package/bench/metric-normalization-evidence.js.map +1 -0
  93. package/bench/metric-reading.d.ts +4 -0
  94. package/bench/metric-reading.d.ts.map +1 -0
  95. package/bench/metric-reading.js +18 -0
  96. package/bench/metric-reading.js.map +1 -0
  97. package/bench/module-import-execution.js +47 -0
  98. package/bench/module-import-execution.js.map +1 -0
  99. package/bench/module-import-result.js +53 -0
  100. package/bench/module-import-result.js.map +1 -0
  101. package/bench/module-import-session.js +141 -0
  102. package/bench/module-import-session.js.map +1 -0
  103. package/bench/module-measurement.d.ts +31 -0
  104. package/bench/module-measurement.d.ts.map +1 -0
  105. package/bench/module-measurement.js +4 -0
  106. package/bench/module-measurement.js.map +1 -0
  107. package/bench/module-sampling.js +57 -0
  108. package/bench/module-sampling.js.map +1 -0
  109. package/bench/native-metric-collectors.d.ts +6 -0
  110. package/bench/native-metric-collectors.d.ts.map +1 -0
  111. package/bench/native-metric-collectors.js +181 -0
  112. package/bench/native-metric-collectors.js.map +1 -0
  113. package/bench/normalization-interval.js +63 -0
  114. package/bench/normalization-interval.js.map +1 -0
  115. package/bench/normalization-summaries.js +85 -0
  116. package/bench/normalization-summaries.js.map +1 -0
  117. package/bench/process-child.js +131 -0
  118. package/bench/process-child.js.map +1 -0
  119. package/bench/process-command.d.ts +292 -0
  120. package/bench/process-command.d.ts.map +1 -0
  121. package/bench/process-command.js +32 -0
  122. package/bench/process-command.js.map +1 -0
  123. package/bench/process-deadline.js +21 -0
  124. package/bench/process-deadline.js.map +1 -0
  125. package/bench/process-evidence-query.js +3 -0
  126. package/bench/process-evidence-query.js.map +1 -0
  127. package/bench/process-evidence.js +80 -0
  128. package/bench/process-evidence.js.map +1 -0
  129. package/bench/process-execution.js +170 -0
  130. package/bench/process-execution.js.map +1 -0
  131. package/bench/process-helper.js +208 -0
  132. package/bench/process-helper.js.map +1 -0
  133. package/bench/process-interactions.js +79 -0
  134. package/bench/process-interactions.js.map +1 -0
  135. package/bench/process-invocation.js +80 -0
  136. package/bench/process-invocation.js.map +1 -0
  137. package/bench/process-measurement-result.js +66 -0
  138. package/bench/process-measurement-result.js.map +1 -0
  139. package/bench/process-measurement.d.ts +16 -0
  140. package/bench/process-measurement.d.ts.map +1 -0
  141. package/bench/process-measurement.js +6 -0
  142. package/bench/process-measurement.js.map +1 -0
  143. package/bench/process-node-observation.js +64 -0
  144. package/bench/process-node-observation.js.map +1 -0
  145. package/bench/process-node-readings.js +56 -0
  146. package/bench/process-node-readings.js.map +1 -0
  147. package/bench/process-observation.d.ts +120 -0
  148. package/bench/process-observation.d.ts.map +1 -0
  149. package/bench/process-observation.js +37 -0
  150. package/bench/process-observation.js.map +1 -0
  151. package/bench/process-output.js +116 -0
  152. package/bench/process-output.js.map +1 -0
  153. package/bench/process-probe-report.js +51 -0
  154. package/bench/process-probe-report.js.map +1 -0
  155. package/bench/process-probe-session.js +175 -0
  156. package/bench/process-probe-session.js.map +1 -0
  157. package/bench/process-protocol.js +51 -0
  158. package/bench/process-protocol.js.map +1 -0
  159. package/bench/process-sampling.js +67 -0
  160. package/bench/process-sampling.js.map +1 -0
  161. package/bench/process-script.d.ts +319 -0
  162. package/bench/process-script.d.ts.map +1 -0
  163. package/bench/process-script.js +77 -0
  164. package/bench/process-script.js.map +1 -0
  165. package/bench/process-timeline.js +33 -0
  166. package/bench/process-timeline.js.map +1 -0
  167. package/bench/runtime-health-collector.d.ts +3 -0
  168. package/bench/runtime-health-collector.d.ts.map +1 -0
  169. package/bench/runtime-health-collector.js +105 -0
  170. package/bench/runtime-health-collector.js.map +1 -0
  171. package/bench/sampling-policy.d.ts +3 -0
  172. package/bench/sampling-policy.d.ts.map +1 -0
  173. package/bench/sampling-policy.js +25 -0
  174. package/bench/sampling-policy.js.map +1 -0
  175. package/bench/statistical-primitives.js +39 -0
  176. package/bench/statistical-primitives.js.map +1 -0
  177. package/bench/timeline-context.js +97 -0
  178. package/bench/timeline-context.js.map +1 -0
  179. package/bench/timeline-execution.js +25 -0
  180. package/bench/timeline-execution.js.map +1 -0
  181. package/bench/timeline-measurement.d.ts +7 -0
  182. package/bench/timeline-measurement.d.ts.map +1 -0
  183. package/bench/timeline-measurement.js +15 -0
  184. package/bench/timeline-measurement.js.map +1 -0
  185. package/bench/timeline-recording.js +152 -0
  186. package/bench/timeline-recording.js.map +1 -0
  187. package/bench/timeline-report.d.ts +4 -0
  188. package/bench/timeline-report.d.ts.map +1 -0
  189. package/bench/timeline-report.js +41 -0
  190. package/bench/timeline-report.js.map +1 -0
  191. package/bench/workload.d.ts +13 -0
  192. package/bench/workload.d.ts.map +1 -0
  193. package/bench/workload.js +20 -0
  194. package/bench/workload.js.map +1 -0
  195. package/package.json +41 -5
  196. package/packages/bench/bench.entry-point.d.ts +33 -0
  197. package/packages/bench/bench.entry-point.d.ts.map +1 -1
  198. package/packages/bench/bench.entry-point.js +16 -0
  199. package/packages/bench/bench.entry-point.js.map +1 -1
  200. package/packages/bench/calibration.entry-point.d.ts +9 -0
  201. package/packages/bench/calibration.entry-point.d.ts.map +1 -0
  202. package/packages/bench/calibration.entry-point.js +5 -0
  203. package/packages/bench/calibration.entry-point.js.map +1 -0
  204. package/packages/bench/module-import.entry-point.js +81 -0
  205. package/packages/bench/module-import.entry-point.js.map +1 -0
  206. package/packages/bench/process-helper.entry-point.js +84 -0
  207. package/packages/bench/process-helper.entry-point.js.map +1 -0
  208. package/packages/bench/process-node-probe.entry-point.js +46 -0
  209. package/packages/bench/process-node-probe.entry-point.js.map +1 -0
  210. package/packages/test/authoring-source-locations.js +10 -12
  211. package/packages/test/authoring-source-locations.js.map +1 -1
  212. package/packages/test/resource-wrapper-composition.js +37 -50
  213. package/packages/test/resource-wrapper-composition.js.map +1 -1
  214. package/packages/test/resource-wrapper-data.js +13 -1
  215. package/packages/test/resource-wrapper-data.js.map +1 -1
  216. package/packages/test/resource-wrapper-runtime-scope.js.map +1 -1
  217. package/packages/test/resource-wrapper-session.js +49 -2
  218. package/packages/test/resource-wrapper-session.js.map +1 -1
  219. package/packages/test/table-authoring.d.ts.map +1 -1
  220. package/packages/test/table-authoring.js +8 -9
  221. package/packages/test/table-authoring.js.map +1 -1
  222. package/readme.md +549 -10
  223. package/software-bill-of-materials.cyclonedx.json +203 -0
  224. package/sbom.cdx.json +0 -84
@@ -0,0 +1,152 @@
1
+ import { PerformanceObserver as RuntimeObserver, performance as runtimePerformance } from 'node:perf_hooks';
2
+ import { setImmediate as nextTurn } from 'node:timers/promises';
3
+ import { artifactIdentityProjection } from "@overkill-dev/engine/engine/run-artifact.js";
4
+ import { attachmentsForProducer, currentAttachmentLimits, defaultAttachmentLimits } from "@overkill-dev/resources/attachment-context";
5
+ import { createStoredValue } from "@overkill-dev/engine/stored-value.js";
6
+ import { benchmarkTimelineMediaType } from "./timeline-report.js";
7
+ import { microsecondsPerMillisecond } from "./measurement-units.js";
8
+ const envelopeBytes = 128;
9
+ const completionReserveBytes = 64;
10
+ function elapsed(capture) {
11
+ return runtimePerformance.now() * microsecondsPerMillisecond - capture.origin;
12
+ }
13
+ function append(capture, event) {
14
+ const progress = capture.progress.read();
15
+ if (progress.closed) {
16
+ return;
17
+ }
18
+ const size = Buffer.byteLength(JSON.stringify(event)) + completionReserveBytes;
19
+ if (capture.events.length >= capture.policy.maximumEvents || progress.bytes + size > capture.maximumBytes) {
20
+ capture.progress.write({ ...progress, omitted: progress.omitted + 1 });
21
+ }
22
+ else {
23
+ capture.appendEvent(event);
24
+ capture.progress.write({ ...progress, bytes: progress.bytes + size });
25
+ }
26
+ }
27
+ function withinCapture(capture, time) {
28
+ const { end } = capture.progress.read();
29
+ return time >= 0 && (end === null || time <= end);
30
+ }
31
+ function appendRuntimeEntry(capture, entry) {
32
+ const startMicroseconds = entry.startTime * microsecondsPerMillisecond - capture.origin;
33
+ const attribution = capture.invocations.findLast(function precedingInvocation(invocation) {
34
+ return invocation.start <= startMicroseconds;
35
+ });
36
+ if (attribution !== undefined && withinCapture(capture, startMicroseconds)) {
37
+ append(capture, {
38
+ phase: attribution.phase,
39
+ sample: attribution.sample,
40
+ source: 'runtime',
41
+ name: 'GC',
42
+ clockDomain: 'runtime',
43
+ startMicroseconds,
44
+ durationMicroseconds: entry.duration * microsecondsPerMillisecond,
45
+ outcome: 'complete'
46
+ });
47
+ }
48
+ }
49
+ function recordRuntimeEntries(capture, entries) {
50
+ for (const entry of entries) {
51
+ appendRuntimeEntry(capture, entry);
52
+ }
53
+ }
54
+ function snapshot(capture) {
55
+ return { ...capture.evidence.read(), events: capture.events.length, omitted: capture.progress.read().omitted };
56
+ }
57
+ async function publish(capture) {
58
+ const evidence = snapshot(capture);
59
+ if (currentAttachmentLimits() === null) {
60
+ return { ...evidence, status: 'omitted', reason: 'No runner attachment coordinator is active.' };
61
+ }
62
+ const artifact = await attachmentsForProducer({ kind: 'case' }).json({ name: 'benchmark-timeline', mediaType: benchmarkTimelineMediaType }, { version: 1, events: capture.events, omitted: evidence.omitted });
63
+ const unavailable = artifact.payload.content.kind === 'omitted';
64
+ return {
65
+ ...evidence,
66
+ status: unavailable ? 'omitted' : 'recorded',
67
+ reference: JSON.stringify(artifactIdentityProjection(artifact.id)),
68
+ reason: unavailable ? artifact.payload.content.reason : null
69
+ };
70
+ }
71
+ async function retain(capture, observer) {
72
+ const previous = capture.progress.read();
73
+ if (previous.retained) {
74
+ return;
75
+ }
76
+ capture.progress.write({ ...previous, retained: true, end: elapsed(capture) });
77
+ await nextTurn();
78
+ await nextTurn();
79
+ recordRuntimeEntries(capture, observer.takeRecords());
80
+ observer.disconnect();
81
+ capture.progress.write({ ...capture.progress.read(), closed: true });
82
+ capture.evidence.write(await publish(capture));
83
+ }
84
+ function createCapture(policy) {
85
+ const limits = currentAttachmentLimits() ?? defaultAttachmentLimits;
86
+ const events = [];
87
+ const invocations = [];
88
+ return {
89
+ policy,
90
+ origin: runtimePerformance.now() * microsecondsPerMillisecond,
91
+ maximumBytes: Math.min(limits.maxInlineBytes, limits.maxArtifactBytes),
92
+ events,
93
+ invocations,
94
+ appendEvent(event) {
95
+ events.push(event);
96
+ },
97
+ appendInvocation(invocation) {
98
+ invocations.push(invocation);
99
+ },
100
+ progress: createStoredValue({
101
+ closed: false,
102
+ retained: false,
103
+ bytes: envelopeBytes,
104
+ omitted: 0,
105
+ current: { phase: 'warmup', sample: 0 },
106
+ end: null
107
+ }),
108
+ evidence: createStoredValue({
109
+ version: 1,
110
+ events: 0,
111
+ omitted: 0,
112
+ status: 'pending',
113
+ reference: null,
114
+ reason: 'Timeline observations have not been persisted.'
115
+ })
116
+ };
117
+ }
118
+ export function createTimelineRecording(policy) {
119
+ const capture = createCapture(policy);
120
+ const observer = new RuntimeObserver(function gcEntries(list) {
121
+ recordRuntimeEntries(capture, list.getEntries());
122
+ });
123
+ observer.observe({ entryTypes: ['gc'] });
124
+ return {
125
+ append(event) {
126
+ append(capture, event);
127
+ },
128
+ elapsed() {
129
+ return elapsed(capture);
130
+ },
131
+ attribution() {
132
+ return capture.progress.read().current;
133
+ },
134
+ invocation(phase, sample) {
135
+ capture.progress.write({ ...capture.progress.read(), current: { phase, sample } });
136
+ if (capture.invocations.length < policy.maximumEvents) {
137
+ capture.appendInvocation({ phase, sample, start: elapsed(capture) });
138
+ }
139
+ },
140
+ evidence() {
141
+ return snapshot(capture);
142
+ },
143
+ async retain() {
144
+ await retain(capture, observer);
145
+ },
146
+ close() {
147
+ observer.disconnect();
148
+ capture.progress.write({ ...capture.progress.read(), closed: true });
149
+ }
150
+ };
151
+ }
152
+ //# sourceMappingURL=timeline-recording.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline-recording.js","sourceRoot":"","sources":["../../../../source/bench/timeline-recording.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,IAAI,eAAe,EACtC,WAAW,IAAI,kBAAkB,EAEpC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA2B,CAAC;AAMvE,OAAO,EACH,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EAC1B,MAAM,4CAAyD,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAoB,MAAM,sCAAoB,CAAC;AAEzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAsBlC,SAAS,OAAO,CAAC,OAAwB;IACrC,OAAO,kBAAkB,CAAC,GAAG,EAAE,GAAG,0BAA0B,GAAG,OAAO,CAAC,MAAM,CAAC;AAClF,CAAC;AAED,SAAS,MAAM,CAAC,OAAwB,EAAE,KAA6B;IACnE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzC,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO;IACX,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,sBAAsB,CAAC;IAC/E,IAAI,OAAO,CAAC,MA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AC,CAAC;QAC5B,CAAC;QACD,WAAW;YACP,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC;QAC3C,CAAC;QACD,UAAU,CAAC,KAAK,EAAE,MAAM;YACpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;YACnF,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;gBACpD,OAAO,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACzE,CAAC;QACL,CAAC;QACD,QAAQ;YACJ,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;QACD,KAAK,CAAC,MAAM;YACR,MAAM,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACpC,CAAC;QACD,KAAK;YACD,QAAQ,CAAC,UAAU,EAAE,CAAC;YACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACzE,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { BenchmarkTimelineReport } from '@overkill-dev/engine/engine/benchmark-timeline.d.ts';
2
+ import type { RunResult, PerTestResult } from '@overkill-dev/engine/engine/run-result.js';
3
+ export declare function readBenchmarkTimeline(result: RunResult, test: PerTestResult): BenchmarkTimelineReport | null;
4
+ //# sourceMappingURL=timeline-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline-report.d.ts","sourceRoot":"","sources":["../../../../source/bench/timeline-report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qDAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAe,MAAM,2CAAyB,CAAC;AAKrF,wBAwBgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,GAAG,uBAAuB,GAAG,IAAI,CAc5G"}
@@ -0,0 +1,41 @@
1
+ import { workIdentityKey } from "@overkill-dev/engine";
2
+ import { artifactReferenceKey } from "@overkill-dev/engine/engine/run-artifact.js";
3
+ import { benchmarkTimelineReportSchema } from "@overkill-dev/run/benchmark-calibration";
4
+ export const benchmarkTimelineMediaType = 'application/vnd.overkill.benchmark-timeline+json';
5
+ function assertOwner(artifact, test) {
6
+ if (artifact.id.scope.kind !== 'case' || artifact.id.attempt?.index !== test.attempts.at(-1)?.attempt.index) {
7
+ throw new Error('Timeline artifact belongs to another workload, runtime, case, or attempt.');
8
+ }
9
+ const work = {
10
+ familyVariant: artifact.id.familyVariant,
11
+ case: artifact.id.scope.case,
12
+ runtimes: artifact.id.runtimes,
13
+ workload: artifact.id.workload
14
+ };
15
+ if (workIdentityKey(work) !== workIdentityKey(test.workId)) {
16
+ throw new Error('Timeline artifact belongs to another workload, runtime, case, or attempt.');
17
+ }
18
+ }
19
+ function timelineContent(artifact) {
20
+ const { payload } = artifact;
21
+ if (payload.kind !== 'runtime-attachment' || payload.mediaType !== benchmarkTimelineMediaType) {
22
+ return null;
23
+ }
24
+ return payload.content.kind === 'json' ? benchmarkTimelineReportSchema.parse(payload.content.value) : null;
25
+ }
26
+ export function readBenchmarkTimeline(result, test) {
27
+ const reference = test.benchmark?.timeline?.reference ?? null;
28
+ if (reference === null) {
29
+ return null;
30
+ }
31
+ const key = artifactReferenceKey(JSON.parse(reference));
32
+ const artifact = result.artifacts.find(function matchingReference(candidate) {
33
+ return artifactReferenceKey(candidate.id) === key;
34
+ });
35
+ if (artifact === undefined) {
36
+ return null;
37
+ }
38
+ assertOwner(artifact, test);
39
+ return timelineContent(artifact);
40
+ }
41
+ //# sourceMappingURL=timeline-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline-report.js","sourceRoot":"","sources":["../../../../source/bench/timeline-report.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA2B,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAsB,CAAC;AAErE,MAAM,CAAC,MAAM,0BAA0B,GAAG,kDAAkD,CAAC;AAC7F,SAAS,WAAW,CAAC,QAAqB,EAAE,IAAmB;IAC3D,IAAI,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,KAAK,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;QAC1G,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;IACjG,CAAC;IACD,MAAM,IAAI,GAAG;QACT,aAAa,EAAE,QAAQ,CAAC,EAAE,CAAC,aAAa;QACxC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI;QAC5B,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ;QAC9B,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ;KACjC,CAAC;IACF,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;IACjG,CAAC;AACL,CAAC;AAED,SAAS,eAAe,CAAC,QAAqB;IAC1C,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IAC7B,IAAI,OAAO,CAAC,IAAI,KAAK,oBAAoB,IAAI,OAAO,CAAC,SAAS,KAAK,0BAA0B,EAAE,CAAC;QAC5F,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,6BAA6B,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/G,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,IAAmB;IACxE,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,IAAI,IAAI,CAAC;IAC9D,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,GAAG,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,iBAAiB,CAAC,SAAS;QACvE,OAAO,oBAAoB,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC;IACtD,CAAC,CAAC,CAAC;IACH,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC5B,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { ReadonlyDeep } from 'type-fest';
2
+ import type { WorkloadId } from '@overkill-dev/engine/engine/identity.js';
3
+ import { type WorkloadParameters } from '@overkill-dev/engine/engine/workload-parameters.js';
4
+ declare const workloadBrand: unique symbol;
5
+ export type Workload<Name extends string = string, Parameters extends WorkloadParameters = WorkloadParameters> = {
6
+ readonly [workloadBrand]: true;
7
+ readonly id: WorkloadId;
8
+ readonly name: Name;
9
+ readonly parameters: ReadonlyDeep<Parameters>;
10
+ };
11
+ export declare function workload<const Name extends string, const Parameters extends WorkloadParameters>(name: Name, parameters: Parameters): Workload<Name, Parameters>;
12
+ export {};
13
+ //# sourceMappingURL=workload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workload.d.ts","sourceRoot":"","sources":["../../../../source/bench/workload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAuB,CAAC;AAExD,OAAO,EAA8B,KAAK,kBAAkB,EAAE,MAAM,oDAAkC,CAAC;AAEvG,QAAA,MAAM,aAAa,eAA6C,CAAC;AAEjE,MAAM,MAAM,QAAQ,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,IAAI;IAC7G,QAAQ,CAAC,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;CACjD,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,CAAC,UAAU,SAAS,kBAAkB,EAC3F,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,GACvB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { workloadParameterIdentity } from "@overkill-dev/engine";
2
+ import { snapshotWorkloadParameters } from "@overkill-dev/engine";
3
+ const workloadBrand = Symbol.for('@overkill-dev/bench/Workload');
4
+ export function workload(name, parameters) {
5
+ if (typeof name !== 'string' || name.trim().length === 0 || /\p{Cc}/v.test(name)) {
6
+ throw new TypeError('Workload names must be non-empty strings without control characters.');
7
+ }
8
+ const snapshot = snapshotWorkloadParameters(parameters);
9
+ const result = {
10
+ [workloadBrand]: true,
11
+ id: Object.freeze({ name, params: workloadParameterIdentity(snapshot) }),
12
+ name,
13
+ parameters: snapshot
14
+ };
15
+ return Object.freeze(result);
16
+ }
17
+ export function workloadIdentity(work) {
18
+ return Object.freeze({ name: work.name, params: workloadParameterIdentity(work.parameters) });
19
+ }
20
+ //# sourceMappingURL=workload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workload.js","sourceRoot":"","sources":["../../../../source/bench/workload.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAA6B,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAA2B,MAAM,sBAAkC,CAAC;AAEvG,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAajE,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,UAAmB;IACtD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/E,MAAM,IAAI,SAAS,CAAC,sEAAsE,CAAC,CAAC;IAChG,CAAC;IACD,MAAM,QAAQ,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;IACxD,MAAM,MAAM,GAAa;QACrB,CAAC,aAAa,CAAC,EAAE,IAAI;QACrB,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,yBAAyB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxE,IAAI;QACJ,UAAU,EAAE,QAAQ;KACvB,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAID,MAAM,UAAU,gBAAgB,CAAC,IAA2B;IACxD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,yBAAyB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AAClG,CAAC"}
package/package.json CHANGED
@@ -3,7 +3,16 @@
3
3
  "bugs": {
4
4
  "url": "https://github.com/enormora/overkill/issues"
5
5
  },
6
- "description": "Ordinary test-node authoring for Overkill benchmark suites.",
6
+ "dependencies": {
7
+ "@enormora/clock": "0.0.3",
8
+ "@stdlib/stats-base-dists-binomial-quantile": "0.2.3",
9
+ "node-pty": "1.2.0-beta.17",
10
+ "simple-statistics": "8.0.0",
11
+ "tslib": "2.8.1",
12
+ "type-fest": "5.10.0",
13
+ "zod": "4.6.7"
14
+ },
15
+ "description": "Workload measurement and performance budgets for Overkill benchmark suites.",
7
16
  "engines": {
8
17
  "node": "^26.9.0"
9
18
  },
@@ -11,6 +20,10 @@
11
20
  ".": {
12
21
  "import": "./packages/bench/bench.entry-point.js",
13
22
  "types": "./packages/bench/bench.entry-point.d.ts"
23
+ },
24
+ "./calibration": {
25
+ "import": "./packages/bench/calibration.entry-point.js",
26
+ "types": "./packages/bench/calibration.entry-point.d.ts"
14
27
  }
15
28
  },
16
29
  "homepage": "https://github.com/enormora/overkill#readme",
@@ -22,19 +35,42 @@
22
35
  "license": "MIT",
23
36
  "name": "@overkill-dev/bench",
24
37
  "peerDependencies": {
25
- "@overkill-dev/engine": "0.0.51",
26
- "@overkill-dev/resources": "0.0.12",
27
- "@overkill-dev/run": "0.0.67"
38
+ "@overkill-dev/engine": "0.0.78",
39
+ "@overkill-dev/resources": "0.0.21",
40
+ "@overkill-dev/run": "0.0.99"
28
41
  },
29
42
  "repository": {
30
43
  "type": "git",
31
44
  "url": "git+https://github.com/enormora/overkill.git"
32
45
  },
33
46
  "sideEffects": [
47
+ "./bench/benchmark-budget-definition.js",
48
+ "./bench/benchmark-lifecycle-policy.js",
49
+ "./bench/benchmark-normalization.js",
50
+ "./bench/benchmark-observations.js",
51
+ "./bench/cpu-calibration.js",
52
+ "./bench/default-normalization.js",
53
+ "./bench/measurement-contract-error.js",
54
+ "./bench/module-import-session.js",
55
+ "./bench/process-command.js",
56
+ "./bench/process-deadline.js",
57
+ "./bench/process-evidence.js",
58
+ "./bench/process-measurement.js",
59
+ "./bench/process-node-readings.js",
60
+ "./bench/process-observation.js",
61
+ "./bench/process-protocol.js",
62
+ "./bench/process-script.js",
63
+ "./bench/process-timeline.js",
64
+ "./bench/sampling-policy.js",
65
+ "./bench/timeline-context.js",
66
+ "./bench/workload.js",
67
+ "./packages/bench/module-import.entry-point.js",
68
+ "./packages/bench/process-helper.entry-point.js",
69
+ "./packages/bench/process-node-probe.entry-point.js",
34
70
  "./packages/test/authoring-source-locations.js",
35
71
  "./packages/test/authoring-test-data.js",
36
72
  "./packages/test/resource-wrapper-composition.js"
37
73
  ],
38
74
  "type": "module",
39
- "version": "0.0.5"
75
+ "version": "0.0.7"
40
76
  }
@@ -1,5 +1,38 @@
1
+ export { workload } from '../../bench/workload.ts';
2
+ export { processMeasurement } from '../../bench/process-measurement.ts';
3
+ export { moduleMeasurement } from '../../bench/module-measurement.ts';
4
+ export type { ModuleMeasurementStrategy, ModuleImportRequest, ModuleSample, MeasuredModuleImport } from '../../bench/module-measurement.ts';
5
+ export type { ProcessInstrumentation, ProcessMeasurementStrategy, ProcessSample } from '../../bench/process-measurement.ts';
6
+ export type { ProcessRequest } from '../../bench/process-command.ts';
7
+ export type { ProcessCompletion, ProcessMarker, ProcessStep } from '../../bench/process-script.ts';
8
+ export type { MeasuredProcess, ProcessObservation } from '../../bench/process-observation.ts';
9
+ export type { Workload } from '../../bench/workload.ts';
10
+ export type { WorkloadParameters } from '@overkill-dev/engine/engine/workload-parameters.js';
1
11
  export { defineMacro, defineParameterizedTestBody, skippedTest, suite, table, test } from '../../authoring/test-node-authoring.ts';
2
12
  export type { AuthoringAnnotations, AuthoringControls } from '../test/authoring-test-data.ts';
3
13
  export type { ParameterizedTestScope, TableDefinition, TableTestBody } from '../test/table-authoring.ts';
4
14
  export type { Suite, Table, TestBody, TestCase, TestNode, TestScope, TestScopeAssertContext } from '@overkill-dev/engine';
15
+ export { benchmark } from '../../bench/benchmark-authoring.ts';
16
+ export { defaultSamplingPolicy } from '../../bench/sampling-policy.ts';
17
+ export { measurementStrategy, asyncMeasurementStrategy, wallClockMeasurement } from '../../bench/measurement-strategy.ts';
18
+ export { memoryCollector, processCpuCollector, processResourceCollector, threadCpuCollector } from '../../bench/native-metric-collectors.ts';
19
+ export { runtimeHealthCollector } from '../../bench/runtime-health-collector.ts';
20
+ export { availableMetric, unavailableMetric } from '../../bench/metric-reading.ts';
21
+ export type { BenchmarkDefinition, BenchmarkKind, BenchmarkMeasureContext, BenchmarkMetrics, BenchmarkOptions, BenchmarkSample } from '../../bench/benchmark-definition.ts';
22
+ export type { MetricBudget, BudgetThreshold } from '../../bench/benchmark-budget-definition.ts';
23
+ export type { AsyncCollectorSession, AsyncMeasurementSample, AsyncMeasurementStrategy, AsyncMetricCollector, CollectorSession, Measured, MeasurementSample, MeasurementStrategy, MetricCollector, MetricDeclaration, MetricReadings } from '../../bench/measurement-types.ts';
24
+ export type { BenchmarkGarbageCollectionPolicy, BenchmarkGarbageCollectionRequest, BenchmarkGarbageCollectionResult, ResolvedBenchmarkLifecyclePolicy, BenchmarkCooldownPolicy, BenchmarkCooldownResult, BenchmarkLifecyclePolicy, BenchmarkLifecycleResult, BenchmarkExecutionResult, BudgetStatistic, MetricProvenance, MetricReading, SamplingPolicy } from '@overkill-dev/engine/engine/benchmark-result.js';
25
+ export { defaultBenchmarkLifecyclePolicy, defaultRuntimeCooldownPolicy } from '../../bench/benchmark-lifecycle-policy.ts';
26
+ export { calibratedMeasurement, rawMeasurement } from '../../bench/calibrated-measurement.ts';
27
+ export { cpuCalibration } from '../../bench/cpu-calibration.ts';
28
+ export { defineCalibrationResource } from '../../bench/calibration-resource.ts';
29
+ export type { MetricNormalization, CalibrationResource, CalibrationOptions, CalibrationDefinition, CalibrationMeasureContext } from '../../bench/calibration-definition.ts';
30
+ export type { CalibratedMeasurement } from '../../bench/calibrated-measurement.ts';
31
+ export type { CalibrationSnapshot, CalibrationResult, BenchmarkNormalizationEvidence } from '@overkill-dev/engine/engine/benchmark-result.js';
32
+ export { readCalibrationReferenceReport } from '@overkill-dev/run/benchmark-calibration';
33
+ export type { CalibrationReferenceReport } from '@overkill-dev/run/benchmark-calibration';
34
+ export { timelineMeasurement } from '../../bench/timeline-measurement.ts';
35
+ export type { TimelineMeasurement } from '../../bench/timeline-measurement.ts';
36
+ export { readBenchmarkTimeline } from '../../bench/timeline-report.ts';
37
+ export type { BenchmarkTimeline, BenchmarkTimelinePolicy, BenchmarkTimelineEvent, BenchmarkTimelineEvidence, BenchmarkTimelineReport } from '@overkill-dev/engine/engine/benchmark-timeline.d.ts';
5
38
  //# sourceMappingURL=bench.entry-point.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bench.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/bench/bench.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,2BAA2B,EAC3B,WAAW,EACX,KAAK,EACL,KAAK,EACL,IAAI,EACP,MAAM,wCAAwC,CAAC;AAChD,YAAY,EACR,oBAAoB,EACpB,iBAAiB,EACpB,MAAM,gCAAgC,CAAC;AACxC,YAAY,EACR,sBAAsB,EACtB,eAAe,EACf,aAAa,EAChB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACR,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,sBAAsB,EACzB,MAAM,sBAAiC,CAAC"}
1
+ {"version":3,"file":"bench.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/bench/bench.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,M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,EAAE,MAAM,qCAAqC,CAAC;AAC1E,YAAY,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,YAAY,EACR,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EAC1B,MAAM,qDAAoC,CAAC"}
@@ -1,2 +1,18 @@
1
+ export { workload } from "../../bench/workload.js";
2
+ export { processMeasurement } from "../../bench/process-measurement.js";
3
+ export { moduleMeasurement } from "../../bench/module-measurement.js";
1
4
  export { defineMacro, defineParameterizedTestBody, skippedTest, suite, table, test } from "../../authoring/test-node-authoring.js";
5
+ export { benchmark } from "../../bench/benchmark-authoring.js";
6
+ export { defaultSamplingPolicy } from "../../bench/sampling-policy.js";
7
+ export { measurementStrategy, asyncMeasurementStrategy, wallClockMeasurement } from "../../bench/measurement-strategy.js";
8
+ export { memoryCollector, processCpuCollector, processResourceCollector, threadCpuCollector } from "../../bench/native-metric-collectors.js";
9
+ export { runtimeHealthCollector } from "../../bench/runtime-health-collector.js";
10
+ export { availableMetric, unavailableMetric } from "../../bench/metric-reading.js";
11
+ export { defaultBenchmarkLifecyclePolicy, defaultRuntimeCooldownPolicy } from "../../bench/benchmark-lifecycle-policy.js";
12
+ export { calibratedMeasurement, rawMeasurement } from "../../bench/calibrated-measurement.js";
13
+ export { cpuCalibration } from "../../bench/cpu-calibration.js";
14
+ export { defineCalibrationResource } from "../../bench/calibration-resource.js";
15
+ export { readCalibrationReferenceReport } from "@overkill-dev/run/benchmark-calibration";
16
+ export { timelineMeasurement } from "../../bench/timeline-measurement.js";
17
+ export { readBenchmarkTimeline } from "../../bench/timeline-report.js";
2
18
  //# sourceMappingURL=bench.entry-point.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bench.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/bench/bench.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,2BAA2B,EAC3B,WAAW,EACX,KAAK,EACL,KAAK,EACL,IAAI,EACP,MAAM,wCAAwC,CAAC"}
1
+ {"version":3,"file":"bench.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/bench/bench.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAiBtE,OAAO,EACH,WAAW,EACX,2BAA2B,EAC3B,WAAW,EACX,KAAK,EACL,KAAK,EACL,IAAI,EACP,MAAM,wCAAwC,CAAC;AAmBhD,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EACH,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EACrB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAuCnF,OAAO,EACH,+BAA+B,EAC/B,4BAA4B,EAC/B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAehF,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAA6C,CAAC;AAE7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { calibrateBenchmarkHost, normalizeBenchmarkDuration } from '@overkill-dev/run/benchmark-calibration';
2
+ export type { BenchmarkCalibrationResult, ComparableCalibration } from '@overkill-dev/run/benchmark-calibration';
3
+ export { cpuCalibration } from '../../bench/cpu-calibration.ts';
4
+ export { defineCalibrationResource } from '../../bench/calibration-resource.ts';
5
+ export type { CalibrationResource, CalibrationOptions, CalibrationDefinition, CalibrationMeasureContext } from '../../bench/calibration-definition.ts';
6
+ export type { CalibrationSnapshot, CalibrationResult } from '@overkill-dev/engine/engine/benchmark-result.js';
7
+ export { readCalibrationReferenceReport } from '@overkill-dev/run/benchmark-calibration';
8
+ export type { CalibrationReferenceReport } from '@overkill-dev/run/benchmark-calibration';
9
+ //# sourceMappingURL=calibration.entry-point.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calibration.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/bench/calibration.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,yCAA6C,CAAC;AACjH,YAAY,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,yCAA6C,CAAC;AAErH,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,YAAY,EACR,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,yBAAyB,EAC5B,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,iDAAkC,CAAC;AAE/F,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAA6C,CAAC;AAC7F,YAAY,EAAE,0BAA0B,EAAE,MAAM,yCAA6C,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { calibrateBenchmarkHost, normalizeBenchmarkDuration } from "@overkill-dev/run/benchmark-calibration";
2
+ export { cpuCalibration } from "../../bench/cpu-calibration.js";
3
+ export { defineCalibrationResource } from "../../bench/calibration-resource.js";
4
+ export { readCalibrationReferenceReport } from "@overkill-dev/run/benchmark-calibration";
5
+ //# sourceMappingURL=calibration.entry-point.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calibration.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/bench/calibration.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,yCAA6C,CAAC;AAGjH,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAShF,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAA6C,CAAC"}
@@ -0,0 +1,81 @@
1
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
+ });
6
+ }
7
+ return path;
8
+ };
9
+ import { once } from 'node:events';
10
+ import { connect } from 'node:net';
11
+ import { fileURLToPath } from 'node:url';
12
+ export const moduleImportEntryPointUrl = new URL(import.meta.url);
13
+ const maximumCommandBytes = 32;
14
+ const argumentOffset = 2;
15
+ const nanosecondsPerMicrosecond = 1000;
16
+ async function receiveImportCommand(socket) {
17
+ let command = '';
18
+ const chunks = socket.iterator({ destroyOnReturn: false });
19
+ for await (const chunk of chunks) {
20
+ command += String(chunk);
21
+ if (command === 'import\n') {
22
+ return;
23
+ }
24
+ if (command.length > maximumCommandBytes) {
25
+ throw new Error('Invalid module import command.');
26
+ }
27
+ }
28
+ throw new Error('Module import owner disconnected before its command.');
29
+ }
30
+ async function measuredImport(url) {
31
+ const started = process.hrtime.bigint();
32
+ let failure = null;
33
+ try {
34
+ await import(__rewriteRelativeImportExtension(url));
35
+ }
36
+ catch (error) {
37
+ failure = error instanceof Error ? error.message : String(error);
38
+ }
39
+ return { durationMicroseconds: Number(process.hrtime.bigint() - started) / nanosecondsPerMicrosecond, failure };
40
+ }
41
+ async function flushOutput(stream) {
42
+ await new Promise(function flushed(resolve, reject) {
43
+ stream.write('', function written(error) {
44
+ if (error !== null && error !== undefined) {
45
+ reject(error);
46
+ }
47
+ else {
48
+ resolve();
49
+ }
50
+ });
51
+ });
52
+ }
53
+ async function importRequestedModule(port, token, url) {
54
+ const socket = connect({ host: '127.0.0.1', port });
55
+ await once(socket, 'connect');
56
+ socket.write(`${JSON.stringify({ kind: 'ready', token })}\n`);
57
+ await receiveImportCommand(socket);
58
+ const measured = await measuredImport(url);
59
+ const report = {
60
+ kind: 'imported',
61
+ token,
62
+ url,
63
+ ...measured,
64
+ nodeVersion: process.versions.node,
65
+ nodeArguments: process.execArgv
66
+ };
67
+ await Promise.all([flushOutput(process.stdout), flushOutput(process.stderr)]);
68
+ await new Promise(function reported(resolve) {
69
+ socket.end(`${JSON.stringify(report)}\n`, resolve);
70
+ });
71
+ // eslint-disable-next-line node/no-process-exit, unicorn/no-process-exit -- Imported modules may leave handles open; this isolated child exits after reporting.
72
+ process.exit(measured.failure === null ? 0 : 1);
73
+ }
74
+ if (process.argv[1] === fileURLToPath(moduleImportEntryPointUrl)) {
75
+ const [port, token, url] = process.argv.slice(argumentOffset);
76
+ if (port === undefined || token === undefined || url === undefined) {
77
+ throw new TypeError('Module import requires a port, token, and file URL.');
78
+ }
79
+ await importRequestedModule(Number(port), token, url);
80
+ }
81
+ //# sourceMappingURL=module-import.entry-point.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-import.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/bench/module-import.entry-point.ts"],"names":[],"mappings":";;;;;;;;AAA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CAAE,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAE,CAAC,CAAC;IAChF,MAAM,IAAI,OAAO,CAAO,SAAS,QAAQ,CAAC,OAAO;QAC7C,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,gKAAgK;IAChK,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,yBAAyB,CAAC,EAAE,CAAC;IAC/D,MAAM,CAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAChE,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACjE,MAAM,IAAI,SAAS,CAAC,qDAAqD,CAAC,CAAC;IAC/E,CAAC;IACD,MAAM,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,84 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { withProcessTimeline } from "../../bench/process-timeline.js";
3
+ import { createStoredValue } from "@overkill-dev/engine/stored-value.js";
4
+ import { executeProcessCommand } from "../../bench/process-execution.js";
5
+ import { processHelperRequestSchema } from "../../bench/process-protocol.js";
6
+ export const processHelperEntryPointUrl = new URL(import.meta.url);
7
+ function sendReply(reply) {
8
+ if (process.connected) {
9
+ process.send?.(reply, function disconnectMissingOwner(error) {
10
+ if (error !== null && process.connected) {
11
+ process.disconnect?.();
12
+ }
13
+ });
14
+ }
15
+ }
16
+ async function shutdownHost(host) {
17
+ host.controller.read()?.abort(new Error('Process helper owner disconnected.'));
18
+ await host.running.read();
19
+ process.removeAllListeners('message');
20
+ process.removeAllListeners('disconnect');
21
+ if (process.connected) {
22
+ process.disconnect?.();
23
+ }
24
+ }
25
+ async function executeRequestedCommand(message, signal) {
26
+ const record = message.timeline
27
+ ? function checkpoint(value) {
28
+ sendReply({ ...value, kind: 'checkpoint', id: message.id });
29
+ }
30
+ : null;
31
+ return await withProcessTimeline(record, async function runCommand() {
32
+ return await executeProcessCommand({
33
+ ...message,
34
+ signal,
35
+ environment: process.env,
36
+ started(pid) {
37
+ sendReply({ kind: 'started', id: message.id, pid });
38
+ }
39
+ });
40
+ });
41
+ }
42
+ async function executeHostedCommand(host, message, signal) {
43
+ try {
44
+ const execution = await executeRequestedCommand(message, signal);
45
+ sendReply({ kind: 'complete', id: message.id, execution });
46
+ }
47
+ finally {
48
+ host.running.write(null);
49
+ host.controller.write(null);
50
+ }
51
+ }
52
+ function receiveHostCommand(host, message) {
53
+ if (message.kind === 'close') {
54
+ host.running.write(shutdownHost(host));
55
+ }
56
+ else if (message.kind === 'cancel') {
57
+ host.controller.read()?.abort(new Error('Process sample was cancelled.'));
58
+ }
59
+ else {
60
+ if (host.running.read() !== null) {
61
+ throw new Error('Process helper received overlapping invocations.');
62
+ }
63
+ const controller = new AbortController();
64
+ host.controller.write(controller);
65
+ host.running.write(executeHostedCommand(host, message, controller.signal));
66
+ }
67
+ }
68
+ function startProcessHost() {
69
+ const host = {
70
+ running: createStoredValue(null),
71
+ controller: createStoredValue(null)
72
+ };
73
+ process.once('disconnect', function () {
74
+ host.running.write(shutdownHost(host));
75
+ });
76
+ process.on('message', function (value) {
77
+ receiveHostCommand(host, processHelperRequestSchema.parse(value));
78
+ });
79
+ sendReply({ kind: 'ready', version: 1 });
80
+ }
81
+ if (process.argv[1] === fileURLToPath(processHelperEntryPointUrl)) {
82
+ startProcessHost();
83
+ }
84
+ //# sourceMappingURL=process-helper.entry-point.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-helper.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/bench/process-helper.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAA0B,MAAM,iCAAiC,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAoB,MAAM,sCAAuB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EACH,0BAA0B,EAI7B,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAOnE,SAAS,SAAS,CAAC,KAAyB;IACxC,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,sBAAsB,CAAC,KAAK;YACvD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;gBACtC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;YAC3B,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,IAAiB;IACzC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC;IAC/E,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAC1B,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACtC,OAAO,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACpB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;IAC3B,CAAC;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