annotate perf/benchmarktool.py @ 3534:a97b5881c222

Remove Java projects from repository.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 10 Aug 2011 01:16:22 +0200
parents 53502e3f3e0d
children 344264424174
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3235
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1 import subprocess
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
2 import os
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
3 import re
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
4 import sys
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
5 import argparse
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
6
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
7 DEFAULT_DACAPO_OPTS = " -XX:MaxPermSize=512m -Xms1g -Xmx2g "
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
8 DEFAULT_SCIMARK_OPTS = " -Xms32m -Xmx100m "
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
9
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
10 def runBash(cmd):
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
11 p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
12 return p.stdout
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
13
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
14 def s2msString(floatString):
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
15 return str(round(float(floatString)*1000))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
16
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
17 # Raw String Notation (r"") : \ instead of \\
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
18 graalTime = re.compile(r"Total compilation time\s+:\s+([0-9]+\.[0-9]+) s")
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
19 graalSubTime = re.compile(r"([a-zA-Z0-9_ ]+)\s+:\s+([0-9]+\.[0-9]+) s \([0-9 ][0-9]\.[0-9]{2}%\)")
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
20
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
21 def matchGraalTime(string, csvOutput, csvOutputLine, writeHeaderAt):
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
22 match1 = graalTime.search(string)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
23 match2 = graalSubTime.search(string)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
24 if match1:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
25 if csvOutputLine == writeHeaderAt:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
26 csvOutput[0].append('graal total')
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
27 print('Graal total time: '+ s2msString(match1.group(1)))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
28 csvOutput[csvOutputLine].append(s2msString(match1.group(1)))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
29 elif match2:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
30 if csvOutputLine == writeHeaderAt:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
31 csvOutput[0].append(match2.group(1).strip())
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
32 print('Graal specific time: '+match2.group(1)+': '+s2msString(match2.group(2)))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
33 csvOutput[csvOutputLine].append(s2msString(match2.group(2)))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
34 else:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
35 print('# '+string)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
36
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
37 def writeout(outputFile, csvOutput):
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
38 for csvLine in csvOutput :
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
39 outputFile.write(';'.join(csvLine)+';'+os.linesep)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
40
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
41 def main():
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
42 # Check for environment variables
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
43 if os.getenv('JDK7') is None:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
44 print('Environment variable JDK7 is not defined.')
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
45 return 1
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
46 if os.getenv('DACAPO') is None:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
47 print('Environment variable DACAPO is not defined. It must point to a directory with the DaCapo benchmark jar.')
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
48 return 1
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
49 if os.getenv('SCIMARK') is None:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
50 print('Environment variable SCIMARK is not defined. It must point to a directory with the SciMark benchmark jar.')
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
51 return 1
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
52 if os.getenv('REFERENCE_JDK') is None:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
53 print('Environment variable REFERENCE_JDK is not defined.')
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
54 return 1
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
55
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
56 # Option parsing
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
57 parser = argparse.ArgumentParser(description='Automated DaCapo and Scimark bechmarks')
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
58 parser.add_argument('-a', '-all', help='run all benchmarks for all compilers', action='store_true')
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
59 parser.add_argument('-c', type=str, help='compiler to use', default='graal', choices=['client', 'server', 'graal'], required=False)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
60 parser.add_argument('-n', type=int, help='number of DaCapo benchmarks to run', default=10)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
61 parser.add_argument('-o', type=str, help='graalVM options(quoted!)', default='')
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
62 parser.add_argument('-runonly', type=str, help='run specified benchmark only', default='all')
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
63 options = parser.parse_args()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
64 compilerFlags = {'graal' : '-client -graal -G:+Time -XX:-GraalBailoutIsFatal -G:QuietBailout ',
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
65 'client' : '-client',
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
66 'server' : '-server'}
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
67
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
68 if options.a:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
69 compilers = ['graal', 'client', 'server']
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
70 else:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
71 compilers = [options.c]
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
72
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
73 for compiler in compilers:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
74
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
75 outputFile = open(compiler+'.csv', 'w')
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
76
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
77 # DaCapo Benchmarks
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
78 if compiler == 'graal':
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
79 vm = os.environ['JDK7']
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
80 else :
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
81 vm = os.environ['REFERENCE_JDK']
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
82
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
83 cmd = '"' + vm + '/bin/java" ' + compilerFlags[compiler] + ' -d64 ' + DEFAULT_DACAPO_OPTS + options.o + ' -classpath ' + \
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
84 os.environ['DACAPO'] + '/dacapo-9.12-bach.jar Harness -n ' + str(options.n) + ' '
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
85 benchmarks = runBash('java -jar ' + os.environ['DACAPO'] + '/dacapo-9.12-bach.jar -l').read().decode().split(' ')
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
86
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
87 benchmarkTime = re.compile(r"===== DaCapo 9\.12 ([a-zA-Z0-9_]+) ((PASSED)|(completed warmup [0-9]+)) in ([0-9]+) msec =====")
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
88
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
89 csvOutput = [['benchmark', 'type', 'time']]
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
90 csvOutputLine = 0
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
91 for benchmark in benchmarks:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
92 if options.runonly != 'all' and benchmark != options.runonly:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
93 continue
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
94 nRuns = 0
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
95 dcOutput = runBash(cmd + benchmark)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
96 while True:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
97 line = dcOutput.readline().decode()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
98 if not line:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
99 break
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
100 line = line.strip()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
101 match = benchmarkTime.search(line)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
102 if match:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
103 csvOutputLine = csvOutputLine + 1
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
104 nRuns = nRuns + 1
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
105 csvOutput.append(list())
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
106 csvOutput[csvOutputLine].append(str(nRuns))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
107 print('Benchmark type: '+match.group(1))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
108 print('Benchmark time: '+match.group(5))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
109 csvOutput[csvOutputLine].append(match.group(1))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
110 csvOutput[csvOutputLine].append(match.group(5))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
111 else:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
112 matchGraalTime(line, csvOutput, csvOutputLine, options.n)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
113
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
114 if nRuns < options.n:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
115 csvOutputLine = csvOutputLine + (options.n - nRuns)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
116 for i in range(options.n - nRuns):
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
117 csvOutput.append([str(nRuns + i), benchmark, '0'])
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
118
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
119 writeout(outputFile, csvOutput)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
120
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
121 if options.runonly != 'all' and options.runonly != 'scimark':
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
122 outputFile.close()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
123 return 0
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
124
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
125 # Scimark Benchmarks
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
126 writeout(outputFile, [['']])
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
127 cmd = '"' + vm + '/bin/java" ' + compilerFlags[compiler] + ' -d64 ' + DEFAULT_SCIMARK_OPTS + options.o + \
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
128 ' -Xbootclasspath/a:' + os.environ['SCIMARK'] + '/scimark2lib.jar jnt.scimark2.commandline'
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
129
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
130 benchmarkScore = re.compile(r"([a-zA-Z0-9_\(\),= ]+):\s+([0-9]+\.[0-9]+)$")
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
131
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
132 csvOutput = [['run'],[]]
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
133 scOutput = runBash(cmd)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
134 while True:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
135 line = scOutput.readline().decode()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
136 if not line:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
137 break
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
138 line = line.strip()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
139 match = benchmarkScore.search(line)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
140 if match:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
141 print('Scimark '+match.group(1)+' score: '+match.group(2))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
142 csvOutput[0].append(match.group(1).strip())
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
143 csvOutput[1].append(match.group(2))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
144 else:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
145 matchGraalTime(line,csvOutput, 1, 1)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
146
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
147 writeout(outputFile, csvOutput)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
148 outputFile.close()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
149
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
150 return 0
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
151
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
152 #This idiom means the below code only runs when executed from command line
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
153 if __name__ == '__main__':
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
154 sys.exit(main())