Mercurial > hg > truffle
comparison mx/mx_graal.py @ 13935:ca0e1af320f6
mx: add support for jmh benchmark suites
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Wed, 12 Feb 2014 20:12:33 +0200 |
parents | c4e5a685c6a1 |
children | 69928d77bc0a |
comparison
equal
deleted
inserted
replaced
13934:f4dedec9b225 | 13935:ca0e1af320f6 |
---|---|
1261 group.update(res) | 1261 group.update(res) |
1262 mx.log(json.dumps(results)) | 1262 mx.log(json.dumps(results)) |
1263 if resultFile: | 1263 if resultFile: |
1264 with open(resultFile, 'w') as f: | 1264 with open(resultFile, 'w') as f: |
1265 f.write(json.dumps(results)) | 1265 f.write(json.dumps(results)) |
1266 | |
1267 def jmh(args): | |
1268 """run the JMH_BENCHMARKS""" | |
1269 | |
1270 # TODO: add option for `mvn clean package' | |
1271 # TODO: add options to pass through arguments directly to JMH | |
1272 | |
1273 vmArgs, benchmarks = _extract_VM_args(args) | |
1274 jmhPath = mx.get_env('JMH_BENCHMARKS', None) | |
1275 if not exists(jmhPath): | |
1276 mx.abort("$JMH_BENCHMARKS not properly definied") | |
1277 | |
1278 def _blackhole(x): | |
1279 mx.logv(x[:-1]) | |
1280 | |
1281 mx.run(['mvn', 'package'], cwd = jmhPath, out = _blackhole) | |
1282 | |
1283 matchedSuites = set() | |
1284 for micros in os.listdir(jmhPath): | |
1285 absoluteMicro = os.path.join(jmhPath, micros) | |
1286 if not os.path.isdir(absoluteMicro): | |
1287 continue | |
1288 if not micros.startswith("micros-"): | |
1289 mx.logv('JMH: ignored ' + absoluteMicro + " because it doesn't start with 'micros-'") | |
1290 continue | |
1291 | |
1292 if benchmarks: | |
1293 def _addBenchmark(x): | |
1294 if x.startswith("Benchmark:"): | |
1295 return | |
1296 match = False | |
1297 for b in benchmarks: | |
1298 match = match or (b in x) | |
1299 | |
1300 if match: | |
1301 matchedSuites.add(micros) | |
1302 | |
1303 mx.run_java(['-jar', os.path.join(absoluteMicro, "target", "microbenchmarks.jar"), "-l"], cwd = jmhPath, out = _addBenchmark) | |
1304 else: | |
1305 matchedSuites.add(micros) | |
1306 | |
1307 mx.logv("matchedSuites: " + str(matchedSuites)) | |
1308 | |
1309 regex = [] | |
1310 if benchmarks: | |
1311 regex.append(r".*(" + "|".join(benchmarks) + ").*") | |
1312 | |
1313 for suite in matchedSuites: | |
1314 absoluteMicro = os.path.join(jmhPath, suite) | |
1315 vm(['-jar', os.path.join(absoluteMicro, "target", "microbenchmarks.jar"), | |
1316 "-f", "1", | |
1317 "-i", "10", "-wi", "10", | |
1318 "--jvmArgs", " ".join(["-" + _get_vm()] + vmArgs)] + regex, | |
1319 vm = 'original', | |
1320 cwd = jmhPath) | |
1321 | |
1266 | 1322 |
1267 def specjvm2008(args): | 1323 def specjvm2008(args): |
1268 """run one or more SPECjvm2008 benchmarks""" | 1324 """run one or more SPECjvm2008 benchmarks""" |
1269 | 1325 |
1270 def launcher(bm, harnessArgs, extraVmOpts): | 1326 def launcher(bm, harnessArgs, extraVmOpts): |
1546 'generateZshCompletion' : [generateZshCompletion, ''], | 1602 'generateZshCompletion' : [generateZshCompletion, ''], |
1547 'hsdis': [hsdis, '[att]'], | 1603 'hsdis': [hsdis, '[att]'], |
1548 'hcfdis': [hcfdis, ''], | 1604 'hcfdis': [hcfdis, ''], |
1549 'igv' : [igv, ''], | 1605 'igv' : [igv, ''], |
1550 'jdkhome': [print_jdkhome, ''], | 1606 'jdkhome': [print_jdkhome, ''], |
1607 'jmh': [jmh, '[VM options] [filters...]'], | |
1551 'dacapo': [dacapo, '[VM options] benchmarks...|"all" [DaCapo options]'], | 1608 'dacapo': [dacapo, '[VM options] benchmarks...|"all" [DaCapo options]'], |
1552 'scaladacapo': [scaladacapo, '[VM options] benchmarks...|"all" [Scala DaCapo options]'], | 1609 'scaladacapo': [scaladacapo, '[VM options] benchmarks...|"all" [Scala DaCapo options]'], |
1553 'specjvm2008': [specjvm2008, '[VM options] benchmarks...|"all" [SPECjvm2008 options]'], | 1610 'specjvm2008': [specjvm2008, '[VM options] benchmarks...|"all" [SPECjvm2008 options]'], |
1554 'specjbb2013': [specjbb2013, '[VM options] [-- [SPECjbb2013 options]]'], | 1611 'specjbb2013': [specjbb2013, '[VM options] [-- [SPECjbb2013 options]]'], |
1555 'specjbb2005': [specjbb2005, '[VM options] [-- [SPECjbb2005 options]]'], | 1612 'specjbb2005': [specjbb2005, '[VM options] [-- [SPECjbb2005 options]]'], |