Skip to content

Commit cb2e48d

Browse files
committed
wip: use callgrind marker directly
1 parent 47d08f0 commit cb2e48d

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/pytest_codspeed/instruments/valgrind.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,14 @@ def __codspeed_root_frame__() -> T:
6767
# Warmup CPython performance map cache
6868
__codspeed_root_frame__()
6969

70-
# Manually call the library function to avoid an extra stack frame
71-
self.instrument_hooks.lib.instrument_hooks_start_benchmark(
72-
self.instrument_hooks.instance
73-
)
70+
# Manually call the library function to avoid an extra stack frame. Also
71+
# call the callgrind markers directly to avoid extra overhead.
72+
self.instrument_hooks.lib.callgrind_start_instrumentation()
7473
try:
7574
return __codspeed_root_frame__()
7675
finally:
7776
# Ensure instrumentation is stopped even if the test failed
78-
self.instrument_hooks.lib.instrument_hooks_stop_benchmark(
79-
self.instrument_hooks.instance
80-
)
77+
self.instrument_hooks.lib.callgrind_stop_instrumentation()
8178
self.instrument_hooks.set_current_benchmark(uri)
8279

8380
def report(self, session: Session) -> None:

0 commit comments

Comments
 (0)