# HG changeset patch # User Thomas Wuerthinger # Date 1326839739 -3600 # Node ID 3abb137806c7bbd46c6cbaef2bbfd13e9f693ec2 # Parent 043bec543161d6418b8e249f9b26e76a858c24f7# Parent 2bc254976621b3f28de3532be3612f12a9c6c9ce Merge. diff -r 043bec543161 -r 3abb137806c7 mx/benchmarkdb.py --- a/mx/benchmarkdb.py Tue Jan 17 23:35:21 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -import sqlite3 - -class BenchmarkDb: - def __init__(self, path): - self.con = sqlite3.connect(path) - c = self.con.cursor(); - c.execute('pragma foreign_keys = on') - c.execute('create table if not exists results (revnum integer, foreign key(benchmarkid) references benchmarks(benchmarkid), foreign key(valueid) references benchmarkvalues(valueid), value real)') - c.execute('create table if not exists benchmarks (benchmarkid integer primary key autoincrement, name text)') - c.execute('create table if not exists benchmarkvalues (valueid integer primary key autoincrement, name text)') - self.con.commit() - c.close() - - def insertResults(self, revision, results): - c = self.con.cursor() - for result in results: - if not result.has_key('benchmark'): - continue - benchmarkName = result['benchmark'] - del result['benchmark'] - if len(result.keys()) <= 0: - continue - - benchIdRow = c.execute('select benchmarkid from benchmarks where name="' + benchmarkName + '"').fetchone() - benchId = -1; - if benchIdRow is None: - c.execute('insert into benchmarks (name) values ("' + benchmarkName + '") values ') - benchId = c.lastrowid() - else: - benchId = benchIdRow['benchmarkid'] - - insertcmd = 'insert into results (revnum, benchmarkid, valueid, value) ' - first = True - for valueName in result.keys(): - valueIdRow = c.execute('select valueid from benchmarkvalues where name="' + valueName + '"').fetchone() - valueId = -1; - if valueIdRow is None: - c.execute('insert into benchmarkvalues (name) values ("' + valueName + '")') - valueId = c.lastrowid() - else: - valueId = benchIdRow['valueid'] - - if first: - insertcmd = insertcmd + 'select ' + str(revision) + ' as revnum, ' + str(benchId) + ' as benchmarkid, ' + str(valueId) + ' as valueid, ' + result[valueName] + ' as value ' - else: - insertcmd = insertcmd + 'union select ' + str(revision) + ', ' + str(benchId) + ', ' + str(valueId) + ', ' + result[valueName] + ' ' - c.execute(insertcmd) - self.con.commit() - c.close() - - def close(self): - self.con.close() \ No newline at end of file diff -r 043bec543161 -r 3abb137806c7 mx/commands.py --- a/mx/commands.py Tue Jan 17 23:35:21 2012 +0100 +++ b/mx/commands.py Tue Jan 17 23:35:39 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, 120, 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 043bec543161 -r 3abb137806c7 mx/outputparser.py --- a/mx/outputparser.py Tue Jan 17 23:35:21 2012 +0100 +++ b/mx/outputparser.py Tue Jan 17 23:35:39 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 043bec543161 -r 3abb137806c7 mx/sanitycheck.py --- a/mx/sanitycheck.py Tue Jan 17 23:35:21 2012 +0100 +++ b/mx/sanitycheck.py Tue Jan 17 23:35:39 2012 +0100 @@ -31,27 +31,27 @@ from os.path import isfile, join, exists dacapoSanityWarmup = { - 'avrora': [0, 0, 3, 6, 10], + 'avrora': [0, 0, 3, 6, 13], 'batik': [0, 0, 5, 5, 20], - 'eclipse': [2, 4, 5, 10, 13], + 'eclipse': [2, 4, 5, 10, 16], 'fop': [4, 8, 10, 20, 30], - 'h2': [0, 0, 5, 5, 5], - 'jython': [0, 0, 5, 10, 10], + 'h2': [0, 0, 5, 5, 8], + 'jython': [0, 0, 5, 10, 13], 'luindex': [0, 0, 5, 10, 10], - 'lusearch': [0, 4, 5, 5, 5], - 'pmd': [0, 0, 5, 10, 10], + 'lusearch': [0, 4, 5, 5, 8], + 'pmd': [0, 0, 5, 10, 13], 'sunflow': [0, 0, 5, 10, 15], - 'tomcat': [0, 0, 5, 10, 10], - 'tradebeans': [0, 0, 5, 10, 10], - 'tradesoap': [2, 4, 5, 10, 10], - 'xalan': [0, 0, 5, 10, 15], + 'tomcat': [0, 0, 5, 10, 15], + 'tradebeans': [0, 0, 5, 10, 13], + 'tradesoap': [2, 4, 5, 10, 15], + 'xalan': [0, 0, 5, 10, 18], } dacapoGateBuildLevels = { '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'], } @@ -87,7 +87,7 @@ if skipKitValidation: opts += ['-ikv'] - return Test("SPECjvm2008", "SPECjvm2008", ['-jar', 'SPECjvm2008.jar'] + opts, [success], [error], [matcher], vmOpts=['-Xms2g'], defaultCwd=specjvm2008) + return Test("SPECjvm2008", "SPECjvm2008", ['-jar', 'SPECjvm2008.jar'] + opts, [success], [error], [matcher], vmOpts=['-Xms3g'], defaultCwd=specjvm2008) def getDacapos(level=SanityCheckLevel.Normal, gateBuildLevel=None, dacapoArgs=[]): checks = [] @@ -117,10 +117,10 @@ dacapoMatcher = Matcher(dacapoTime, {'const:name' : 'benchmark', 'const:score' : 'time'}) - return Test("DaCapo-" + name, "DaCapo", ['-jar', dacapo, name, '-n', str(n), ] + dacapoArgs, [dacapoSuccess], [dacapoFail], [dacapoMatcher], ['-Xms1g', '-Xmx2g', '-XX:MaxPermSize=256m']) + return Test("DaCapo-" + name, "DaCapo", ['-jar', dacapo, name, '-n', str(n), ] + dacapoArgs, [dacapoSuccess], [dacapoFail], [dacapoMatcher], ['-Xms2g', '-XX:MaxPermSize=256m']) def getBootstraps(): - time = re.compile(r"Bootstrapping Graal............... in (?P