@overkill-dev/bench 0.0.12 → 0.0.14

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 (105) hide show
  1. package/bench/async-measurement-resources.js +123 -0
  2. package/bench/async-measurement-resources.js.map +1 -0
  3. package/bench/benchmark-budget-definition.d.ts +1 -1
  4. package/bench/benchmark-budget-definition.d.ts.map +1 -1
  5. package/bench/benchmark-definition.d.ts +2 -1
  6. package/bench/benchmark-definition.d.ts.map +1 -1
  7. package/bench/benchmark-garbage-collection.js +5 -7
  8. package/bench/benchmark-garbage-collection.js.map +1 -1
  9. package/bench/benchmark-lifecycle-policy.d.ts +1 -1
  10. package/bench/benchmark-lifecycle-policy.d.ts.map +1 -1
  11. package/bench/benchmark-lifecycle.js +13 -5
  12. package/bench/benchmark-lifecycle.js.map +1 -1
  13. package/bench/benchmark-observation-set.js.map +1 -1
  14. package/bench/benchmark-observations.js +14 -1
  15. package/bench/benchmark-observations.js.map +1 -1
  16. package/bench/benchmark-sample-lifetime.js +31 -9
  17. package/bench/benchmark-sample-lifetime.js.map +1 -1
  18. package/bench/benchmark-sampling-evidence.js +6 -3
  19. package/bench/benchmark-sampling-evidence.js.map +1 -1
  20. package/bench/benchmark-sampling.js +1 -1
  21. package/bench/benchmark-sampling.js.map +1 -1
  22. package/bench/calibrated-measurement.d.ts.map +1 -1
  23. package/bench/calibrated-measurement.js +4 -1
  24. package/bench/calibrated-measurement.js.map +1 -1
  25. package/bench/calibration-definition.d.ts +2 -1
  26. package/bench/calibration-definition.d.ts.map +1 -1
  27. package/bench/calibration-observations.js.map +1 -1
  28. package/bench/calibration-sampling.js +1 -1
  29. package/bench/calibration-sampling.js.map +1 -1
  30. package/bench/collector-lifetime.js +108 -0
  31. package/bench/collector-lifetime.js.map +1 -0
  32. package/bench/collector-result.js +39 -0
  33. package/bench/collector-result.js.map +1 -0
  34. package/bench/default-normalization.js +4 -0
  35. package/bench/default-normalization.js.map +1 -1
  36. package/bench/measurement-attribution.js +18 -0
  37. package/bench/measurement-attribution.js.map +1 -0
  38. package/bench/measurement-context.js +32 -0
  39. package/bench/measurement-context.js.map +1 -0
  40. package/bench/measurement-definition.d.ts.map +1 -1
  41. package/bench/measurement-definition.js +10 -0
  42. package/bench/measurement-definition.js.map +1 -1
  43. package/bench/measurement-evidence.js +69 -0
  44. package/bench/measurement-evidence.js.map +1 -0
  45. package/bench/measurement-region-lifetime.js +47 -0
  46. package/bench/measurement-region-lifetime.js.map +1 -0
  47. package/bench/measurement-region-readings.js +25 -0
  48. package/bench/measurement-region-readings.js.map +1 -0
  49. package/bench/measurement-region.js +49 -80
  50. package/bench/measurement-region.js.map +1 -1
  51. package/bench/measurement-resources.js +79 -88
  52. package/bench/measurement-resources.js.map +1 -1
  53. package/bench/measurement-shutdown.js +58 -0
  54. package/bench/measurement-shutdown.js.map +1 -0
  55. package/bench/measurement-strategy.d.ts.map +1 -1
  56. package/bench/measurement-strategy.js +2 -1
  57. package/bench/measurement-strategy.js.map +1 -1
  58. package/bench/measurement-target-cooldown.js +21 -0
  59. package/bench/measurement-target-cooldown.js.map +1 -0
  60. package/bench/measurement-target.d.ts +36 -0
  61. package/bench/measurement-target.d.ts.map +1 -0
  62. package/bench/measurement-target.js +94 -0
  63. package/bench/measurement-target.js.map +1 -0
  64. package/bench/measurement-types.d.ts +37 -11
  65. package/bench/measurement-types.d.ts.map +1 -1
  66. package/bench/metric-reading.d.ts +1 -1
  67. package/bench/metric-reading.d.ts.map +1 -1
  68. package/bench/module-import-session.js +41 -10
  69. package/bench/module-import-session.js.map +1 -1
  70. package/bench/module-measurement.d.ts +1 -1
  71. package/bench/module-measurement.d.ts.map +1 -1
  72. package/bench/native-metric-collectors.d.ts.map +1 -1
  73. package/bench/native-metric-collectors.js +21 -23
  74. package/bench/native-metric-collectors.js.map +1 -1
  75. package/bench/process-child.js +78 -54
  76. package/bench/process-child.js.map +1 -1
  77. package/bench/process-evidence.js +2 -16
  78. package/bench/process-evidence.js.map +1 -1
  79. package/bench/process-execution.js +19 -9
  80. package/bench/process-execution.js.map +1 -1
  81. package/bench/process-helper.js +29 -13
  82. package/bench/process-helper.js.map +1 -1
  83. package/bench/process-node-observation.js +33 -14
  84. package/bench/process-node-observation.js.map +1 -1
  85. package/bench/process-observation.d.ts +16 -16
  86. package/bench/process-probe-report.js +53 -40
  87. package/bench/process-probe-report.js.map +1 -1
  88. package/bench/process-probe-session.js +18 -7
  89. package/bench/process-probe-session.js.map +1 -1
  90. package/bench/process-sampling.js +7 -3
  91. package/bench/process-sampling.js.map +1 -1
  92. package/bench/runtime-health-collector.d.ts.map +1 -1
  93. package/bench/runtime-health-collector.js +20 -22
  94. package/bench/runtime-health-collector.js.map +1 -1
  95. package/bench/sampling-policy.d.ts +1 -1
  96. package/bench/sampling-policy.d.ts.map +1 -1
  97. package/package.json +8 -4
  98. package/packages/bench/bench.entry-point.d.ts +9 -2
  99. package/packages/bench/bench.entry-point.d.ts.map +1 -1
  100. package/packages/bench/bench.entry-point.js +2 -0
  101. package/packages/bench/bench.entry-point.js.map +1 -1
  102. package/packages/bench/calibration.entry-point.d.ts +1 -1
  103. package/packages/bench/calibration.entry-point.d.ts.map +1 -1
  104. package/readme.md +54 -11
  105. package/software-bill-of-materials.cyclonedx.json +19 -19
