@@ -48,12 +48,13 @@ VERBOSE = False
48
48
class DriverArgs (object ):
49
49
"""Arguments for BenchmarkDriver."""
50
50
51
- def __init__ (self , tests , optimization = "O" ):
51
+ def __init__ (self , tests , optimization = "O" , architecture = None ):
52
52
"""Initialize with path to the build-dir and optimization level."""
53
53
self .benchmarks = None
54
54
self .filters = None
55
55
self .tests = os .path .join (tests , "bin" )
56
56
self .optimization = optimization
57
+ self .architecture = architecture
57
58
58
59
59
60
def log (msg ):
@@ -126,6 +127,12 @@ def main():
126
127
help = "The number of re-runs until it's assumed to be a real change" ,
127
128
default = 8 ,
128
129
)
130
+ argparser .add_argument (
131
+ "-arch" ,
132
+ type = str ,
133
+ help = "The architecture. The default is x86_64" ,
134
+ default = "x86_64" ,
135
+ )
129
136
argparser .add_argument (
130
137
"-platform" , type = str , help = "The benchmark build platform" , default = "macosx"
131
138
)
@@ -158,6 +165,7 @@ def test_opt_levels(args):
158
165
args .num_samples ,
159
166
args .num_reruns ,
160
167
output_file ,
168
+ args .arch
161
169
):
162
170
changes = True
163
171
@@ -167,6 +175,7 @@ def test_opt_levels(args):
167
175
opt_level ,
168
176
args .oldbuilddir [0 ],
169
177
args .newbuilddir [0 ],
178
+ args .arch ,
170
179
args .platform ,
171
180
output_file ,
172
181
):
@@ -177,6 +186,7 @@ def test_opt_levels(args):
177
186
"swiftlibs" ,
178
187
args .oldbuilddir [0 ],
179
188
args .newbuilddir [0 ],
189
+ args .arch ,
180
190
args .platform ,
181
191
output_file ,
182
192
):
@@ -221,7 +231,8 @@ def merge(results, other_results):
221
231
222
232
223
233
def 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
225
236
):
226
237
"""Detect performance changes in benchmarks.
227
238
@@ -231,7 +242,7 @@ def test_performance(
231
242
232
243
i , unchanged_length_count = 0 , 0
233
244
old , new = [
234
- BenchmarkDriver (DriverArgs (dir , optimization = opt_level ))
245
+ BenchmarkDriver (DriverArgs (dir , optimization = opt_level , architecture = arch ))
235
246
for dir in [old_dir , new_dir ]
236
247
]
237
248
results = [measure (driver , driver .tests , i ) for driver in [old , new ]]
@@ -260,12 +271,13 @@ def test_performance(
260
271
)
261
272
262
273
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 ):
264
275
if opt_level == "swiftlibs" :
265
276
files = glob .glob (os .path .join (old_dir , "lib" , "swift" , platform , "*.dylib" ))
266
277
else :
267
278
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" )
269
281
)
270
282
271
283
idx = 1
@@ -370,8 +382,8 @@ performance team (@eeckstein).
370
382
371
383
372
384
def 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 ))
375
387
added = set (new .tests ).difference (set (old .tests ))
376
388
new .tests = list (added )
377
389
doctor = BenchmarkDoctor (args , driver = new )
0 commit comments