File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 34
34
)
35
35
# Environment variables that control the execution of CPython
36
36
ENV_VARS = ["PYTHON_JIT" , "PYPERF_PERF_RECORD_EXTRA_OPTS" ]
37
+ LOOPS_FILE_ENV_VAR = "PYPERFORMANCE_LOOPS_FILE"
37
38
38
39
39
40
class NoBenchmarkError (Exception ):
@@ -82,6 +83,10 @@ def run_benchmarks(
82
83
if extra_args is None :
83
84
extra_args = []
84
85
86
+ if loops_file := os .environ .get (LOOPS_FILE_ENV_VAR ):
87
+ extra_args .append ("--same-loops" )
88
+ extra_args .append (loops_file )
89
+
85
90
if affinity := os .environ .get ("CPU_AFFINITY" ):
86
91
extra_args .append (f"--affinity={ affinity } " )
87
92
@@ -133,7 +138,12 @@ def collect_pystats(
133
138
134
139
all_benchmarks = get_benchmark_names (benchmarks )
135
140
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" ]
137
147
138
148
if flags is None :
139
149
flags = []
You can’t perform that action at this time.
0 commit comments