@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.
- package/bench/benchmark-authoring.d.ts +10 -0
- package/bench/benchmark-authoring.d.ts.map +1 -0
- package/bench/benchmark-authoring.js +29 -0
- package/bench/benchmark-authoring.js.map +1 -0
- package/bench/benchmark-budget-definition.d.ts +19 -0
- package/bench/benchmark-budget-definition.d.ts.map +1 -0
- package/bench/benchmark-budget-definition.js +44 -0
- package/bench/benchmark-budget-definition.js.map +1 -0
- package/bench/benchmark-budget-evaluation.js +34 -0
- package/bench/benchmark-budget-evaluation.js.map +1 -0
- package/bench/benchmark-budget.js +123 -0
- package/bench/benchmark-budget.js.map +1 -0
- package/bench/benchmark-definition-resolution.js +93 -0
- package/bench/benchmark-definition-resolution.js.map +1 -0
- package/bench/benchmark-definition.d.ts +45 -0
- package/bench/benchmark-definition.d.ts.map +1 -0
- package/bench/benchmark-execution-context.js +35 -0
- package/bench/benchmark-execution-context.js.map +1 -0
- package/bench/benchmark-garbage-collection.js +41 -0
- package/bench/benchmark-garbage-collection.js.map +1 -0
- package/bench/benchmark-lifecycle-policy.d.ts +6 -0
- package/bench/benchmark-lifecycle-policy.d.ts.map +1 -0
- package/bench/benchmark-lifecycle-policy.js +34 -0
- package/bench/benchmark-lifecycle-policy.js.map +1 -0
- package/bench/benchmark-lifecycle.js +83 -0
- package/bench/benchmark-lifecycle.js.map +1 -0
- package/bench/benchmark-normalization.js +71 -0
- package/bench/benchmark-normalization.js.map +1 -0
- package/bench/benchmark-observation-set.js +46 -0
- package/bench/benchmark-observation-set.js.map +1 -0
- package/bench/benchmark-observations.js +76 -0
- package/bench/benchmark-observations.js.map +1 -0
- package/bench/benchmark-resource-envelope.js +67 -0
- package/bench/benchmark-resource-envelope.js.map +1 -0
- package/bench/benchmark-runtime-cooldown.js +136 -0
- package/bench/benchmark-runtime-cooldown.js.map +1 -0
- package/bench/benchmark-sample-lifetime.js +134 -0
- package/bench/benchmark-sample-lifetime.js.map +1 -0
- package/bench/benchmark-sampling-evidence.js +54 -0
- package/bench/benchmark-sampling-evidence.js.map +1 -0
- package/bench/benchmark-sampling-state.js +90 -0
- package/bench/benchmark-sampling-state.js.map +1 -0
- package/bench/benchmark-sampling.js +75 -0
- package/bench/benchmark-sampling.js.map +1 -0
- package/bench/calibrated-measurement.d.ts +11 -0
- package/bench/calibrated-measurement.d.ts.map +1 -0
- package/bench/calibrated-measurement.js +58 -0
- package/bench/calibrated-measurement.js.map +1 -0
- package/bench/calibration-definition.d.ts +38 -0
- package/bench/calibration-definition.d.ts.map +1 -0
- package/bench/calibration-failure.js +18 -0
- package/bench/calibration-failure.js.map +1 -0
- package/bench/calibration-observations.js +64 -0
- package/bench/calibration-observations.js.map +1 -0
- package/bench/calibration-references.js +55 -0
- package/bench/calibration-references.js.map +1 -0
- package/bench/calibration-resource-body.js +59 -0
- package/bench/calibration-resource-body.js.map +1 -0
- package/bench/calibration-resource.d.ts +5 -0
- package/bench/calibration-resource.d.ts.map +1 -0
- package/bench/calibration-resource.js +63 -0
- package/bench/calibration-resource.js.map +1 -0
- package/bench/calibration-sampling.js +103 -0
- package/bench/calibration-sampling.js.map +1 -0
- package/bench/canonical-calibration.js +18 -0
- package/bench/canonical-calibration.js.map +1 -0
- package/bench/cpu-calibration.d.ts +3 -0
- package/bench/cpu-calibration.d.ts.map +1 -0
- package/bench/cpu-calibration.js +31 -0
- package/bench/cpu-calibration.js.map +1 -0
- package/bench/default-normalization.js +37 -0
- package/bench/default-normalization.js.map +1 -0
- package/bench/measurement-contract-error.js +7 -0
- package/bench/measurement-contract-error.js.map +1 -0
- package/bench/measurement-definition.d.ts +19 -0
- package/bench/measurement-definition.d.ts.map +1 -0
- package/bench/measurement-definition.js +22 -0
- package/bench/measurement-definition.js.map +1 -0
- package/bench/measurement-region.js +159 -0
- package/bench/measurement-region.js.map +1 -0
- package/bench/measurement-resources.js +113 -0
- package/bench/measurement-resources.js.map +1 -0
- package/bench/measurement-strategy.d.ts +5 -0
- package/bench/measurement-strategy.d.ts.map +1 -0
- package/bench/measurement-strategy.js +35 -0
- package/bench/measurement-strategy.js.map +1 -0
- package/bench/measurement-types.d.ts +61 -0
- package/bench/measurement-types.d.ts.map +1 -0
- package/bench/measurement-units.js +5 -0
- package/bench/measurement-units.js.map +1 -0
- package/bench/metric-normalization-evidence.js +7 -0
- package/bench/metric-normalization-evidence.js.map +1 -0
- package/bench/metric-reading.d.ts +4 -0
- package/bench/metric-reading.d.ts.map +1 -0
- package/bench/metric-reading.js +18 -0
- package/bench/metric-reading.js.map +1 -0
- package/bench/module-import-execution.js +47 -0
- package/bench/module-import-execution.js.map +1 -0
- package/bench/module-import-result.js +53 -0
- package/bench/module-import-result.js.map +1 -0
- package/bench/module-import-session.js +141 -0
- package/bench/module-import-session.js.map +1 -0
- package/bench/module-measurement.d.ts +31 -0
- package/bench/module-measurement.d.ts.map +1 -0
- package/bench/module-measurement.js +4 -0
- package/bench/module-measurement.js.map +1 -0
- package/bench/module-sampling.js +57 -0
- package/bench/module-sampling.js.map +1 -0
- package/bench/native-metric-collectors.d.ts +6 -0
- package/bench/native-metric-collectors.d.ts.map +1 -0
- package/bench/native-metric-collectors.js +181 -0
- package/bench/native-metric-collectors.js.map +1 -0
- package/bench/normalization-interval.js +63 -0
- package/bench/normalization-interval.js.map +1 -0
- package/bench/normalization-summaries.js +85 -0
- package/bench/normalization-summaries.js.map +1 -0
- package/bench/process-child.js +131 -0
- package/bench/process-child.js.map +1 -0
- package/bench/process-command.d.ts +292 -0
- package/bench/process-command.d.ts.map +1 -0
- package/bench/process-command.js +32 -0
- package/bench/process-command.js.map +1 -0
- package/bench/process-deadline.js +21 -0
- package/bench/process-deadline.js.map +1 -0
- package/bench/process-evidence-query.js +3 -0
- package/bench/process-evidence-query.js.map +1 -0
- package/bench/process-evidence.js +80 -0
- package/bench/process-evidence.js.map +1 -0
- package/bench/process-execution.js +170 -0
- package/bench/process-execution.js.map +1 -0
- package/bench/process-helper.js +208 -0
- package/bench/process-helper.js.map +1 -0
- package/bench/process-interactions.js +79 -0
- package/bench/process-interactions.js.map +1 -0
- package/bench/process-invocation.js +80 -0
- package/bench/process-invocation.js.map +1 -0
- package/bench/process-measurement-result.js +66 -0
- package/bench/process-measurement-result.js.map +1 -0
- package/bench/process-measurement.d.ts +16 -0
- package/bench/process-measurement.d.ts.map +1 -0
- package/bench/process-measurement.js +6 -0
- package/bench/process-measurement.js.map +1 -0
- package/bench/process-node-observation.js +64 -0
- package/bench/process-node-observation.js.map +1 -0
- package/bench/process-node-readings.js +56 -0
- package/bench/process-node-readings.js.map +1 -0
- package/bench/process-observation.d.ts +120 -0
- package/bench/process-observation.d.ts.map +1 -0
- package/bench/process-observation.js +37 -0
- package/bench/process-observation.js.map +1 -0
- package/bench/process-output.js +116 -0
- package/bench/process-output.js.map +1 -0
- package/bench/process-probe-report.js +51 -0
- package/bench/process-probe-report.js.map +1 -0
- package/bench/process-probe-session.js +175 -0
- package/bench/process-probe-session.js.map +1 -0
- package/bench/process-protocol.js +51 -0
- package/bench/process-protocol.js.map +1 -0
- package/bench/process-sampling.js +67 -0
- package/bench/process-sampling.js.map +1 -0
- package/bench/process-script.d.ts +319 -0
- package/bench/process-script.d.ts.map +1 -0
- package/bench/process-script.js +77 -0
- package/bench/process-script.js.map +1 -0
- package/bench/process-timeline.js +33 -0
- package/bench/process-timeline.js.map +1 -0
- package/bench/runtime-health-collector.d.ts +3 -0
- package/bench/runtime-health-collector.d.ts.map +1 -0
- package/bench/runtime-health-collector.js +105 -0
- package/bench/runtime-health-collector.js.map +1 -0
- package/bench/sampling-policy.d.ts +3 -0
- package/bench/sampling-policy.d.ts.map +1 -0
- package/bench/sampling-policy.js +25 -0
- package/bench/sampling-policy.js.map +1 -0
- package/bench/statistical-primitives.js +39 -0
- package/bench/statistical-primitives.js.map +1 -0
- package/bench/timeline-context.js +97 -0
- package/bench/timeline-context.js.map +1 -0
- package/bench/timeline-execution.js +25 -0
- package/bench/timeline-execution.js.map +1 -0
- package/bench/timeline-measurement.d.ts +7 -0
- package/bench/timeline-measurement.d.ts.map +1 -0
- package/bench/timeline-measurement.js +15 -0
- package/bench/timeline-measurement.js.map +1 -0
- package/bench/timeline-recording.js +152 -0
- package/bench/timeline-recording.js.map +1 -0
- package/bench/timeline-report.d.ts +4 -0
- package/bench/timeline-report.d.ts.map +1 -0
- package/bench/timeline-report.js +41 -0
- package/bench/timeline-report.js.map +1 -0
- package/bench/workload.d.ts +13 -0
- package/bench/workload.d.ts.map +1 -0
- package/bench/workload.js +20 -0
- package/bench/workload.js.map +1 -0
- package/package.json +41 -5
- package/packages/bench/bench.entry-point.d.ts +33 -0
- package/packages/bench/bench.entry-point.d.ts.map +1 -1
- package/packages/bench/bench.entry-point.js +16 -0
- package/packages/bench/bench.entry-point.js.map +1 -1
- package/packages/bench/calibration.entry-point.d.ts +9 -0
- package/packages/bench/calibration.entry-point.d.ts.map +1 -0
- package/packages/bench/calibration.entry-point.js +5 -0
- package/packages/bench/calibration.entry-point.js.map +1 -0
- package/packages/bench/module-import.entry-point.js +81 -0
- package/packages/bench/module-import.entry-point.js.map +1 -0
- package/packages/bench/process-helper.entry-point.js +84 -0
- package/packages/bench/process-helper.entry-point.js.map +1 -0
- package/packages/bench/process-node-probe.entry-point.js +46 -0
- package/packages/bench/process-node-probe.entry-point.js.map +1 -0
- package/packages/test/authoring-source-locations.js +10 -12
- package/packages/test/authoring-source-locations.js.map +1 -1
- package/packages/test/resource-wrapper-composition.js +37 -50
- package/packages/test/resource-wrapper-composition.js.map +1 -1
- package/packages/test/resource-wrapper-data.js +13 -1
- package/packages/test/resource-wrapper-data.js.map +1 -1
- package/packages/test/resource-wrapper-runtime-scope.js.map +1 -1
- package/packages/test/resource-wrapper-session.js +49 -2
- package/packages/test/resource-wrapper-session.js.map +1 -1
- package/packages/test/table-authoring.d.ts.map +1 -1
- package/packages/test/table-authoring.js +8 -9
- package/packages/test/table-authoring.js.map +1 -1
- package/readme.md +549 -10
- package/software-bill-of-materials.cyclonedx.json +203 -0
- package/sbom.cdx.json +0 -84
package/readme.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# @overkill-dev/bench
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Workload measurement and performance budgets for Overkill.
|
|
4
4
|
|
|
5
5
|
Included in the standard `@overkill-dev/test` installation. Standard users
|
|
6
6
|
import the same authoring surface from `@overkill-dev/test/bench`; advanced
|
|
7
7
|
consumers can install and import `@overkill-dev/bench` directly. Bench code
|
|
8
8
|
stays outside root `@overkill-dev/test` imports and ordinary microtest startup.
|
|
9
9
|
|
|
10
|
-
The current facade exports `test`, `skippedTest`, `suite`, `table`,
|
|
10
|
+
The current facade exports `workload`, `test`, `skippedTest`, `suite`, `table`,
|
|
11
11
|
`defineMacro`, and `defineParameterizedTestBody`. These are the same
|
|
12
12
|
family-neutral constructors used by `@overkill-dev/test`, with the same
|
|
13
13
|
assertion, validation, and source-location behavior.
|
|
@@ -28,6 +28,70 @@ export const testNode = suite('fixture validation', [
|
|
|
28
28
|
Nodes compose with ordinary `@overkill-dev/test` suites, tables, and macros.
|
|
29
29
|
Creating a node does not execute its body or select a test family.
|
|
30
30
|
|
|
31
|
+
`workload(name, parameters)` snapshots a named JSON parameter record:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { workload } from '@overkill-dev/test/bench';
|
|
35
|
+
|
|
36
|
+
const small = workload('small', { packages: 5 });
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`small.parameters` preserves inferred fields and is deeply immutable. The
|
|
40
|
+
caller-owned input stays mutable. `small.id` is its structured `WorkloadId`;
|
|
41
|
+
each parameter is encoded as canonical JSON, so numbers and strings remain
|
|
42
|
+
distinct. Names preserve their spelling and reject blank strings and control
|
|
43
|
+
characters. Parameters reject lossy values, classes, accessors, cycles,
|
|
44
|
+
non-JSON properties, and nesting beyond the shared JSON depth limit of 64.
|
|
45
|
+
|
|
46
|
+
Advanced DSL authors can pass `{ id: small.id, parameters: small.parameters, body }` entries to
|
|
47
|
+
`createWorkloadTestCase` from `@overkill-dev/engine`. It requires at least one
|
|
48
|
+
workload and unique workload names. Planning produces one executable `WorkId`
|
|
49
|
+
per workload, sharing the logical `CaseId`. Runtime matrices expand each
|
|
50
|
+
workload independently. Bodies retain ordinary resource/runtime descriptors.
|
|
51
|
+
Use `--filter 'workload=small'` to select a named workload; a case filter
|
|
52
|
+
selects every workload of that case.
|
|
53
|
+
|
|
54
|
+
Resources declare workload dependence with a pure synchronous parser:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { defineResource, type WorkloadParameters } from '@overkill-dev/test/resources';
|
|
58
|
+
|
|
59
|
+
const fixture = defineResource({
|
|
60
|
+
name: 'publish-fixture',
|
|
61
|
+
scope: 'per-case',
|
|
62
|
+
requirements: [],
|
|
63
|
+
dispose: null,
|
|
64
|
+
workload(parameters: WorkloadParameters) {
|
|
65
|
+
if (typeof parameters.packages !== 'number') {
|
|
66
|
+
throw new TypeError('Expected a package count.');
|
|
67
|
+
}
|
|
68
|
+
return { packages: parameters.packages };
|
|
69
|
+
},
|
|
70
|
+
acquire({ workload }) {
|
|
71
|
+
return { packages: workload.parameters.packages };
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`withResource` and `withRuntime` inject handles as usual. Collection and list
|
|
77
|
+
validate parsers without acquiring resources. Acquisition and disposal receive
|
|
78
|
+
the same parsed value through `context.workload`; independent resources receive
|
|
79
|
+
`null`. Direct `startResources` and `startRuntime` sessions accept `workload: small`.
|
|
80
|
+
The low-level identity-only `{ id, body }` form remains valid for independent resources.
|
|
81
|
+
|
|
82
|
+
Workload-dependent resources and their consumers share within their declared
|
|
83
|
+
scope and full workload identity. Independent dependencies retain ordinary
|
|
84
|
+
sharing across workloads and runtime variants. Scenario bindings, projections,
|
|
85
|
+
placement requirements, startup budgets, and attachment attribution use the
|
|
86
|
+
existing lifecycle. Executors verify original parameter snapshots against
|
|
87
|
+
collection. Equal canonical identities with different original parameters
|
|
88
|
+
cannot share a resource boundary.
|
|
89
|
+
|
|
90
|
+
Advanced DSLs can snapshot inputs with `snapshotWorkloadInput` and
|
|
91
|
+
`snapshotWorkloadParameters` from `@overkill-dev/engine`. Descriptor graph
|
|
92
|
+
binding uses `createWorkloadResourceBinding`, `bindRuntimeWorkload`, and
|
|
93
|
+
`resourceWorkloadIdentity` from `@overkill-dev/resources`.
|
|
94
|
+
|
|
31
95
|
Public types include `AuthoringAnnotations`, `AuthoringControls`,
|
|
32
96
|
`ParameterizedTestScope`, `TableDefinition`, `TableTestBody`, `Suite`,
|
|
33
97
|
`Table`, `TestBody`, `TestCase`, `TestNode`, `TestScope`, and
|
|
@@ -49,19 +113,494 @@ Omitting `--profile` selects the sole benchmark profile. Missing, ambiguous,
|
|
|
49
113
|
unknown, or ordinary-family selections return argument error `3`.
|
|
50
114
|
Both commands accept shared file, title, filter, runtime, order, seed, and shard
|
|
51
115
|
selection flags. Run also supports capture, precise timings, worker requests,
|
|
52
|
-
and diagnostic
|
|
116
|
+
and diagnostic process usage. List supports locations and orphans.
|
|
53
117
|
|
|
54
118
|
Benchmarks use the regular resource lifecycle, assertion results, attachments,
|
|
55
119
|
and configured reporters. Listing imports definitions but does not run bodies,
|
|
56
120
|
acquire resources, instantiate reporters, or write run history.
|
|
57
|
-
Execution defaults to a reused worker pool with serial scheduling
|
|
58
|
-
|
|
59
|
-
|
|
121
|
+
Execution defaults to a reused worker pool with serial scheduling within each
|
|
122
|
+
worker. Adaptive placement may use multiple lanes for collector-free
|
|
123
|
+
`bundle-size` measurements without timing budgets or diagnostics. Other work
|
|
124
|
+
resolves one lane. Worker requests and profile caps remain visible in execution
|
|
125
|
+
facts. Supervised execution and fresh workers are
|
|
60
126
|
also supported. Hedging and concurrent groups are rejected.
|
|
61
127
|
Default timeouts are 5000 ms for collection, 40000 ms soft, and 60000 ms hard.
|
|
62
128
|
Overrides must keep soft at or below hard and hard at or below 60000 ms.
|
|
63
129
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
130
|
+
`benchmark(...)` expands named, immutable JSON workloads before selection and
|
|
131
|
+
sharding. Each workload requires at least one metric budget. Return every
|
|
132
|
+
metric used by a budget; declare other returned metrics in `diagnosticMetrics`.
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import { benchmark, wallClockMeasurement, workload } from '@overkill-dev/test/bench';
|
|
136
|
+
|
|
137
|
+
export const testNode = benchmark('serialize', {
|
|
138
|
+
kind: 'runtime',
|
|
139
|
+
workloads: [ workload('small', { entries: 10 }) ],
|
|
140
|
+
measurement: wallClockMeasurement(),
|
|
141
|
+
measure({ workload, sample }) {
|
|
142
|
+
const input = Array.from({ length: workload.parameters.entries }, (_, index) => index);
|
|
143
|
+
const measured = sample.measure(() => JSON.stringify(input));
|
|
144
|
+
return { durationMicroseconds: measured.metrics.durationMicroseconds };
|
|
145
|
+
},
|
|
146
|
+
diagnosticMetrics: [],
|
|
147
|
+
budgets: { small: { durationMicroseconds: { maximum: 100 } } }
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Call `sample.measure(callback)` exactly once per sample, or
|
|
152
|
+
`sample.measure(operationCount, callback)` for a known positive integer count.
|
|
153
|
+
The result contains the callback's `value` and collector `metrics`, including
|
|
154
|
+
`durationMicroseconds` and `operationsPerSecond`. Synchronous callbacks stay
|
|
155
|
+
synchronous with synchronous collectors. Async callbacks and async strategies
|
|
156
|
+
return a promise which must be awaited. Preparation, collector completion,
|
|
157
|
+
resource acquisition, and teardown are outside the measured callback.
|
|
158
|
+
|
|
159
|
+
`measurementStrategy([...])` accepts synchronous collectors;
|
|
160
|
+
`asyncMeasurementStrategy([...])` also accepts asynchronous collectors.
|
|
161
|
+
Built-in collectors are `threadCpuCollector`, `processCpuCollector`,
|
|
162
|
+
`memoryCollector`, `processResourceCollector`, and `runtimeHealthCollector`.
|
|
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`.
|
|
168
|
+
|
|
169
|
+
CPU metrics are deltas in microseconds. Memory metrics include end snapshots
|
|
170
|
+
and signed byte deltas; RSS and active resource counts describe the process,
|
|
171
|
+
while heap data describes the current thread. Process maximum RSS is a lifetime
|
|
172
|
+
high-water mark, not a peak confined to the callback. Page faults, filesystem
|
|
173
|
+
operations, and context switches are event counts, not bytes. Unsupported
|
|
174
|
+
counters and empty event-loop histograms carry explicit unavailable reasons.
|
|
175
|
+
GC observations do not force collection or estimate allocations.
|
|
176
|
+
|
|
177
|
+
A threshold-only budget measures the median. Set `statistic` to
|
|
178
|
+
`{ kind: 'quantile', probability: 0.95 }`,
|
|
179
|
+
`{ kind: 'mean', range: { minimum: 0, maximum: 1000 } }`,
|
|
180
|
+
`{ kind: 'observed-minimum' }`, or `{ kind: 'observed-maximum' }`.
|
|
181
|
+
Supply `minimum`, `maximum`, or both; multiple budgets for one metric use an
|
|
182
|
+
array. Bounds are inclusive. Observed extrema describe only this finite run.
|
|
183
|
+
Means require finite, ordered bounds with a finite span; observations outside
|
|
184
|
+
that declared range invalidate measurement.
|
|
185
|
+
|
|
186
|
+
Sampling assumes independent, stationary observations. Defaults are 95%
|
|
187
|
+
confidence, 5% relative precision, 128 minimum samples, and 65536 maximum samples.
|
|
188
|
+
Pass a complete third argument with `annotations`, `controls`, and `sampling`
|
|
189
|
+
to override them; `defaultSamplingPolicy` supplies a starting point.
|
|
190
|
+
`absolutePrecision` maps metric names to tolerances near zero. Checkpoints grow
|
|
191
|
+
geometrically and share error probability across all distinct budgeted targets
|
|
192
|
+
and checkpoints within each workload. Quantile estimates use linear interpolation (type 7), with
|
|
193
|
+
binomial order-statistic intervals; means use
|
|
194
|
+
bounded empirical Bernstein intervals. Diagnostic metrics do not delay stopping.
|
|
195
|
+
Measured samples are retained separately from warmup observations.
|
|
196
|
+
|
|
197
|
+
Warmup runs automatically: 32 invocations of the same `measure(...)` callback
|
|
198
|
+
precede measured sampling for each workload and runtime variant. No additional
|
|
199
|
+
authoring is required. Warmup uses the same resources, collectors, and sample
|
|
200
|
+
cleanup, but its readings never contribute to measured counts, intervals, or
|
|
201
|
+
budgets. A fixed count does not establish optimization or statistical stationarity.
|
|
202
|
+
|
|
203
|
+
The third argument accepts `lifecycle` alongside `annotations`, `controls`,
|
|
204
|
+
and `sampling`. Existing options without `lifecycle` use
|
|
205
|
+
`defaultBenchmarkLifecyclePolicy`. Set `lifecycle.warmupSamples` to zero for
|
|
206
|
+
cold-start measurements; counts from zero through 65536 are supported.
|
|
207
|
+
|
|
208
|
+
Register invocation-owned resets with `sample.cleanup(callback)`. Callbacks
|
|
209
|
+
may be synchronous or asynchronous, run in reverse order after every warmup
|
|
210
|
+
or measured invocation, and finish before the next invocation. They also run
|
|
211
|
+
when preparation, measurement, or metric validation fails. Registration after
|
|
212
|
+
cleanup starts is rejected. Preparation, cleanup, and cooldown remain outside
|
|
213
|
+
`sample.measure(...)`. `context.cleanup(...)` keeps its attempt lifetime and
|
|
214
|
+
runs after the attempt signal is aborted. Sample cleanup runs while that
|
|
215
|
+
signal remains live unless the attempt has already been cancelled.
|
|
216
|
+
|
|
217
|
+
Cooldown is off by default. Set `lifecycle.cooldown` to
|
|
218
|
+
`defaultRuntimeCooldownPolicy` to wait for two consecutive 50 ms windows with
|
|
219
|
+
event-loop utilization at most 10%, bounded by 1000 ms. Explicit runtime
|
|
220
|
+
policies configure `maximumEventLoopUtilization` in `[0, 1]` and
|
|
221
|
+
`timeoutMilliseconds` above 100 ms and at most 60000 ms. Busy windows reset the
|
|
222
|
+
consecutive count. Cooldown runs after each successful invocation's cleanup,
|
|
223
|
+
including the final invocation, and stops on case cancellation. It observes
|
|
224
|
+
the executing event loop rather than host-wide CPU, memory, or thermal state.
|
|
225
|
+
|
|
226
|
+
A budget passes when its interval is wholly inside its bounds, fails when the
|
|
227
|
+
interval establishes a violation, and continues sampling while it overlaps a
|
|
228
|
+
threshold. Every inferential target must also meet precision. Missing or
|
|
229
|
+
unavailable budgeted metrics fail normally. Unresolved intervals or precision
|
|
230
|
+
at the sample limit produce an incomplete result and a measurement error,
|
|
231
|
+
preserving established failures. The existing case timeout also applies.
|
|
232
|
+
|
|
233
|
+
Resource and runtime wrappers surround the entire sampling session, so fixtures
|
|
234
|
+
are acquired once per attempt, surrounding warmup and measured sampling.
|
|
235
|
+
Attempt cleanup callbacks run after the attempt.
|
|
236
|
+
`workload: parseParameters` opts a resource into workload-specific acquisition
|
|
237
|
+
and cache identity. Acquisition and disposal receive parsed parameters and
|
|
238
|
+
identity through `context.workload`; independent resources receive `null` and
|
|
239
|
+
keep their existing sharing rules. Runtime matrices multiply the workload plan.
|
|
240
|
+
For TypeScript resource/runtime wrappers, pass
|
|
241
|
+
`BenchmarkMeasureContext<Parameters>` as `Scope` and `BenchmarkMetrics` (or a
|
|
242
|
+
narrower metric object) as `Result`. Wrapper defaults describe ordinary assertions.
|
|
243
|
+
|
|
244
|
+
Results and attempts contain nullable `benchmark` summaries with policy,
|
|
245
|
+
sample count, metric provenance, budget estimates, intervals, and decisions.
|
|
246
|
+
Reporters receive `benchmark-progress` and the final summary on `test-end`.
|
|
247
|
+
Raw readings use bounded `benchmark-samples` attachments, with explicit omission
|
|
248
|
+
when retention limits or a missing attachment coordinator prevent recording.
|
|
249
|
+
Versioned `lifecycle` evidence records warmup counts and summaries, sample
|
|
250
|
+
cleanup counts and failures, and runtime cooldown observations. Warmup readings
|
|
251
|
+
use separate `benchmark-warmup-samples` attachments under the same retention
|
|
252
|
+
limits. Completed readings survive cleanup or cooldown failure; sampling stops
|
|
253
|
+
with incomplete evidence and failures block baseline writes. Cooperative
|
|
254
|
+
interruptions retain confirmed prefixes; hard termination retains the last
|
|
255
|
+
delivered progress snapshot. Historical results without lifecycle evidence
|
|
256
|
+
decode it as `null`.
|
|
257
|
+
|
|
258
|
+
Browser collectors remain a later milestone.
|
|
259
|
+
Cold-module imports and opt-in benchmark timelines use the same sampling and
|
|
260
|
+
result pipeline described below.
|
|
261
|
+
Benchmark HTML reports show warmup and lifecycle evidence separately from
|
|
262
|
+
measured distributions and budgets, and are available through
|
|
263
|
+
`createBenchmarkHtmlReporter` from `@overkill-dev/test/reporters`.
|
|
264
|
+
|
|
265
|
+
Performance baseline commands use adapters configured in the benchmark profile:
|
|
266
|
+
|
|
267
|
+
| Command | Behavior |
|
|
268
|
+
| ----------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
269
|
+
| `overkill bench baseline update` | Create missing expectations and replace changed expectations. |
|
|
270
|
+
| `overkill bench baseline apply` | Update expectations and remove stale expectations after a complete successful inventory. |
|
|
271
|
+
| `overkill bench baseline bootstrap` | Create missing expectations; compare and preserve existing expectations. |
|
|
272
|
+
| `overkill bench baseline diff` | Preview apply changes without writing baselines; exit `1` for any change. |
|
|
273
|
+
| `overkill bench baseline list` | List persisted expectations across machine classes without importing benchmarks or running calibration. |
|
|
274
|
+
|
|
275
|
+
Execution verbs accept the same selection flags as `bench run`. List accepts
|
|
276
|
+
paths, `--profile`, and `--config`. Ordinary `bench run` compares expectations
|
|
277
|
+
without writing them. Comparison failures exit `1`; storage, observation, or
|
|
278
|
+
calibration failures exit `2`. Explicit writes are permitted in CI.
|
|
279
|
+
|
|
280
|
+
Writes begin only after all selected cases and observations succeed. Bootstrap
|
|
281
|
+
comparison failures block every write. Filtered or sharded apply runs preserve
|
|
282
|
+
stale files; complete apply preserves skipped cases and other machine classes.
|
|
283
|
+
Update and bootstrap fail on stale expectations in a complete inventory.
|
|
284
|
+
Each file is written atomically. A later write or reporter failure preserves
|
|
285
|
+
already completed writes, recorded in the run's `performance-baselines` JSON
|
|
286
|
+
attachment and the programmatic command result.
|
|
287
|
+
|
|
288
|
+
Runs using performance baselines perform a real CPU reference calibration in a
|
|
289
|
+
separate process with the benchmark Node arguments and sanitized environment.
|
|
290
|
+
Recorded metadata identifies the machine class and preserves reference samples.
|
|
291
|
+
This legacy adapter context remains separate from automatic metric normalization.
|
|
292
|
+
Adapters receive normalized benchmark samples; normalized expectations can match
|
|
293
|
+
across machine classes. `normalizeBenchmarkDuration` from
|
|
294
|
+
`@overkill-dev/bench/calibration` remains available for custom artifacts that use
|
|
295
|
+
the legacy context. Avoid applying it again to already normalized samples.
|
|
296
|
+
|
|
297
|
+
## External processes and terminals
|
|
298
|
+
|
|
299
|
+
Use `processMeasurement({ instrumentation: 'off' })` for commands on Linux or
|
|
300
|
+
macOS. Each warmup and measured invocation must await exactly one
|
|
301
|
+
`sample.process(...)`. Commands run directly without a shell, in a fresh owned
|
|
302
|
+
process group. `env: null` inherits the environment; a record replaces it.
|
|
303
|
+
|
|
304
|
+
```ts
|
|
305
|
+
import { benchmark, processMeasurement, workload } from '@overkill-dev/test/bench';
|
|
306
|
+
|
|
307
|
+
export const testNode = benchmark('CLI startup', {
|
|
308
|
+
kind: 'startup',
|
|
309
|
+
workloads: [ workload('one', {}) ],
|
|
310
|
+
measurement: processMeasurement({ instrumentation: 'off' }),
|
|
311
|
+
async measure({ sample }) {
|
|
312
|
+
const child = await sample.process({
|
|
313
|
+
command: [ 'node', 'cli.js' ],
|
|
314
|
+
cwd: '.',
|
|
315
|
+
env: null,
|
|
316
|
+
io: { kind: 'pipes' },
|
|
317
|
+
completion: {
|
|
318
|
+
kind: 'ready',
|
|
319
|
+
marker: { stream: 'stdout', text: 'Ready' }
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
return { startupMilliseconds: child.metrics.startupMilliseconds };
|
|
323
|
+
},
|
|
324
|
+
diagnosticMetrics: [],
|
|
325
|
+
budgets: { one: { startupMilliseconds: { maximum: 500 } } }
|
|
326
|
+
});
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Import `benchmark`, `workload`, and `processMeasurement` from
|
|
330
|
+
`@overkill-dev/test/bench` or `@overkill-dev/bench`.
|
|
331
|
+
|
|
332
|
+
`completion.kind` selects exit, readiness, or the final scripted interaction.
|
|
333
|
+
Exit completion declares `expectedExitCodes`, nullable `readiness`, and `steps`.
|
|
334
|
+
Interaction completion declares nullable `readiness` and a nonempty script
|
|
335
|
+
ending with `expect` or a named `interaction`. Steps support `write`, literal
|
|
336
|
+
`expect`, `interaction`, pipe `close-input`, and terminal `resize`. Interaction steps use
|
|
337
|
+
`name`, `input`, and `marker` and expose
|
|
338
|
+
`interaction.<name>.durationMicroseconds`.
|
|
339
|
+
|
|
340
|
+
Use `io: { kind: 'pty', name: 'xterm-256color', columns: 80, rows: 24 }` for a
|
|
341
|
+
terminal. Terminal markers select `stream: 'terminal'`; pipes select `stdout`
|
|
342
|
+
or `stderr`. Matching preserves ANSI sequences and continues beyond retained
|
|
343
|
+
output limits. First output and explicit readiness are separate metrics.
|
|
344
|
+
|
|
345
|
+
`instrumentation: 'node'` requires the command executable to be Node. Its probe
|
|
346
|
+
reports child CPU, memory, and event loop readings with a separate observation
|
|
347
|
+
window. CPU totals and peak RSS cover the child lifetime; event loop observation
|
|
348
|
+
starts when the probe loads. Delay readings stay unavailable until an event loop
|
|
349
|
+
observation exists. Instrumentation off returns these readings as unavailable.
|
|
350
|
+
Wall time starts at target launch and ends at the selected checkpoint; teardown is outside
|
|
351
|
+
that interval. Cancellation and completion terminate the owned process group,
|
|
352
|
+
with forced termination after a bounded grace period.
|
|
353
|
+
|
|
354
|
+
Runner results retain bounded output, phase, completion, and probe metadata as
|
|
355
|
+
process evidence. HTML case details include that evidence. Process benchmarks
|
|
356
|
+
run serially under existing benchmark host checks and sampling policies.
|
|
357
|
+
|
|
358
|
+
## Cold-module imports
|
|
359
|
+
|
|
360
|
+
`moduleMeasurement()` gives each warmup and measured invocation a fresh Node
|
|
361
|
+
process and user-module graph. Import timing starts inside the child after its
|
|
362
|
+
bootstrap and finishes when `import()` settles. Process startup, IPC, and
|
|
363
|
+
teardown are excluded. Filesystem and operating-system caches are not cleared.
|
|
364
|
+
|
|
365
|
+
```ts
|
|
366
|
+
measurement: rawMeasurement(moduleMeasurement()),
|
|
367
|
+
async measure({ sample }) {
|
|
368
|
+
const imported = await sample.importModule({
|
|
369
|
+
url: new URL('./application.ts', import.meta.url),
|
|
370
|
+
cwd: process.cwd(),
|
|
371
|
+
env: null,
|
|
372
|
+
nodeArguments: []
|
|
373
|
+
});
|
|
374
|
+
return { durationMicroseconds: imported.metrics.durationMicroseconds };
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Each invocation must await exactly one successful import. The URL must use
|
|
379
|
+
`file:`; Node supplies ESM, CommonJS, and supported TypeScript loading.
|
|
380
|
+
`env: null` inherits the environment. Explicit Node arguments configure the
|
|
381
|
+
child independently of the runner. Module exports are not transported.
|
|
382
|
+
The harness terminates the process group after import completion, including
|
|
383
|
+
handles opened by imported modules.
|
|
384
|
+
|
|
385
|
+
Metrics include import `durationMicroseconds`, `operationsPerSecond`, separate
|
|
386
|
+
`processStartupMilliseconds`, and `outputBytes`. Startup is observed from the
|
|
387
|
+
launch request to child import readiness, including helper startup and IPC.
|
|
388
|
+
Return budgeted metrics and declare other returned metrics as diagnostics. Duration and throughput normalize
|
|
389
|
+
automatically unless wrapped in `rawMeasurement`; custom calibration also works.
|
|
390
|
+
Retained process evidence records the URL, Node version and arguments, import
|
|
391
|
+
duration, startup, output, and import failures. Module measurements stay serial
|
|
392
|
+
and use the existing Linux/macOS process cancellation and deadline policy.
|
|
393
|
+
|
|
394
|
+
## Benchmark timelines
|
|
395
|
+
|
|
396
|
+
Wrap a strategy with `timelineMeasurement(strategy, { maximumEvents: 4096 })`
|
|
397
|
+
to record a bounded timeline. Recording is off by default. The wrapper composes
|
|
398
|
+
with raw and calibrated measurements in either order.
|
|
399
|
+
|
|
400
|
+
`sample.timeline.mark(name)` records an instant. `sample.timeline.span(name,
|
|
401
|
+
callback)` records a named interval and returns the callback's value or promise,
|
|
402
|
+
preserving synchronous execution and failures. Calls are inert when recording
|
|
403
|
+
is off. Names must be nonblank and contain no control characters.
|
|
404
|
+
|
|
405
|
+
Timelines include invocation phases, measurement regions, sample cleanup, forced
|
|
406
|
+
GC, cooldown, runtime GC observations, process checkpoints, and authored events.
|
|
407
|
+
Events retain warmup/measured phase, zero-based sample index, source, raw
|
|
408
|
+
microsecond timestamps, outcome, and clock domain. Child clocks have separate
|
|
409
|
+
origins and are not presented as synchronized with the executing runtime.
|
|
410
|
+
Recording and authored instrumentation may add overhead to measured work.
|
|
411
|
+
|
|
412
|
+
Limits are positive integers up to 65536 events per attempt; attachment byte
|
|
413
|
+
limits also apply. Excess events are omitted with explicit counts and do not
|
|
414
|
+
change budget decisions. Cooperative failures retain partial evidence. Hard
|
|
415
|
+
termination may leave no timeline attachment; pending or unavailable evidence
|
|
416
|
+
remains explicit. Historical results decode absent timeline evidence as `null`.
|
|
417
|
+
|
|
418
|
+
`readBenchmarkTimeline(result, test)` reads retained evidence without rerunning
|
|
419
|
+
work. Offline HTML reports provide workload, phase, sample, and clock selectors,
|
|
420
|
+
an interactive timeline, and static event tables.
|
|
421
|
+
|
|
422
|
+
## Host conditions
|
|
423
|
+
|
|
424
|
+
Every executing benchmark run records a host snapshot before collection and
|
|
425
|
+
placement. `bench list` and baseline `list` do not collect host observations.
|
|
426
|
+
The snapshot records capacity, load, memory availability, Node/V8 versions,
|
|
427
|
+
OS details, and available platform pressure signals. Every reading identifies
|
|
428
|
+
its source, scope, unit, and availability. Free memory is not memory pressure.
|
|
429
|
+
|
|
430
|
+
Benchmark profiles may reject known-bad conditions with relative limits:
|
|
431
|
+
|
|
432
|
+
```ts
|
|
433
|
+
host: {
|
|
434
|
+
limits: {
|
|
435
|
+
maximumCpuBusyPercent: 80,
|
|
436
|
+
minimumAvailableMemoryPercent: 10
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
Limits default to `null`, disabling each check. Equality passes. A violated
|
|
442
|
+
limit or an unavailable configured signal stops the run before collection,
|
|
443
|
+
resources, samples, or baseline writes, with a `measurement` runner error.
|
|
444
|
+
Unconfigured unavailable signals remain diagnostic. There is no automatic retry.
|
|
445
|
+
|
|
446
|
+
| Limit | Percentage meaning |
|
|
447
|
+
| ---------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
448
|
+
| `maximumCpuBusyPercent` | Busy CPU-time delta divided by total CPU-time delta across visible logical CPUs |
|
|
449
|
+
| `maximumHostLoadPerCpuPercent` | One-minute host load divided by visible logical CPU count, multiplied by 100; may exceed 100 |
|
|
450
|
+
| `minimumAvailableMemoryPercent` | Process-available bytes divided by the smaller known physical/process memory capacity, multiplied by 100 |
|
|
451
|
+
| `maximumLinuxCpuStallPercent` | Linux CPU PSI `some.avg10` |
|
|
452
|
+
| `maximumLinuxMemoryStallPercent` | Linux memory PSI `some.avg10` |
|
|
453
|
+
| `maximumLinuxIoStallPercent` | Linux I/O PSI `some.avg10` |
|
|
454
|
+
| `minimumDarwinCpuSpeedPercent` | Darwin CPU speed limit |
|
|
455
|
+
| `minimumDarwinCpuSchedulerPercent` | Darwin CPU scheduler limit |
|
|
456
|
+
|
|
457
|
+
Percentages must be finite and between 0 and 100, except host load, which has
|
|
458
|
+
no upper bound. Unknown process memory constraints use physical capacity as
|
|
459
|
+
the denominator and retain the unknown constraint reading. Available parallelism
|
|
460
|
+
is recorded separately from logical CPU count; host load does not claim to
|
|
461
|
+
measure container CPU utilization. Windows load average is unavailable.
|
|
462
|
+
|
|
463
|
+
Linux reads `/proc/pressure/{cpu,memory,io}`. Darwin uses read-only
|
|
464
|
+
`sysctl -n kern.memorystatus_vm_pressure_level` and `pmset -g therm` probes.
|
|
465
|
+
Missing tools, denied access, malformed data, and timeouts are explicit.
|
|
466
|
+
Other platforms retain portable observations and unsupported signal states.
|
|
467
|
+
|
|
468
|
+
The observer uses a 250 ms window. The complete pass has a 1000 ms deadline,
|
|
469
|
+
reduced by a shorter collection timeout; platform probes have a 250 ms deadline
|
|
470
|
+
within that cap. Incomplete windows have unavailable CPU-busy readings.
|
|
471
|
+
Observers and probes stop before execution. Runtime-health and process metrics
|
|
472
|
+
describe the runner process, not a workload's executing runtime. Node arguments
|
|
473
|
+
in the snapshot belong to that observer; execution host arguments retain their
|
|
474
|
+
ordinary execution facts.
|
|
475
|
+
|
|
476
|
+
`RunFacts.benchmarkHost` contains the snapshot, configured limits, and check
|
|
477
|
+
results. Version 4 `benchmark-run` artifacts retain host evidence, the nullable
|
|
478
|
+
`placement` decision, and normalization inputs for JSON and HTML reporting.
|
|
479
|
+
Versions 1 through 3 remain readable with `normalization: null`. Versions 1 and 2
|
|
480
|
+
also use `placement: null`; version 1 uses `host: null`. Host observations are separate from
|
|
481
|
+
`RunFacts.benchmarkCalibration`, which retains the legacy adapter CPU reference.
|
|
482
|
+
The snapshot describes its recorded moment; collection and fixture startup may
|
|
483
|
+
change conditions afterward. Sampling does not recheck host conditions.
|
|
484
|
+
|
|
485
|
+
### Adaptive placement
|
|
486
|
+
|
|
487
|
+
`RunFacts.benchmarkPlacement` records policy `conservative-size-only-v1`,
|
|
488
|
+
`maximumWorkers`, and bounded `limits` with reason and ceiling pairs. Custom
|
|
489
|
+
returned metrics in `bundle-size` benchmarks are trusted to describe artifact
|
|
490
|
+
sizes; no unit declaration or new authoring option is needed. Any collector,
|
|
491
|
+
timing metric budget/diagnostic, other kind, or missing metadata makes the
|
|
492
|
+
selected run serial. Filtering and sharding happen before this decision.
|
|
493
|
+
|
|
494
|
+
Host capacity can reduce the ceiling further. The runner reserves one CPU and
|
|
495
|
+
subtracts the larger of observed busy CPU equivalents and available one-minute
|
|
496
|
+
load. Missing required evidence, zero available memory, native Linux stalls,
|
|
497
|
+
or Darwin CPU throttling resolve one worker. Existing opt-in host limits still
|
|
498
|
+
block rejected hosts. Ordinary worker and resource caps remain authoritative.
|
|
499
|
+
See [Execution Strategy](../../../documentation/desired-concept/authoring/benchmarking.md#execution-strategy)
|
|
500
|
+
for the exact formula and signal policy.
|
|
501
|
+
|
|
502
|
+
Listing does not observe the host and records an uncalibrated one-worker cap.
|
|
503
|
+
Supervised runs stay serial. Incompatible mixed worker lifecycles remain plan
|
|
504
|
+
errors. Placement is frozen before samples; host conditions are not rechecked.
|
|
505
|
+
|
|
506
|
+
Forced GC defaults to off. Set profile `garbageCollection: 'after-sample'` or
|
|
507
|
+
benchmark lifecycle `garbageCollection: 'after-sample'` to request one synchronous
|
|
508
|
+
collection after every warmup and measured invocation, after sample cleanup and
|
|
509
|
+
before cooldown. Lifecycle `off` overrides an enabled profile; `profile-default`
|
|
510
|
+
inherits it. Supplied lifecycle objects must include this field.
|
|
511
|
+
|
|
512
|
+
GC runs outside measurement and requires supervised or hosted benchmark execution.
|
|
513
|
+
The runner supplies child flags and resolves a host when selected worker work needs
|
|
514
|
+
GC. Direct engine execution with requested GC fails even if the caller exposes GC.
|
|
515
|
+
Failed invocations still collect after cleanup unless cancelled. Collection failure
|
|
516
|
+
retains incomplete readings and blocks baseline writes. Lifecycle evidence records
|
|
517
|
+
resolved policy and collection counts; historical results retain absent GC evidence.
|
|
518
|
+
|
|
519
|
+
### Calibration and normalization
|
|
520
|
+
|
|
521
|
+
Built-in duration, throughput, and native CPU metrics normalize automatically using
|
|
522
|
+
`cpuCalibration()`. Byte and count metrics remain raw. Use
|
|
523
|
+
`rawMeasurement(wallClockMeasurement())` for explicit raw timing budgets.
|
|
524
|
+
Use `calibratedMeasurement` to select another domain's representative workload or
|
|
525
|
+
to declare scaling for custom metrics:
|
|
526
|
+
|
|
527
|
+
```ts
|
|
528
|
+
import {
|
|
529
|
+
benchmark,
|
|
530
|
+
calibratedMeasurement,
|
|
531
|
+
cpuCalibration,
|
|
532
|
+
wallClockMeasurement
|
|
533
|
+
} from '@overkill-dev/bench';
|
|
534
|
+
|
|
535
|
+
const measurement = calibratedMeasurement(wallClockMeasurement(), {
|
|
536
|
+
durationMicroseconds: { calibration: cpuCalibration(), scaling: 'proportional' }
|
|
537
|
+
});
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
Use `measurement` in the benchmark definition. Proportional scaling multiplies
|
|
541
|
+
readings by reference median / actual median. Inverse scaling uses actual median /
|
|
542
|
+
reference median, for metrics such as throughput. Only positive, finite calibration
|
|
543
|
+
readings in the declared unit are accepted.
|
|
544
|
+
|
|
545
|
+
Ordinary runs need no captured files. Budgets use reference-workload units:
|
|
546
|
+
proportional readings divide by the local calibration median, while inverse
|
|
547
|
+
readings multiply by it. Equivalent workloads can share budgets across machines.
|
|
548
|
+
For example, a normalized duration budget of `2` allows twice the CPU reference
|
|
549
|
+
workload's duration, regardless of the host's absolute speed.
|
|
550
|
+
|
|
551
|
+
When migrating raw timing budgets, convert thresholds to reference-workload units
|
|
552
|
+
and update performance expectations. Use `rawMeasurement` to retain existing raw
|
|
553
|
+
thresholds or an adapter that already normalizes samples.
|
|
554
|
+
|
|
555
|
+
Optionally run `overkill bench calibrate` to capture display references for the
|
|
556
|
+
selected profile and machine class. Commit the generated `calibration/*.calibration.json` files under
|
|
557
|
+
the profile's baseline directory. Capture acquires calibration dependencies and
|
|
558
|
+
samples their workloads, without running benchmark bodies or unrelated fixtures.
|
|
559
|
+
Listing does not acquire calibration resources.
|
|
560
|
+
Capture selection prefers the current machine, then compatible captures from other
|
|
561
|
+
machines. Incompatible workload versions or Node arguments fall back to canonical
|
|
562
|
+
units. Saved expectations still require comparable calibration inputs.
|
|
563
|
+
|
|
564
|
+
`defineCalibrationResource` accepts `workload`, `version`, `unit`, `dependencies`,
|
|
565
|
+
`measurement`, and `measure`. The callback receives `dependencies`, `attachments`,
|
|
566
|
+
`sample`, `signal`, and `cleanup`, and returns one `MetricReading`. Its optional
|
|
567
|
+
configuration supplies both `sampling` and `lifecycle`. Calibration absolute
|
|
568
|
+
precision uses the `reference` key in `sampling.absolutePrecision`. Change `version` when the
|
|
569
|
+
reference workload changes. Calibration samples are cached within an execution
|
|
570
|
+
context and collected before benchmark warmup in the executing process. Reused
|
|
571
|
+
workers keep the same reference across batches of one run and refresh it for a new
|
|
572
|
+
run.
|
|
573
|
+
Normalized runs use serial placement.
|
|
574
|
+
|
|
575
|
+
Saved performance expectations supply their selected display reference when available. Otherwise,
|
|
576
|
+
an optional checked-in capture supplies display units, falling back to canonical
|
|
577
|
+
reference-workload units. Matching adapters must agree on the reference. Unchanged expectations keep their
|
|
578
|
+
saved reference when fresh calibration readings arrive.
|
|
579
|
+
The original canonical budget basis is retained with saved expectations, so changing
|
|
580
|
+
display references cannot relax the gate. Adapters receive normalized
|
|
581
|
+
`benchmark-samples`; other artifacts retain their original contents. Adapter
|
|
582
|
+
proposals and comparisons remain adapter policy. Version 3 normalized expectations
|
|
583
|
+
match across hardware by calibration identity and scaling. Legacy expectations
|
|
584
|
+
remain readable and machine scoped.
|
|
585
|
+
|
|
586
|
+
Budget inference includes uncertainty in both calibration medians, with confidence
|
|
587
|
+
allocated across budget targets and sampling checkpoints. Budget thresholds and
|
|
588
|
+
absolute precision use canonical reference-workload units; mean support bounds stay in raw
|
|
589
|
+
units. Calibration precision can limit a run even when workload readings are
|
|
590
|
+
stable. Insufficient, invalid, or incompatible evidence fails measurement and blocks
|
|
591
|
+
baseline writes. Comparisons require compatible workload identities, versions,
|
|
592
|
+
units, and execution arguments. Portability depends on representative reference
|
|
593
|
+
work; a CPU reference cannot compensate for unrelated storage or network behavior.
|
|
594
|
+
Inference retains the independent, stationary observation assumption.
|
|
595
|
+
|
|
596
|
+
Results retain raw summaries, calibration samples, reference selection, factors,
|
|
597
|
+
normalized summaries, and converted display budgets. JSON and HTML preserve both
|
|
598
|
+
scales. `RunFacts.benchmarkNormalization` and version 4 `benchmark-run` artifacts
|
|
599
|
+
record reference inputs; older artifacts remain readable. Direct engine execution
|
|
600
|
+
also supplies automatic calibration context.
|
|
601
|
+
|
|
602
|
+
Capture and baseline cleanup emit a `calibration-references` report, readable with
|
|
603
|
+
`readCalibrationReferenceReport`, including completed paths after partial writes.
|
|
604
|
+
A full inventory detects stale references. `overkill bench baseline diff` previews
|
|
605
|
+
removals and `overkill bench baseline apply` removes them. Filtered, sharded, skipped,
|
|
606
|
+
foreign-profile, and foreign-class references are preserved.
|