Skip to content

Commit

Permalink
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 19, 2023
1 parent a2d0d88 commit 459b0f9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/tinybench-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ 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 optimizeFunction(task.fn);
measurement.startInstrumentation();
await task.fn();
measurement.stopInstrumentation(uri);
await (async function __codspeed_root_frame__() {
await optimizeFunction(task.fn);
measurement.startInstrumentation();
await task.fn();
measurement.stopInstrumentation(uri);
})();
console.log(` ✔ Measured ${uri}`);
}
console.log(`[CodSpeed] Done running ${bench.tasks.length} benches.`);
Expand Down

0 comments on commit 459b0f9

Please sign in to comment.