comparison mx/commands.py @ 7563:3aab15f42934

moved execution of a benchmark out of OutputParser
author Doug Simon <doug.simon@oracle.com>
date Wed, 30 Jan 2013 11:03:32 +0100
parents a200d10867f1
children 9a521597686b
comparison
equal deleted inserted replaced
7562:1c09bcebd61f 7563:3aab15f42934
923 del args[index] 923 del args[index]
924 else: 924 else:
925 mx.abort('-resultfile must be followed by a file name') 925 mx.abort('-resultfile must be followed by a file name')
926 vm = _vm 926 vm = _vm
927 if len(args) is 0: 927 if len(args) is 0:
928 args += ['all'] 928 args = ['all']
929
930 def benchmarks_in_group(group):
931 prefix = group + ':'
932 return [a[len(prefix):] for a in args if a.startswith(prefix)]
929 933
930 results = {} 934 results = {}
931 benchmarks = [] 935 benchmarks = []
932 #DaCapo 936 #DaCapo
933 if ('dacapo' in args or 'all' in args): 937 if ('dacapo' in args or 'all' in args):
934 benchmarks += sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Benchmark) 938 benchmarks += sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
935 else: 939 else:
936 dacapos = [a[7:] for a in args if a.startswith('dacapo:')] 940 dacapos = benchmarks_in_group('dacapo')
937 for dacapo in dacapos: 941 for dacapo in dacapos:
938 if dacapo not in sanitycheck.dacapoSanityWarmup.keys(): 942 if dacapo not in sanitycheck.dacapoSanityWarmup.keys():
939 mx.abort('Unknown dacapo : ' + dacapo) 943 mx.abort('Unknown DaCapo : ' + dacapo)
940 benchmarks += [sanitycheck.getDacapo(dacapo, sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark])] 944 benchmarks += [sanitycheck.getDacapo(dacapo, sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark])]
941 945
942 if ('scaladacapo' in args or 'all' in args): 946 if ('scaladacapo' in args or 'all' in args):
943 benchmarks += sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Benchmark) 947 benchmarks += sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
944 else: 948 else:
945 dacapos = [a[7:] for a in args if a.startswith('scaladacapo:')] 949 scaladacapos = benchmarks_in_group('scaladacapo')
946 for dacapo in dacapos: 950 for scaladacapo in scaladacapos:
947 if dacapo not in sanitycheck.dacapoScalaSanityWarmup.keys(): 951 if scaladacapo not in sanitycheck.dacapoScalaSanityWarmup.keys():
948 mx.abort('Unknown dacapo : ' + dacapo) 952 mx.abort('Unknown Scala DaCapo : ' + scaladacapo)
949 benchmarks += [sanitycheck.getScalaDacapo(dacapo, sanitycheck.dacapoScalaSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark])] 953 benchmarks += [sanitycheck.getScalaDacapo(scaladacapo, sanitycheck.dacapoScalaSanityWarmup[scaladacapo][sanitycheck.SanityCheckLevel.Benchmark])]
950 954
951 #Bootstrap 955 #Bootstrap
952 if ('bootstrap' in args or 'all' in args): 956 if ('bootstrap' in args or 'all' in args):
953 benchmarks += sanitycheck.getBootstraps() 957 benchmarks += sanitycheck.getBootstraps()
954 #SPECjvm2008 958 #SPECjvm2008
955 if ('specjvm2008' in args or 'all' in args): 959 if ('specjvm2008' in args or 'all' in args):
956 benchmarks += [sanitycheck.getSPECjvm2008([], False, True, 120, 120)] 960 benchmarks += [sanitycheck.getSPECjvm2008([], False, True, 120, 120)]
957 else: 961 else:
958 specjvms = [a[12:] for a in args if a.startswith('specjvm2008:')] 962 specjvms = benchmarks_in_group('specjvm2008')
959 for specjvm in specjvms: 963 for specjvm in specjvms:
960 benchmarks += [sanitycheck.getSPECjvm2008([specjvm], False, True, 120, 120)] 964 benchmarks += [sanitycheck.getSPECjvm2008([specjvm], False, True, 120, 120)]
961 965
962 if ('specjbb2005' in args or 'all' in args): 966 if ('specjbb2005' in args or 'all' in args):
963 benchmarks += [sanitycheck.getSPECjbb2005()] 967 benchmarks += [sanitycheck.getSPECjbb2005()]
964 968
965 for test in benchmarks: 969 for test in benchmarks:
966 for (group, res) in test.bench(vm).items(): 970 for (groupName, res) in test.bench(vm).items():
967 if not results.has_key(group): 971 group = results.setdefault(groupName, {})
968 results[group] = {}; 972 group.update(res)
969 results[group].update(res)
970 mx.log(json.dumps(results)) 973 mx.log(json.dumps(results))
971 if resultFile: 974 if resultFile:
972 with open(resultFile, 'w') as f: 975 with open(resultFile, 'w') as f:
973 f.write(json.dumps(results)) 976 f.write(json.dumps(results))
974 977