package/readme.md CHANGED
@@ -161,10 +161,55 @@ resource acquisition, and teardown are outside the measured callback.
161
161
  Built-in collectors are `threadCpuCollector`, `processCpuCollector`,
162
162
  `memoryCollector`, `processResourceCollector`, and `runtimeHealthCollector`.
163
163
  Runtime health needs an async strategy to prime and drain its observers.
164
- Custom collectors declare identity, metric names, units, and scopes, then
165
- return a session with `start`, `stop`, `complete`, and `dispose`. Start and stop
166
- are synchronous boundaries. Completed readings use `availableMetric` or
167
- `unavailableMetric`. Returned plain numbers are custom metrics with unit `number`.
164
+ Custom collectors declare `name`, `version`, `mode`, and metric names, units,
165
+ and scopes. `prepare(context)` acknowledges readiness and returns `start`,
166
+ `stop`, and `finalize`. Register allocation release with
167
+ `context.cleanup.defer(signal => ...)` before acquisition can fail. The harness
168
+ releases registered allocations in reverse order, including partial preparation.
169
+ Collectors release their own allocations; shared resources keep their declared lifetime.
170
+
171
+ `finalize(context)` returns `context.readings(metricReadings)`. This binds the
172
+ readings to their invocation and target. For incomplete capture, return the same
173
+ envelope with `completeness: { kind: 'incomplete', reasons: [...] }`.
174
+ Missing or incomplete readings remain unavailable; required metrics cannot pass
175
+ budgets. Available readings must match the collector's declared provenance.
176
+
177
+ Synchronous collectors keep every lifecycle hook synchronous. Async collectors
178
+ may await preparation, start, stop, and finalization. All starts complete before
179
+ the operation. The harness stops started sessions and finalizes prepared sessions
180
+ once, then releases allocations, preserving operation and shutdown failures together.
181
+ Cancellation uses a fresh cleanup signal. Stop, finalization, and release share
182
+ one two-second deadline per invocation; late results cannot enter another sample.
183
+ Synchronous hooks cannot be forcibly preempted within their executing thread.
184
+
185
+ `withMeasurementTarget(target, strategy)` selects a `MeasurementTarget` for
186
+ sync or async strategies. It supplies a synchronous local monotonic clock and
187
+ explicit cooldown and GC capabilities. Its identity declares name, version,
188
+ scope, clock domain, and semantic facts such as instrumentation, endpoints, and
189
+ reset/cache policy. Instance and document identities attribute concrete readings;
190
+ they do not enter comparison identity. Both clock endpoints must use that target's
191
+ clock domain. Cross-clock subtraction and automatic host timing substitution are
192
+ unsupported.
193
+
194
+ Without an explicit target, function regions measure the executing Node runtime.
195
+ Requested cooldown or GC must exist on the selected target before warmup starts.
196
+ External-process and cold-module strategies reject requested target settling or
197
+ GC because their measured processes do not expose those capabilities. Explicit
198
+ GC remains off by default; ambient host exposure does not enable it.
199
+
200
+ Targets with `normalization: 'raw'` receive no default CPU calibration. Select
201
+ `'node-cpu'` only for a target compatible with that calibration model. Target
202
+ selection survives raw, calibrated, and timeline wrappers.
203
+
204
+ Lifecycle evidence records warmup/measured invocation identity, collector
205
+ completeness, target facts, errors, and separate measured/lifecycle durations.
206
+ Raw sample attachments use version 1 envelopes with per-reading invocation
207
+ and target attribution. Use `readRawBenchmarkSamples(value)` to read them.
208
+ Saved performance baselines use version 1 and key stable target and collector
209
+ facts separately from instance IDs. Use `overkill bench baseline apply` to
210
+ replace baselines whose measurement identity changed. Earlier development
211
+ formats require regeneration.
212
+ Returned plain numbers remain custom metrics with unit `number`.
168
213
 
