Mercurial > hg > graal-compiler
comparison mx.graal/mx_graal.py @ 22145:d5a51a47eb1b
mx: make bench command extensible
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 08 Jul 2015 11:23:43 +0200 |
parents | 258eaaa98484 |
children | b50bd2ed6779 |
comparison
equal
deleted
inserted
replaced
22142:13a10252efa4 | 22145:d5a51a47eb1b |
---|---|
245 if t: dacapo(['pmd']) | 245 if t: dacapo(['pmd']) |
246 | 246 |
247 with Task('UnitTests:' + theVm + ':' + vmbuild, tasks) as t: | 247 with Task('UnitTests:' + theVm + ':' + vmbuild, tasks) as t: |
248 if t: unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api', 'java.test']) | 248 if t: unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api', 'java.test']) |
249 | 249 |
250 mx_jvmci.gateRunners.append(_graal_gate_runner) | |
251 | |
250 def deoptalot(args): | 252 def deoptalot(args): |
251 """bootstrap a VM with DeoptimizeALot and VerifyOops on | 253 """bootstrap a VM with DeoptimizeALot and VerifyOops on |
252 | 254 |
253 If the first argument is a number, the process will be repeated | 255 If the first argument is a number, the process will be repeated |
254 this number of times. All other arguments are passed to the VM.""" | 256 this number of times. All other arguments are passed to the VM.""" |
264 def longtests(args): | 266 def longtests(args): |
265 | 267 |
266 deoptalot(['15', '-Xmx48m']) | 268 deoptalot(['15', '-Xmx48m']) |
267 | 269 |
268 dacapo(['100', 'eclipse', '-esa']) | 270 dacapo(['100', 'eclipse', '-esa']) |
271 | |
272 """ | |
273 Extra benchmarks to run from 'bench()'. | |
274 """ | |
275 extraBenchmarks = [] | |
269 | 276 |
270 def bench(args): | 277 def bench(args): |
271 """run benchmarks and parse their output for results | 278 """run benchmarks and parse their output for results |
272 | 279 |
273 Results are JSON formated : {group : {benchmark : score}}.""" | 280 Results are JSON formated : {group : {benchmark : score}}.""" |
278 resultFile = args[index + 1] | 285 resultFile = args[index + 1] |
279 del args[index] | 286 del args[index] |
280 del args[index] | 287 del args[index] |
281 else: | 288 else: |
282 mx.abort('-resultfile must be followed by a file name') | 289 mx.abort('-resultfile must be followed by a file name') |
290 resultFileCSV = None | |
291 if '-resultfilecsv' in args: | |
292 index = args.index('-resultfilecsv') | |
293 if index + 1 < len(args): | |
294 resultFileCSV = args[index + 1] | |
295 del args[index] | |
296 del args[index] | |
297 else: | |
298 mx.abort('-resultfilecsv must be followed by a file name') | |
283 vm = get_vm() | 299 vm = get_vm() |
284 if len(args) is 0: | 300 if len(args) is 0: |
285 args = ['all'] | 301 args = ['all'] |
286 | 302 |
287 vmArgs = [arg for arg in args if arg.startswith('-')] | 303 vmArgs = [arg for arg in args if arg.startswith('-')] |
335 if 'ctw-full' in args: | 351 if 'ctw-full' in args: |
336 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.Full)) | 352 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.Full)) |
337 if 'ctw-noinline' in args: | 353 if 'ctw-noinline' in args: |
338 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.NoInline)) | 354 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.NoInline)) |
339 | 355 |
356 for f in extraBenchmarks: | |
357 f(args, vm, benchmarks) | |
358 | |
340 for test in benchmarks: | 359 for test in benchmarks: |
341 for (groupName, res) in test.bench(vm, extraVmOpts=vmArgs).items(): | 360 for (groupName, res) in test.bench(vm, extraVmOpts=vmArgs).items(): |
342 group = results.setdefault(groupName, {}) | 361 group = results.setdefault(groupName, {}) |
343 group.update(res) | 362 group.update(res) |
344 mx.log(json.dumps(results)) | 363 mx.log(json.dumps(results)) |
345 if resultFile: | 364 if resultFile: |
346 with open(resultFile, 'w') as f: | 365 with open(resultFile, 'w') as f: |
347 f.write(json.dumps(results)) | 366 f.write(json.dumps(results)) |
367 if resultFileCSV: | |
368 with open(resultFileCSV, 'w') as f: | |
369 for key1, value1 in results.iteritems(): | |
370 f.write('%s;\n' % (str(key1))) | |
371 for key2, value2 in sorted(value1.iteritems()): | |
372 f.write('%s; %s;\n' % (str(key2), str(value2))) | |
348 | 373 |
349 def specjvm2008(args): | 374 def specjvm2008(args): |
350 """run one or more SPECjvm2008 benchmarks""" | 375 """run one or more SPECjvm2008 benchmarks""" |
351 | 376 |
352 def launcher(bm, harnessArgs, extraVmOpts): | 377 def launcher(bm, harnessArgs, extraVmOpts): |