# HG changeset patch # User Lukas Stadler # Date 1326707994 -3600 # Node ID f9552a2593635c94bc7e80cf84b71d2005f9c437 # Parent dd67881406c26541783820575a715e4d47f503a2# Parent 1339f1817d285700b606b03ee5d12e92fa5c5cba Merge diff -r dd67881406c2 -r f9552a259363 mx/commands.py --- a/mx/commands.py Fri Jan 13 15:27:47 2012 +0100 +++ b/mx/commands.py Mon Jan 16 10:59:54 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 dd67881406c2 -r f9552a259363 mx/outputparser.py --- a/mx/outputparser.py Fri Jan 13 15:27:47 2012 +0100 +++ b/mx/outputparser.py Mon Jan 16 10:59:54 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 dd67881406c2 -r f9552a259363 mx/sanitycheck.py --- a/mx/sanitycheck.py Fri Jan 13 15:27:47 2012 +0100 +++ b/mx/sanitycheck.py Mon Jan 16 10:59:54 2012 +0100 @@ -51,7 +51,7 @@ 'avrora': ['product', 'fastdebug', 'debug'], 'batik': ['product', 'fastdebug', 'debug'], 'eclipse': ['product'], - 'fop': ['product', 'fastdebug', 'debug'], + 'fop': [ 'fastdebug', 'debug'], 'h2': ['product', 'fastdebug', 'debug'], 'jython': ['product', 'fastdebug', 'debug'], 'luindex': ['product', 'fastdebug', 'debug'], @@ -60,7 +60,7 @@ 'sunflow': ['product', 'fastdebug', 'debug'], 'tomcat': ['product', 'fastdebug', 'debug'], 'tradebeans': ['product', 'fastdebug', 'debug'], - 'tradesoap': ['product', 'fastdebug', 'debug'], + 'tradesoap': ['product'], 'xalan': ['product', 'fastdebug', 'debug'], } @@ -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