169
214
  CPU metrics are deltas in microseconds. Memory metrics include end snapshots
170
215
  and signed byte deltas; RSS and active resource counts describe the process,
@@ -479,11 +524,10 @@ in the snapshot belong to that observer; execution host arguments retain their
479
524
  ordinary execution facts.
480
525
 
481
526
  `RunFacts.benchmarkHost` contains the snapshot, configured limits, and check
482
- results. Version 4 `benchmark-run` artifacts retain host evidence, the nullable
483
- `placement` decision, and normalization inputs for JSON and HTML reporting.
484
- Versions 1 through 3 remain readable with `normalization: null`. Versions 1 and 2
485
- also use `placement: null`; version 1 uses `host: null`. Host observations are separate from
486
- `RunFacts.benchmarkCalibration`, which retains the legacy adapter CPU reference.
527
+ results. Reporter `RunReport.context.facts` provides the same host, placement,
528
+ and normalization context. `RunFacts.benchmarkCalibration` retains the adapter CPU
529
+ reference. These describe execution of the consumer's benchmark workload;
530
+ they do not measure Overkill's own performance.
487
531
  The snapshot describes its recorded moment; collection and fixture startup may
488
532
  change conditions afterward. Sampling does not recheck host conditions.
489
533
 
@@ -600,8 +644,7 @@ Inference retains the independent, stationary observation assumption.
600
644
 
601
645
  Results retain raw summaries, calibration samples, reference selection, factors,
602
646
  normalized summaries, and converted display budgets. JSON and HTML preserve both
603
- scales. `RunFacts.benchmarkNormalization` and version 4 `benchmark-run` artifacts
604
- record reference inputs; older artifacts remain readable. Direct engine execution
647
+ scales. `RunFacts.benchmarkNormalization` records reference inputs. Direct engine execution
605
648
  also supplies automatic calibration context.
606
649
 
607
650
  Capture and baseline cleanup emit a `calibration-references` report, readable with
@@ -16,9 +16,9 @@
16
16
  "component": {
17
17
  "type": "library",
18
18
  "name": "@overkill-dev/bench",
19
- "version": "0.0.12",
20
- "bom-ref": "pkg:npm/@overkill-dev/bench@0.0.12",
21
- "purl": "pkg:npm/@overkill-dev/bench@0.0.12"
19
+ "version": "0.0.14",
20
+ "bom-ref": "pkg:npm/@overkill-dev/bench@0.0.14",
21
+ "purl": "pkg:npm/@overkill-dev/bench@0.0.14"
22
22
  }
