diff --git a/test/fixtures/bench-runner/a.cjs b/test/fixtures/bench-runner/a.cjs index 54d6bb6c4a0..3edaf85ad85 100644 --- a/test/fixtures/bench-runner/a.cjs +++ b/test/fixtures/bench-runner/a.cjs @@ -6,7 +6,5 @@ bench('alpha', { params: { file: 'a', pid: process.pid }, samples: 1, }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/fixtures/bench-runner/abrupt-exit.cjs b/test/fixtures/bench-runner/abrupt-exit.cjs index 04be350b725..3489f424b8d 100644 --- a/test/fixtures/bench-runner/abrupt-exit.cjs +++ b/test/fixtures/bench-runner/abrupt-exit.cjs @@ -12,7 +12,5 @@ if (mode === 'late') { } bench('abrupt exit', { samples: 1 }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/fixtures/bench-runner/b.mjs b/test/fixtures/bench-runner/b.mjs index e82e3899f81..ca35178ecf7 100644 --- a/test/fixtures/bench-runner/b.mjs +++ b/test/fixtures/bench-runner/b.mjs @@ -4,7 +4,5 @@ bench('beta', { params: { file: 'b', pid: process.pid }, samples: 1, }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/fixtures/bench-runner/exit-code.cjs b/test/fixtures/bench-runner/exit-code.cjs index b687d1a4616..67f065fea7e 100644 --- a/test/fixtures/bench-runner/exit-code.cjs +++ b/test/fixtures/bench-runner/exit-code.cjs @@ -3,8 +3,6 @@ const { bench } = require('node:bench'); bench('sets exit code', { samples: 1 }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); process.exitCode = 2; }); diff --git a/test/fixtures/bench-runner/imported.cjs b/test/fixtures/bench-runner/imported.cjs index 599be715c02..9a5fb24bb33 100644 --- a/test/fixtures/bench-runner/imported.cjs +++ b/test/fixtures/bench-runner/imported.cjs @@ -6,7 +6,5 @@ bench('imported', { samples: 1, params: { imported: globalThis.benchImport }, }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/fixtures/bench-runner/inspector.cjs b/test/fixtures/bench-runner/inspector.cjs index 6ea7a71a226..d357b54f864 100644 --- a/test/fixtures/bench-runner/inspector.cjs +++ b/test/fixtures/bench-runner/inspector.cjs @@ -9,7 +9,5 @@ bench('inspector option', { params: { inspectPort }, samples: 1, }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/fixtures/bench-runner/ipc.cjs b/test/fixtures/bench-runner/ipc.cjs index e1fbca0beb9..e6b9ceb4982 100644 --- a/test/fixtures/bench-runner/ipc.cjs +++ b/test/fixtures/bench-runner/ipc.cjs @@ -5,7 +5,5 @@ const { bench } = require('node:bench'); process.send?.({ type: 'user-message' }); bench('user IPC', { samples: 1 }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/fixtures/bench-runner/many-records.cjs b/test/fixtures/bench-runner/many-records.cjs index e841c39458f..aacb1782103 100644 --- a/test/fixtures/bench-runner/many-records.cjs +++ b/test/fixtures/bench-runner/many-records.cjs @@ -4,7 +4,5 @@ const { bench } = require('node:bench'); bench('many records', { samples: 30 }, (b) => { process.stdout.write(`${b.index}\n`); - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/fixtures/bench-runner/options.cjs b/test/fixtures/bench-runner/options.cjs index 17e5cc92943..e9a1bcde9af 100644 --- a/test/fixtures/bench-runner/options.cjs +++ b/test/fixtures/bench-runner/options.cjs @@ -9,9 +9,7 @@ bench('selected', { warmup: 8, }, (b) => { invocations++; - b.start(); - process.hrtime.bigint(); - b.end(invocations); + b.record({ duration_ns: 1n, operations: invocations }); }); bench('filtered out', { samples: 1 }, () => { diff --git a/test/fixtures/bench-runner/output.cjs b/test/fixtures/bench-runner/output.cjs index 3dd9f96e549..3500f2a2338 100644 --- a/test/fixtures/bench-runner/output.cjs +++ b/test/fixtures/bench-runner/output.cjs @@ -6,7 +6,5 @@ process.stdout.write('benchmark stdout\n'); process.stderr.write('benchmark stderr\n'); bench('output', { samples: 1 }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/fixtures/bench-runner/preloaded.cjs b/test/fixtures/bench-runner/preloaded.cjs index 4e3b88c6200..b141b49e969 100644 --- a/test/fixtures/bench-runner/preloaded.cjs +++ b/test/fixtures/bench-runner/preloaded.cjs @@ -10,7 +10,5 @@ bench('preloaded', { params: { preloaded: true }, samples: 1, }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/fixtures/bench-runner/run.cjs b/test/fixtures/bench-runner/run.cjs index 197ce8b55c3..4064dc1c979 100644 --- a/test/fixtures/bench-runner/run.cjs +++ b/test/fixtures/bench-runner/run.cjs @@ -3,9 +3,7 @@ const { bench, run } = require('node:bench'); bench('declared before run', { samples: 1 }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); run(); diff --git a/test/fixtures/bench-runner/send-error.cjs b/test/fixtures/bench-runner/send-error.cjs index a647305fca7..9e1df941dfe 100644 --- a/test/fixtures/bench-runner/send-error.cjs +++ b/test/fixtures/bench-runner/send-error.cjs @@ -11,7 +11,5 @@ if (process.env.NODE_BENCH_SEND_ERROR === 'callback') { const { bench } = require('node:bench'); bench('send error', { samples: 1 }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/fixtures/bench-runner/tools-collision.cjs b/test/fixtures/bench-runner/tools-collision.cjs index 5fb27dd956d..40ab0a4d4a5 100644 --- a/test/fixtures/bench-runner/tools-collision.cjs +++ b/test/fixtures/bench-runner/tools-collision.cjs @@ -4,9 +4,7 @@ const { bench, suite } = require('node:bench'); function register(name) { bench(name, { params: { size: 1 } }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); } diff --git a/test/fixtures/bench-runner/tools-no-params.cjs b/test/fixtures/bench-runner/tools-no-params.cjs index 2dde0c2a0c6..182a7886286 100644 --- a/test/fixtures/bench-runner/tools-no-params.cjs +++ b/test/fixtures/bench-runner/tools-no-params.cjs @@ -3,7 +3,5 @@ const { bench } = require('node:bench'); bench('tools/no-params.js', (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/fixtures/bench-runner/tools-reserved-param.cjs b/test/fixtures/bench-runner/tools-reserved-param.cjs index 00052b0c8e4..8084d6c33f8 100644 --- a/test/fixtures/bench-runner/tools-reserved-param.cjs +++ b/test/fixtures/bench-runner/tools-reserved-param.cjs @@ -3,7 +3,5 @@ const { bench } = require('node:bench'); bench('tools/reserved.js', { params: { rate: 'parameter' } }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/fixtures/bench-runner/v8-option.cjs b/test/fixtures/bench-runner/v8-option.cjs index a4e60ddf738..833024161c5 100644 --- a/test/fixtures/bench-runner/v8-option.cjs +++ b/test/fixtures/bench-runner/v8-option.cjs @@ -7,7 +7,5 @@ assert.strictEqual(Error.stackTraceLimit, 17); assert(process.execArgv.includes('--random-seed=17')); bench('V8 option', { samples: 1 }, (b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }); diff --git a/test/parallel/test-bench-auto-run.js b/test/parallel/test-bench-auto-run.js index ed02fed9340..6baf7b327cd 100644 --- a/test/parallel/test-bench-auto-run.js +++ b/test/parallel/test-bench-auto-run.js @@ -14,9 +14,7 @@ const child = spawnSync(process.execPath, [ assert.strictEqual(child.status, 1); const completion = bench('automatic execution', common.mustCall((b) => { - b.start(); - process.hrtime.bigint(); - b.end(1); + b.record({ duration_ns: 1n, operations: 1 }); }, 30)); completion.then(common.mustCall((result) => {