@@ -224,6 +224,8 @@ def __codspeed_root_frame__() -> T:
224224 # Benchmark
225225 iter_range = range (iter_per_round )
226226 run_start = perf_counter_ns ()
227+ if self .instrument_hooks :
228+ self .instrument_hooks .start_benchmark ()
227229 for _ in range (rounds ):
228230 start = perf_counter_ns ()
229231 for _ in iter_range :
@@ -234,6 +236,9 @@ def __codspeed_root_frame__() -> T:
234236 if end - run_start > benchmark_config .max_time_ns :
235237 # TODO: log something
236238 break
239+ if self .instrument_hooks :
240+ self .instrument_hooks .stop_benchmark ()
241+ self .instrument_hooks .set_executed_benchmark (uri )
237242 benchmark_end = perf_counter_ns ()
238243 total_time = (benchmark_end - run_start ) / 1e9
239244
@@ -250,7 +255,7 @@ def __codspeed_root_frame__() -> T:
250255 )
251256 return out
252257
253- def measure_pedantic (
258+ def measure_pedantic ( # noqa: C901
254259 self ,
255260 marker_options : BenchmarkMarkerOptions ,
256261 pedantic_options : PedanticOptions [T ],
@@ -277,6 +282,8 @@ def __codspeed_root_frame__(*args, **kwargs) -> T:
277282 # Benchmark
278283 times_per_round_ns : list [float ] = []
279284 benchmark_start = perf_counter_ns ()
285+ if self .instrument_hooks :
286+ self .instrument_hooks .start_benchmark ()
280287 for _ in range (pedantic_options .rounds ):
281288 start = perf_counter_ns ()
282289 args , kwargs = pedantic_options .setup_and_get_args_kwargs ()
@@ -286,7 +293,9 @@ def __codspeed_root_frame__(*args, **kwargs) -> T:
286293 times_per_round_ns .append (end - start )
287294 if pedantic_options .teardown is not None :
288295 pedantic_options .teardown (* args , ** kwargs )
289-
296+ if self .instrument_hooks :
297+ self .instrument_hooks .stop_benchmark ()
298+ self .instrument_hooks .set_executed_benchmark (uri )
290299 benchmark_end = perf_counter_ns ()
291300 total_time = (benchmark_end - benchmark_start ) / 1e9
292301 stats = BenchmarkStats .from_list (
0 commit comments