Skip to content

Commit

Permalink
fixup! feat: add a root frame for the callgraph generation
Browse files Browse the repository at this point in the history
  • Loading branch information
art049 committed Jun 21, 2023
1 parent 41be397 commit d24465b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/tinybench-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ export function withCodSpeed(bench: Bench): Bench {
console.log(`[CodSpeed] running with @codspeed/tinybench v${__VERSION__}`);
for (const task of bench.tasks) {
const uri = callingFile + "::" + task.name;
await (async function __codspeed_root_frame__() {
await optimizeFunction(task.fn);
measurement.startInstrumentation();
// eslint-disable-next-line no-inner-declarations
async function __codspeed_root_frame__() {
await task.fn();
measurement.stopInstrumentation(uri);
})();
}
await optimizeFunction(__codspeed_root_frame__);
measurement.startInstrumentation();
await __codspeed_root_frame__();
measurement.stopInstrumentation(uri);
console.log(` ✔ Measured ${uri}`);
}
console.log(`[CodSpeed] Done running ${bench.tasks.length} benches.`);
Expand Down

0 comments on commit d24465b

Please sign in to comment.