Add jsbench
[c11concurrency-benchmarks.git] / jsbench-2013.1 / run.py
diff --git a/jsbench-2013.1/run.py b/jsbench-2013.1/run.py
new file mode 100755 (executable)
index 0000000..f7f16df
--- /dev/null
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+# Copyright (C) 2011, 2012 Purdue University
+# Written by Gregor Richards
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+# 1. Redistributions of source code must retain the above copyright notice,
+#    this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+#    this list of conditions and the following disclaimer in the documentation
+#    and/or other materials provided with the distribution.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import math
+import os
+import re
+import sys
+
+benchmarks = [
+       "amazon/chrome", "amazon/chrome-win", "amazon/firefox",
+       "amazon/firefox-win", "amazon/safari",
+       "facebook/chrome", "facebook/chrome-win", "facebook/firefox",
+       "facebook/firefox-win", "facebook/safari",
+       "google/chrome", "google/chrome-win", "google/firefox",
+       "google/firefox-win", "google/safari",
+       "twitter/chrome", "twitter/chrome-win", "twitter/firefox",
+       "twitter/firefox-win", "twitter/safari",
+       "yahoo/chrome", "yahoo/chrome-win", "yahoo/firefox",
+       "yahoo/firefox-win", "yahoo/safari",
+]
+
+modes = {
+       "*": ["urem"],
+       "amazon/firefox": ["urm"],
+       "amazon/firefox-win": ["urm"],
+       "google/firefox": ["uem"],
+       "twitter/chrome-win": ["rem"]
+};
+
+if len(sys.argv) != 2:
+       print ("Use: python harness.py <JS executable>")
+       exit(1)
+js = sys.argv[1]
+
+for benchmark in benchmarks:
+       bmode = ''
+       if benchmark in modes:
+               bmode = modes[benchmark]
+       else:
+               bmode = modes['*']
+
+       path = benchmark + '/' + ''.join(bmode) + '.js'
+       res = os.popen(js + " " + path).read()
+
+       if res == '':
+               res = 'error\n'
+       print(benchmark + "\t" + res, end = '')