Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion bench_runner/scripts/run_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
)
# Environment variables that control the execution of CPython
ENV_VARS = ["PYTHON_JIT", "PYPERF_PERF_RECORD_EXTRA_OPTS"]
LOOPS_FILE_ENV_VAR = "PYPERFORMANCE_LOOPS_FILE"


class NoBenchmarkError(Exception):
Expand Down Expand Up @@ -82,6 +83,10 @@ def run_benchmarks(
if extra_args is None:
extra_args = []

if loops_file := os.environ.get(LOOPS_FILE_ENV_VAR):
extra_args.append("--same-loops")
extra_args.append(loops_file)

if affinity := os.environ.get("CPU_AFFINITY"):
extra_args.append(f"--affinity={affinity}")

Expand Down Expand Up @@ -133,7 +138,12 @@ def collect_pystats(

all_benchmarks = get_benchmark_names(benchmarks)

extra_args = ["--same-loops", "loops.json", "--hook", "pystats"]
# Default to loops.json if not explicitly set, like before the
# environment variable was added.
if LOOPS_FILE_ENV_VAR not in os.environ:
os.environ[LOOPS_FILE_ENV_VAR] = "loops.json"

extra_args = ["--hook", "pystats"]

if flags is None:
flags = []
Expand Down