Skip to content

Commit e18965c

Browse files
feat(tinybench-plugin): allow perf profiling in tinybench walltime
1 parent 8267158 commit e18965c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/tinybench-plugin/src/walltime.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
calculateQuantiles,
3+
InstrumentHooks,
34
mongoMeasurement,
45
msToNs,
56
msToS,
@@ -17,6 +18,7 @@ export function runWalltimeBench(bench: Bench, rootCallingFile: string): void {
1718
console.log(
1819
`[CodSpeed] running with @codspeed/tinybench v${__VERSION__} (walltime mode)`
1920
);
21+
InstrumentHooks.setIntegration("codspeed-node", __VERSION__);
2022

2123
// Store the original run method before we override it
2224
const originalRun = bench.run;
@@ -40,7 +42,9 @@ export function runWalltimeBench(bench: Bench, rootCallingFile: string): void {
4042
await task.warmup();
4143
}
4244
await mongoMeasurement.start(uri);
45+
InstrumentHooks.startBenchmark();
4346
const taskResult = await task.run();
47+
InstrumentHooks.stopBenchmark();
4448
await mongoMeasurement.stop(uri);
4549
results.push(taskResult);
4650

@@ -67,8 +71,8 @@ export function runWalltimeBench(bench: Bench, rootCallingFile: string): void {
6771
};
6872

6973
benchmarks.push(benchmark);
70-
7174
console.log(` ✔ Collected walltime data for ${uri}`);
75+
InstrumentHooks.setExecutedBenchmark(process.pid, uri);
7276
} else {
7377
console.warn(` ⚠ No result data available for ${uri}`);
7478
}

0 commit comments

Comments
 (0)