# HG changeset patch # User Gilles Duboscq # Date 1326467494 -3600 # Node ID a9a63d4b0414dd66686d018628906bd55b6d24f2 # Parent 62cb0e636094e0814c73651a0846e1d6b444a6b6# Parent 063ea022532cd16c719abc21aeac4a5d60e19a4c Merge diff -r 62cb0e636094 -r a9a63d4b0414 mx/commands.py --- a/mx/commands.py Thu Jan 12 13:48:27 2012 -0800 +++ b/mx/commands.py Fri Jan 13 16:11:34 2012 +0100 @@ -31,6 +31,7 @@ from argparse import ArgumentParser, REMAINDER import mx import sanitycheck +import json _graal_home = dirname(dirname(__file__)) _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src')) @@ -507,19 +508,50 @@ total.stop() def bench(args): + """run benchmarks and parse their ouput for results + + Results are JSON formated : {group : {benchmark : score}}.""" + resultFile = None + if '-resultfile' in args: + index = args.index('-resultfile') + if index + 1 < len(args): + resultFile = args[index + 1] + del args[index] + del args[index] + else: + mx.abort('-resultfile must be followed by a file name') + vm = 'graal' + if '-vm' in args: + index = args.index('-vm') + if index + 1 < len(args): + vm = args[index + 1] + del args[index] + del args[index] + else: + mx.abort('-vm must be followed by a vm name (graal, server, client..)') + if len(args) is 0: + args += ['all'] + results = {} + benchmarks = [] #DaCapo - benchmarks = sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Benchmark) + if ('dacapo' in args or 'all' in args): + benchmarks += sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Benchmark) #Bootstrap - benchmarks += sanitycheck.getBootstraps() + if ('bootstrap' in args or 'all' in args): + benchmarks += sanitycheck.getBootstraps() #SPECjvm2008 - benchmarks += [sanitycheck.getSPECjvm2008(True, 60, 120)] + if ('specjvm2008' in args or 'all' in args): + benchmarks += [sanitycheck.getSPECjvm2008(True, 60, 120)] for test in benchmarks: if not results.has_key(test.group): results[test.group] = {} - results[test.group].update(test.bench('-graal')) - print results + results[test.group].update(test.bench('-' + vm)) + mx.log(json.dumps(results)) + if resultFile: + with open(resultFile, 'w') as f: + f.write(json.dumps(results)) def specjvm2008(args): sanitycheck.getSPECjvm2008().bench('-graal') @@ -534,7 +566,7 @@ 'specjvm2008': [specjvm2008, ''], 'example': [example, '[-v] example names...'], 'gate' : [gate, ''], - 'bench' : [bench, ''], + 'bench' : [bench, '[-vm vm] [-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], 'unittest' : [unittest, '[filters...]'], 'vm': [vm, '[-options] class [args...]'] } diff -r 62cb0e636094 -r a9a63d4b0414 mx/outputparser.py --- a/mx/outputparser.py Thu Jan 12 13:48:27 2012 -0800 +++ b/mx/outputparser.py Fri Jan 13 16:11:34 2012 +0100 @@ -37,7 +37,7 @@ self.matchers.append(matcher) def parse(self, vm, cmd, cwd=None, vmbuild=None): - ret = [{}] + ret = [] def parseLine(line): anyMatch = False @@ -45,7 +45,7 @@ parsed = matcher.parse(line.strip()) if parsed: anyMatch = True - if matcher.startNewLine and len(ret[0]) > 0: + if len(ret) is 0 or (matcher.startNewLine and len(ret[len(ret)-1]) > 0): ret.append({}) ret[len(ret)-1].update(parsed) if anyMatch : diff -r 62cb0e636094 -r a9a63d4b0414 mx/sanitycheck.py --- a/mx/sanitycheck.py Thu Jan 12 13:48:27 2012 -0800 +++ b/mx/sanitycheck.py Fri Jan 13 16:11:34 2012 +0100 @@ -120,7 +120,7 @@ return Test("DaCapo-" + name, "DaCapo", ['-jar', dacapo, name, '-n', str(n), ] + dacapoArgs, [dacapoSuccess], [dacapoFail], [dacapoMatcher], ['-Xms1g', '-Xmx2g', '-XX:MaxPermSize=256m']) def getBootstraps(): - time = re.compile(r"Bootstrapping Graal............... in (?P