Title: [188065] trunk/Tools
Revision
188065
Author
rn...@webkit.org
Date
2015-08-06 15:23:31 -0700 (Thu, 06 Aug 2015)

Log Message

Automate JSBench with run-benchmark
https://bugs.webkit.org/show_bug.cgi?id=147716

Reviewed by Chris Dumez.

Added JSBench plan to run-benchmark.

* Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py:
(GenericBenchmarkBuilder.prepare): Pass in the archive type to _fetch_remote_archive.
(GenericBenchmarkBuilder._fetch_remote_archive): Added the support for extracting files from tar.gz in addition to zip.
* Scripts/webkitpy/benchmark_runner/data/patches/Dromaeo.patch: Fixed the coding style.
* Scripts/webkitpy/benchmark_runner/data/patches/JSBench.patch: Added.
* Scripts/webkitpy/benchmark_runner/data/patches/JetStream.patch: Fixed the coding style.
* Scripts/webkitpy/benchmark_runner/data/patches/Kraken.patch: Ditto.
* Scripts/webkitpy/benchmark_runner/data/patches/Octane.patch: Ditto.
* Scripts/webkitpy/benchmark_runner/data/patches/SunSpider.patch: Ditto.
* Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-cssquery.plan: Specified the archive type.
* Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-dom.plan: Specified the archive type.
* Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-jslib.plan: Ditto.
* Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan: Fixed the coding style.
* Scripts/webkitpy/benchmark_runner/data/plans/jsbench.plan: Added.
* Scripts/webkitpy/benchmark_runner/data/plans/kraken.plan: Specified the archive type.
* Scripts/webkitpy/benchmark_runner/data/plans/octane.plan: Ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (188064 => 188065)


--- trunk/Tools/ChangeLog	2015-08-06 22:16:01 UTC (rev 188064)
+++ trunk/Tools/ChangeLog	2015-08-06 22:23:31 UTC (rev 188065)
@@ -1,3 +1,29 @@
+2015-08-06  Ryosuke Niwa  <rn...@webkit.org>
+
+        Automate JSBench with run-benchmark
+        https://bugs.webkit.org/show_bug.cgi?id=147716
+
+        Reviewed by Chris Dumez.
+
+        Added JSBench plan to run-benchmark.
+
+        * Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py:
+        (GenericBenchmarkBuilder.prepare): Pass in the archive type to _fetch_remote_archive.
+        (GenericBenchmarkBuilder._fetch_remote_archive): Added the support for extracting files from tar.gz in addition to zip.
+        * Scripts/webkitpy/benchmark_runner/data/patches/Dromaeo.patch: Fixed the coding style.
+        * Scripts/webkitpy/benchmark_runner/data/patches/JSBench.patch: Added.
+        * Scripts/webkitpy/benchmark_runner/data/patches/JetStream.patch: Fixed the coding style.
+        * Scripts/webkitpy/benchmark_runner/data/patches/Kraken.patch: Ditto.
+        * Scripts/webkitpy/benchmark_runner/data/patches/Octane.patch: Ditto.
+        * Scripts/webkitpy/benchmark_runner/data/patches/SunSpider.patch: Ditto.
+        * Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-cssquery.plan: Specified the archive type.
+        * Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-dom.plan: Specified the archive type.
+        * Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-jslib.plan: Ditto.
+        * Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan: Fixed the coding style.
+        * Scripts/webkitpy/benchmark_runner/data/plans/jsbench.plan: Added.
+        * Scripts/webkitpy/benchmark_runner/data/plans/kraken.plan: Specified the archive type.
+        * Scripts/webkitpy/benchmark_runner/data/plans/octane.plan: Ditto.
+
 2015-08-06  Yusuke Suzuki  <utatane....@gmail.com>
 
         Pass-through the undefined options in run-jsc

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py (188064 => 188065)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py	2015-08-06 22:16:01 UTC (rev 188064)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py	2015-08-06 22:23:31 UTC (rev 188065)
@@ -6,6 +6,7 @@
 import urllib
 import shutil
 import subprocess
