diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-16 11:45:59 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-16 11:45:59 -0800 |
commit | bf33399a6196913042186a9de86ae91b5219b7f1 (patch) | |
tree | 3543104563de98461d3f489dfd9b06deb8fa68c2 /tests | |
parent | d4ab93c4469931ea944e7480df3bf7652bea1ee0 (diff) |
gcc benchmarker
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_benchmark.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py index dc9a6ce3..67db3df0 100644 --- a/tests/test_benchmark.py +++ b/tests/test_benchmark.py @@ -50,12 +50,23 @@ class Benchmarker: else: print -class ClangBenchmarker(Benchmarker): +class NativeBenchmarker(Benchmarker): + def __init__(self, name, cc, cxx): + self.name = name + self.cc = cc + self.cxx = cxx + def build(self, parent, filename, args, shared_args, emcc_args, native_args, native_exec): self.parent = parent if not native_exec: - parent.build_native(filename, shared_args + native_args) + compiler = self.cxx if filename.endswith('cpp') else self.cc + process = Popen([compiler, '-O2', '-fno-math-errno', filename, '-o', filename+'.native'] + shared_args + native_args, stdout=PIPE, stderr=parent.stderr_redirect) + output = process.communicate() + if process.returncode is not 0: + print >> sys.stderr, "Building native executable with command '%s' failed with a return code %d!" % (' '.join([compiler, '-O2', filename, '-o', filename+'.native']), process.returncode) + print "Output: " + output[0] else: + print '(using clang)' shutil.copyfile(native_exec, filename + '.native') shutil.copymode(native_exec, filename + '.native') self.filename = filename @@ -98,7 +109,8 @@ process(sys.argv[1]) # Benchmarkers benchmarkers = [ - ClangBenchmarker('clang'), + NativeBenchmarker('clang', CLANG_CC, CLANG), + NativeBenchmarker('gcc', 'gcc', 'g++'), JSBenchmarker('JS-f32', SPIDERMONKEY_ENGINE, ['-s', 'PRECISE_F32=2']), JSBenchmarker('JS', SPIDERMONKEY_ENGINE), JSBenchmarker('v8', V8_ENGINE) |