annotate perf/benchmarktool.py @ 3671:415aa4a73b95

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 18 Nov 2011 16:23:41 +0100
parents 7d9e3ee49ac9
children
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()
3543
344264424174 Enable debugging of compiler code from Java IDEs. Moved binary to "graal" subdirectory. New flag for starting Graal is just "-graal".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3235
diff changeset
64 compilerFlags = {'graal' : '-graal -G:+Time -XX:-GraalBailoutIsFatal -G:QuietBailout ',
3235
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 =====")
3551
7d9e3ee49ac9 Made default for GraalBailoutIsFatal "false".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3543
diff changeset
88 print('command: ' + cmd)
3235
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
89
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
90 csvOutput = [['benchmark', 'type', 'time']]
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
91 csvOutputLine = 0
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
92 for benchmark in benchmarks:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
93 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
94 continue
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
95 nRuns = 0
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
96 dcOutput = runBash(cmd + benchmark)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
97 while True:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
98 line = dcOutput.readline().decode()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
99 if not line:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
100 break
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
101 line = line.strip()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
102 match = benchmarkTime.search(line)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
103 if match:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
104 csvOutputLine = csvOutputLine + 1
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
105 nRuns = nRuns + 1
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
106 csvOutput.append(list())
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
107 csvOutput[csvOutputLine].append(str(nRuns))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
108 print('Benchmark type: '+match.group(1))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
109 print('Benchmark time: '+match.group(5))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
110 csvOutput[csvOutputLine].append(match.group(1))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
111 csvOutput[csvOutputLine].append(match.group(5))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
112 else:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
113 matchGraalTime(line, csvOutput, csvOutputLine, options.n)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
114
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
115 if nRuns < options.n:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
116 csvOutputLine = csvOutputLine + (options.n - nRuns)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
117 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
118 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
119
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
120 writeout(outputFile, csvOutput)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
121
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
122 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
123 outputFile.close()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
124 return 0
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
125
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
126 # Scimark Benchmarks
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
127 writeout(outputFile, [['']])
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
128 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
129 ' -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
130
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
131 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
132
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
133 csvOutput = [['run'],[]]
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
134 scOutput = runBash(cmd)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
135 while True:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
136 line = scOutput.readline().decode()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
137 if not line:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
138 break
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
139 line = line.strip()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
140 match = benchmarkScore.search(line)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
141 if match:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
142 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
143 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
144 csvOutput[1].append(match.group(2))
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
145 else:
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
146 matchGraalTime(line,csvOutput, 1, 1)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
147
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
148 writeout(outputFile, csvOutput)
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
149 outputFile.close()
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
150
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
151 return 0
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
152
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
153 #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
154 if __name__ == '__main__':
53502e3f3e0d Changed benchmarktool to python script instead of shell script
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
155 sys.exit(main())