Skip to content

Commit 631569a

Browse files
committed
feat: warmup performance map generation
1 parent 247a3a7 commit 631569a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/pytest_codspeed/plugin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ def _run_with_instrumentation(
169169
def __codspeed_root_frame__():
170170
fn(*args, **kwargs)
171171

172+
if SUPPORTS_PERF_TRAMPOLINE:
173+
# Warmup CPython performance map cache
174+
__codspeed_root_frame__()
175+
172176
lib.zero_stats()
173177
lib.start_instrumentation()
174178
__codspeed_root_frame__()

tests/test_pytest_plugin.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import pytest
55
from conftest import (
6+
IS_PERF_TRAMPOLINE_SUPPORTED,
67
skip_with_perf_trampoline,
78
skip_without_perf_trampoline,
89
skip_without_pytest_benchmark,
@@ -118,11 +119,14 @@ def _():
118119
print()
119120
"""
120121
)
122+
EXPECTED_OUTPUT_COUNT = 2 if IS_PERF_TRAMPOLINE_SUPPORTED else 1
121123
with codspeed_env():
122124
run_result = pytester.runpytest("--codspeed", "-s")
123125
print(run_result.stdout.str())
124-
assert run_result.outlines.count("I'm noisy marked!!!") == 1
125-
assert run_result.outlines.count("I'm noisy fixtured!!!") == 1
126+
assert run_result.outlines.count("I'm noisy marked!!!") == EXPECTED_OUTPUT_COUNT
127+
assert (
128+
run_result.outlines.count("I'm noisy fixtured!!!") == EXPECTED_OUTPUT_COUNT
129+
)
126130

127131

128132
@skip_without_valgrind

0 commit comments

Comments
 (0)