+import tarfile
 
 from zipfile import ZipFile
 from webkitpy.benchmark_runner.utils import get_path_from_project_root, force_remove
@@ -55,12 +56,23 @@
         shutil.copytree(get_path_from_project_root(benchmark_path), self._dest)
 
     def _fetch_remote_archive(self, archive_url):
-        archive_path = os.path.join(self._web_root, 'archive.zip')
+        if archive_url.endswith('.zip'):
+            archive_type = 'zip'
+        elif archive_url.endswith('tar.gz'):
+            archive_type = 'tar.gz'
+        else:
+            raise Exception('Could not infer the file extention from URL: %s' % archive_url)
+
+        archive_path = os.path.join(self._web_root, 'archive.' + archive_type)
         _log.info('Downloading %s to %s' % (archive_url, archive_path))
         urllib.urlretrieve(archive_url, archive_path)
 
-        with ZipFile(archive_path, 'r') as archive:
-            archive.extractall(self._dest)
+        if archive_type == 'zip':
+            with ZipFile(archive_path, 'r') as archive:
+                archive.extractall(self._dest)
+        elif archive_type == 'tar.gz':
+            with tarfile.open(archive_path, 'r:gz') as archive:
+                archive.extractall(self._dest)
 
         unarchived_files = filter(lambda name: not name.startswith('.'), os.listdir(self._dest))
         if len(unarchived_files) == 1:

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Dromaeo.patch (188064 => 188065)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Dromaeo.patch	2015-08-06 22:16:01 UTC (rev 188064)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Dromaeo.patch	2015-08-06 22:23:31 UTC (rev 188065)
@@ -40,7 +40,7 @@
 +			xhr.setRequestHeader("Content-Length", results.length);
 +			xhr.setRequestHeader("Connection", "close");
 +			xhr._onreadystatechange_ = function() {
-+			if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
++			if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
 +					closeRequest = new XMLHttpRequest();
 +					closeRequest.open("GET", "/shutdown");
 +					closeRequest.send();

Added: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/JSBench.patch (0 => 188065)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/JSBench.patch	                        (rev 0)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/JSBench.patch	2015-08-06 22:23:31 UTC (rev 188065)
@@ -0,0 +1,55 @@
+diff --git a/harness.js b/harness.js
+index 4b9d269..f3f1285 100644
+--- a/harness.js
++++ b/harness.js
+@@ -104,6 +104,7 @@
+                 return;
+             }
+         } catch (ex) {}
++        setTimeout(runBenchmark, 200);
+         gob._onclick_ = function() {
+             gob.style.display = "none";
+             setTimeout(runBenchmark, 200);
+@@ -207,6 +208,8 @@
+         var spc = "\u00a0\u00a0";
+         var spc2 = spc + spc;
+ 
++        var tests = {};
++
+         // calculate all the real results
+         for (var b = 0; b < benchmarks.length; b++) {
+             var benchmark = benchmarks[b];
+@@ -221,6 +224,9 @@
+                 var bmresults = results[benchmark][mode].slice(-keepRuns);
+                 if (bmresults.length == 0) continue;
+ 
++                if (pr)
++                    tests[benchmark] = {'metrics': {'Time': {'current': bmresults}}};
++
+                 // get the raw results
+                 var rr = spc2 + mode + ": [";
+                 for (var i = 0; i < bmresults.length; i++) {
+@@ -272,6 +278,23 @@
+             ptotals.push(spc + curRun + " runs");
+         ptotals.push("");
+ 
++        if (pr) {
++            var jsonResults = JSON.stringify({"JSBench": {"metrics": {"Time": ["Geometric"]}, "tests": tests}});
++            var xhr = new XMLHttpRequest();
++            xhr.open("POST", "/report");
++            xhr.setRequestHeader("Content-Type", "application/json");
++            xhr.setRequestHeader("Content-Length", jsonResults.length);
++            xhr.setRequestHeader("Connection", "close");
++            xhr._onreadystatechange_ = function() {
++            if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
++                    closeRequest = new XMLHttpRequest();
++                    closeRequest.open("GET", "/shutdown");
++                    closeRequest.send();
++                }
++            }
++            xhr.send(jsonResults);
++        }
++
+         // if there are errors, mark those too
+         if ("errors" in results) {
+             ptotals.push("ERRORS:");

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/JetStream.patch (188064 => 188065)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/JetStream.patch	2015-08-06 22:16:01 UTC (rev 188064)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/JetStream.patch	2015-08-06 22:23:31 UTC (rev 188065)
@@ -31,7 +31,7 @@
 +        xhr.setRequestHeader("Connection", "close");
 + 
 +        xhr._onreadystatechange_ = function() {
-+        if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
++        if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
 +                closeRequest = new XMLHttpRequest();
 +                closeRequest.open("GET", "/shutdown");
 +                closeRequest.send()

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Kraken.patch (188064 => 188065)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Kraken.patch	2015-08-06 22:16:01 UTC (rev 188064)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Kraken.patch	2015-08-06 22:23:31 UTC (rev 188065)
@@ -32,7 +32,7 @@
 +    xhr.setRequestHeader("Content-Length", results.length);
 +    xhr.setRequestHeader("Connection", "close");
 +    xhr._onreadystatechange_ = function() {
-+    if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
++    if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
 +            closeRequest = new XMLHttpRequest();
 +            closeRequest.open("GET", "/shutdown");
 +            closeRequest.send();

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Octane.patch (188064 => 188065)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Octane.patch	2015-08-06 22:16:01 UTC (rev 188064)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Octane.patch	2015-08-06 22:23:31 UTC (rev 188065)
@@ -56,7 +56,7 @@
 +    xhr.setRequestHeader("Content-Length", results.length);
 +    xhr.setRequestHeader("Connection", "close");
 +    xhr._onreadystatechange_ = function() {
-+    if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
++    if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
 +            closeRequest = new XMLHttpRequest();
 +            closeRequest.open("GET", "/shutdown");
 +            closeRequest.send();

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/SunSpider.patch (188064 => 188065)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/SunSpider.patch	2015-08-06 22:16:01 UTC (rev 188064)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/SunSpider.patch	2015-08-06 22:23:31 UTC (rev 188065)
@@ -35,7 +35,7 @@
 +    xhr.setRequestHeader("Content-Length", results.length);
 +    xhr.setRequestHeader("Connection", "close");
 +    xhr._onreadystatechange_ = function() {
-+    if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
++    if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
 +            closeRequest = new XMLHttpRequest();
 +            closeRequest.open("GET", "/shutdown");
 +            closeRequest.send();

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan (188064 => 188065)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan	2015-08-06 22:16:01 UTC (rev 188064)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan	2015-08-06 22:23:31 UTC (rev 188065)
@@ -1,6 +1,6 @@
 {
     "http_server_driver": "SimpleHTTPServerDriver", 
-    "timeout" : 600,
+    "timeout": 600,
     "count": 5,
     "benchmark_builder": "GenericBenchmarkBuilder",
     "svn_source": "https://svn.webkit.org/repository/webkit/trunk/PerformanceTests/JetStream/@r183091",

Added: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/plans/jsbench.plan (0 => 188065)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/data/plans/jsbench.plan	                        (rev 0)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/data/plans/jsbench.plan	2015-08-06 22:23:31 UTC (rev 188065)
@@ -0,0 +1,10 @@
+{
+    "http_server_driver": "SimpleHTTPServerDriver", 
+    "timeout": 600,
+    "count": 1,
+    "benchmark_builder": "GenericBenchmarkBuilder",
+    "remote_archive": "http://plg.uwaterloo.ca/~dynjs/jsbench/suite/jsbench-2013.1.tar.gz",
+    "benchmark_patch": "data/patches/JSBench.patch",
+    "entry_point": "index.html",
+    "output_file": "jsbench.result"
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to