Skip to content

Commit 2ecfdb3

Browse files
--wip-- [skip ci]
1 parent 62e169f commit 2ecfdb3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/tinybench-plugin/src/walltime.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ class CodspeedFrame {
2121
}
2222

2323
// Make the instance callable by delegating to the dynamic method
24-
call() {
25-
return this.task.run();
24+
async __codspeed_root_frame__() {
25+
InstrumentHooks.startBenchmark();
26+
const result = await this.task.run();
27+
InstrumentHooks.stopBenchmark();
28+
29+
return result;
2630
}
2731
}
2832

@@ -54,8 +58,8 @@ export function runWalltimeBench(bench: Bench, rootCallingFile: string): void {
5458
await task.warmup();
5559
}
5660
await mongoMeasurement.start(uri);
57-
const __cosdspeed_root_frame__ = new CodspeedFrame(task);
58-
const taskResult = await __cosdspeed_root_frame__.call();
61+
const frame = new CodspeedFrame(task);
62+
const taskResult = await frame.__codspeed_root_frame__();
5963
await mongoMeasurement.stop(uri);
6064
results.push(taskResult);
6165

0 commit comments

Comments
 (0)