23
23
  },
24
24
  "components": [
@@ -38,41 +38,41 @@
38
38
  {
39
39
  "type": "library",
40
40
  "name": "@overkill-dev/engine",
41
- "version": "0.0.82",
42
- "bom-ref": "pkg:npm/@overkill-dev/engine@0.0.82",
41
+ "version": "0.0.84",
42
+ "bom-ref": "pkg:npm/@overkill-dev/engine@0.0.84",
43
43
  "scope": "optional",
44
44
  "licenses": [
45
45
  {
46
46
  "expression": "MIT"
47
47
  }
48
48
  ],
49
- "purl": "pkg:npm/@overkill-dev/engine@0.0.82"
49
+ "purl": "pkg:npm/@overkill-dev/engine@0.0.84"
50
50
  },
51
51
  {
52
52
  "type": "library",
53
53
  "name": "@overkill-dev/resources",
54
- "version": "0.0.25",
55
- "bom-ref": "pkg:npm/@overkill-dev/resources@0.0.25",
54
+ "version": "0.0.27",
55
+ "bom-ref": "pkg:npm/@overkill-dev/resources@0.0.27",
56
56
  "scope": "optional",
57
57
  "licenses": [
58
58
  {
59
59
  "expression": "MIT"
60
60
  }
61
61
  ],
62
- "purl": "pkg:npm/@overkill-dev/resources@0.0.25"
62
+ "purl": "pkg:npm/@overkill-dev/resources@0.0.27"
63
63
  },
64
64
  {
65
65
  "type": "library",
66
66
  "name": "@overkill-dev/run",
67
- "version": "0.0.104",
68
- "bom-ref": "pkg:npm/@overkill-dev/run@0.0.104",
67
+ "version": "0.0.106",
68
+ "bom-ref": "pkg:npm/@overkill-dev/run@0.0.106",
69
69
  "scope": "optional",
70
70
  "licenses": [
71
71
  {
72
72
  "expression": "MIT"
73
73
  }
74
74
  ],
75
- "purl": "pkg:npm/@overkill-dev/run@0.0.104"
75
+ "purl": "pkg:npm/@overkill-dev/run@0.0.106"
76
76
  },
77
77
  {
78
78
  "type": "library",
@@ -158,12 +158,12 @@
158
158
  "ref": "pkg:npm/@enormora/clock@0.0.3"
159
159
  },
160
160
  {
161
- "ref": "pkg:npm/@overkill-dev/bench@0.0.12",
161
+ "ref": "pkg:npm/@overkill-dev/bench@0.0.14",
162
162
  "dependsOn": [
163
163
  "pkg:npm/@enormora/clock@0.0.3",
164
- "pkg:npm/@overkill-dev/engine@0.0.82",
165
- "pkg:npm/@overkill-dev/resources@0.0.25",
166
- "pkg:npm/@overkill-dev/run@0.0.104",
164
+ "pkg:npm/@overkill-dev/engine@0.0.84",
165
+ "pkg:npm/@overkill-dev/resources@0.0.27",
166
+ "pkg:npm/@overkill-dev/run@0.0.106",
167
167
  "pkg:npm/@stdlib/stats-base-dists-binomial-quantile@0.2.3",
168
168
  "pkg:npm/node-pty@1.2.0-beta.17",
169
169
  "pkg:npm/simple-statistics@8.0.0",
@@ -173,13 +173,13 @@
173
173
  ]
174
174
  },
175
175
  {
176
- "ref": "pkg:npm/@overkill-dev/engine@0.0.82"
176
+ "ref": "pkg:npm/@overkill-dev/engine@0.0.84"
177
177
  },
178
178
  {
179
- "ref": "pkg:npm/@overkill-dev/resources@0.0.25"
179
+ "ref": "pkg:npm/@overkill-dev/resources@0.0.27"
180
180
  },
181
181
  {
182
- "ref": "pkg:npm/@overkill-dev/run@0.0.104"
182
+ "ref": "pkg:npm/@overkill-dev/run@0.0.106"
183
183
  },
184
184
  {
185
185
  "ref": "pkg:npm/@stdlib/stats-base-dists-binomial-quantile@0.2.3"