@@ -48,12 +48,13 @@ VERBOSE = False
4848class DriverArgs (object ):
4949 """Arguments for BenchmarkDriver."""
5050
51- def __init__ (self , tests , optimization = "O" ):
51+ def __init__ (self , tests , optimization = "O" , architecture = None ):
5252 """Initialize with path to the build-dir and optimization level."""
5353 self .benchmarks = None
5454 self .filters = None
5555 self .tests = os .path .join (tests , "bin" )
5656 self .optimization = optimization
57+ self .architecture = architecture
5758
5859
5960def log (msg ):
@@ -126,6 +127,12 @@ def main():
126127 help = "The number of re-runs until it's assumed to be a real change" ,
127128 default = 8 ,
128129 )
130+ argparser .add_argument (
131+ "-arch" ,
132+ type = str ,
133+ help = "The architecture. The default is x86_64" ,
134+ default = "x86_64" ,
135+ )
129136 argparser .add_argument (
130137 "-platform" , type = str , help = "The benchmark build platform" , default = "macosx"
131138 )
@@ -158,6 +165,7 @@ def test_opt_levels(args):
158165 args .num_samples ,
159166 args .num_reruns ,
160167 output_file ,
168+ args .arch
161169 ):
162170 changes = True
163171
@@ -167,6 +175,7 @@ def test_opt_levels(args):
167175 opt_level ,
168176 args .oldbuilddir [0 ],
169177 args .newbuilddir [0 ],
178+ args .arch ,
170179 args .platform ,
171180 output_file ,
172181 ):
@@ -177,6 +186,7 @@ def test_opt_levels(args):
177186 "swiftlibs" ,
178187 args .oldbuilddir [0 ],
179188 args .newbuilddir [0 ],
189+ args .arch ,
180190 args .platform ,
181191 output_file ,
182192 ):
@@ -221,7 +231,8 @@ def merge(results, other_results):
221231
222232
223233def test_performance (
224- opt_level , old_dir , new_dir , threshold , num_samples , num_reruns , output_file
234+ opt_level , old_dir , new_dir , threshold , num_samples , num_reruns ,
235+ output_file , arch
225236):
226237 """Detect performance changes in benchmarks.
227238
@@ -231,7 +242,7 @@ def test_performance(
231242
232243 i , unchanged_length_count = 0 , 0
233244 old , new = [
234- BenchmarkDriver (DriverArgs (dir , optimization = opt_level ))
245+ BenchmarkDriver (DriverArgs (dir , optimization = opt_level , architecture = arch ))
235246 for dir in [old_dir , new_dir ]
236247 ]
237248 results = [measure (driver , driver .tests , i ) for driver in [old , new ]]
@@ -260,12 +271,13 @@ def test_performance(
260271 )
261272
262273
263- def report_code_size (opt_level , old_dir , new_dir , platform , output_file ):
274+ def report_code_size (opt_level , old_dir , new_dir , architecture , platform , output_file ):
264275 if opt_level == "swiftlibs" :
265276 files = glob .glob (os .path .join (old_dir , "lib" , "swift" , platform , "*.dylib" ))
266277 else :
267278 files = glob .glob (
268- os .path .join (old_dir , opt_level + "-*" + platform + "*" , "*.o" )
279+ os .path .join (old_dir , opt_level + "-" + architecture + "*" +
280+ platform + "*" , "*.o" )
269281 )
270282
271283 idx = 1
@@ -370,8 +382,8 @@ performance team (@eeckstein).
370382
371383
372384def check_added (args , output_file = None ):
373- old = BenchmarkDriver (DriverArgs (args .oldbuilddir [0 ]))
374- new = BenchmarkDriver (DriverArgs (args .newbuilddir [0 ]))
385+ old = BenchmarkDriver (DriverArgs (args .oldbuilddir [0 ], architecture = args . arch ))
386+ new = BenchmarkDriver (DriverArgs (args .newbuilddir [0 ], architecture = args . arch ))
375387 added = set (new .tests ).difference (set (old .tests ))
376388 new .tests = list (added )
377389 doctor = BenchmarkDoctor (args , driver = new )
0 commit comments