File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -177,16 +177,21 @@ async function runBenchmarks({
177
177
} else {
178
178
benchPayload = bench . fn as CallableFunction ;
179
179
}
180
+
180
181
if ( isAsync ) {
181
182
await optimizeFunction ( benchPayload ) ;
182
- measurement . startInstrumentation ( ) ;
183
- await benchPayload ( ) ;
184
- measurement . stopInstrumentation ( uri ) ;
183
+ await ( async function __codspeed_root_frame__ ( ) {
184
+ measurement . startInstrumentation ( ) ;
185
+ await benchPayload ( ) ;
186
+ measurement . stopInstrumentation ( uri ) ;
187
+ } ) ( ) ;
185
188
} else {
186
189
optimizeFunctionSync ( benchPayload ) ;
187
- measurement . startInstrumentation ( ) ;
188
- benchPayload ( ) ;
189
- measurement . stopInstrumentation ( uri ) ;
190
+ ( function __codspeed_root_frame__ ( ) {
191
+ measurement . startInstrumentation ( ) ;
192
+ benchPayload ( ) ;
193
+ measurement . stopInstrumentation ( uri ) ;
194
+ } ) ( ) ;
190
195
}
191
196
console . log ( ` ✔ Measured ${ uri } ` ) ;
192
197
benchmarkCompletedListeners . forEach ( ( listener ) => listener ( ) ) ;
Original file line number Diff line number Diff line change @@ -25,9 +25,11 @@ export function withCodSpeed(bench: Bench): Bench {
25
25
for ( const task of bench . tasks ) {
26
26
const uri = callingFile + "::" + task . name ;
27
27
await optimizeFunction ( task . fn ) ;
28
- measurement . startInstrumentation ( ) ;
29
- await task . fn ( ) ;
30
- measurement . stopInstrumentation ( uri ) ;
28
+ await ( async function __codspeed_root_frame__ ( ) {
29
+ measurement . startInstrumentation ( ) ;
30
+ await task . fn ( ) ;
31
+ measurement . stopInstrumentation ( uri ) ;
32
+ } ) ( ) ;
31
33
console . log ( ` ✔ Measured ${ uri } ` ) ;
32
34
}
33
35
console . log ( `[CodSpeed] Done running ${ bench . tasks . length } benches.` ) ;
You can’t perform that action at this time.
0 commit comments