File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434)
3535# Environment variables that control the execution of CPython
3636ENV_VARS = ["PYTHON_JIT" , "PYPERF_PERF_RECORD_EXTRA_OPTS" ]
37+ LOOPS_FILE_ENV_VAR = "PYPERFORMANCE_LOOPS_FILE"
3738
3839
3940class NoBenchmarkError (Exception ):
@@ -82,6 +83,10 @@ def run_benchmarks(
8283 if extra_args is None :
8384 extra_args = []
8485
86+ if loops_file := os .environ .get (LOOPS_FILE_ENV_VAR ):
87+ extra_args .append ("--same-loops" )
88+ extra_args .append (loops_file )
89+
8590 if affinity := os .environ .get ("CPU_AFFINITY" ):
8691 extra_args .append (f"--affinity={ affinity } " )
8792
@@ -133,7 +138,12 @@ def collect_pystats(
133138
134139 all_benchmarks = get_benchmark_names (benchmarks )
135140
136- extra_args = ["--same-loops" , "loops.json" , "--hook" , "pystats" ]
141+ # Default to loops.json if not explicitly set, like before the
142+ # environment variable was added.
143+ if LOOPS_FILE_ENV_VAR not in os .environ :
144+ os .environ [LOOPS_FILE_ENV_VAR ] = "loops.json"
145+
146+ extra_args = ["--hook" , "pystats" ]
137147
138148 if flags is None :
139149 flags = []
You can’t perform that action at this time.
0 commit comments