Add the support for running StyleBench to run-benchmark
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jan 2018 20:58:20 +0000 (20:58 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jan 2018 20:58:20 +0000 (20:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182323

Reviewed by Antti Koivisto.

Added the plan file and the patch needed to run StyleBench using run-benchmark as of r227863.

* Scripts/webkitpy/benchmark_runner/data/patches/webserver/StyleBench.patch: Added.
* Scripts/webkitpy/benchmark_runner/data/plans/stylebench.plan: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227925 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/benchmark_runner/data/patches/webserver/StyleBench.patch [new file with mode: 0644]
Tools/Scripts/webkitpy/benchmark_runner/data/plans/stylebench.plan [new file with mode: 0644]

index 08a1c28..b2743b0 100644 (file)
@@ -1,3 +1,15 @@
+2018-01-31  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Add the support for running StyleBench to run-benchmark
+        https://bugs.webkit.org/show_bug.cgi?id=182323
+
+        Reviewed by Antti Koivisto.
+
+        Added the plan file and the patch needed to run StyleBench using run-benchmark as of r227863.
+
+        * Scripts/webkitpy/benchmark_runner/data/patches/webserver/StyleBench.patch: Added.
+        * Scripts/webkitpy/benchmark_runner/data/plans/stylebench.plan: Added.
+
 2018-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS WK2] API test DataInteractionTests.ExternalSourceDataTransferItemGetFolderAsEntry is failing after an SDK update
diff --git a/Tools/Scripts/webkitpy/benchmark_runner/data/patches/webserver/StyleBench.patch b/Tools/Scripts/webkitpy/benchmark_runner/data/patches/webserver/StyleBench.patch
new file mode 100644 (file)
index 0000000..cc7a2da
--- /dev/null
@@ -0,0 +1,80 @@
+diff --git a/index.html b/index.html
+index 1269f30e646..2edd6770af6 100644
+--- a/index.html
++++ b/index.html
+@@ -7,7 +7,6 @@
+     <script src="resources/main.js" defer></script>
+     <script src="resources/benchmark-runner.js" defer></script>
+     <script src="resources/benchmark-report.js" defer></script>
+-    <script src="../resources/statistics.js" defer></script>
+     <script src="resources/style-bench.js" defer></script>
+     <script src="resources/tests.js" defer></script>
+ </head>
+diff --git a/resources/benchmark-report.js b/resources/benchmark-report.js
+index c4b4c64f83d..962c0560265 100644
+--- a/resources/benchmark-report.js
++++ b/resources/benchmark-report.js
+@@ -1,5 +1,63 @@
+ // This file can be customized to report results as needed.
++(function () {
++    window.onload = function () {
++        startBenchmark();
++        showSection('running');
++    }
++
++    originalDidFinishLastIteration = window.benchmarkClient.didFinishLastIteration;
++
++    window.benchmarkClient.didFinishLastIteration = function () {
++        originalDidFinishLastIteration.apply(this);
++
++        const scores = [];
++        const resultsSuites = {};
++        const results = {'StyleBench': {
++            'metrics': {
++                'Score': {'current': [scores]},
++                'Time': ['Total', 'Geometric']},
++                'tests': resultsSuites}};
++
++        for (const measuredValues of this._measuredValuesList) {
++            scores.push(measuredValues.score);
++            for (const suiteName in measuredValues.tests) {
++                const measuredTests = measuredValues.tests[suiteName].tests;
++                if (!(suiteName in resultsSuites))
++                    resultsSuites[suiteName] = {'metrics': {'Time': ['Total']}, 'tests': {}};
++                const resultsTests = resultsSuites[suiteName].tests;
++                for (const testName in measuredTests) {
++                    const measuredSubtests = measuredTests[testName].tests;
++                    if (!(testName in resultsTests))
++                        resultsTests[testName] = {'metrics': {'Time': ['Total']}, 'tests': {}};
++                    const resultsSubtests = resultsTests[testName].tests;
++                    for (const subtestName in measuredSubtests) {
++                        if (!(subtestName in resultsSubtests))
++                            resultsSubtests[subtestName] = {'metrics': {'Time': {'current': [[]]}}};
++                        resultsSubtests[subtestName].metrics.Time.current[0].push(measuredSubtests[subtestName]);
++                    }
++                }
++            }
++        }
++
++        const xhr = new XMLHttpRequest();
++        xhr.open("POST", "/report");
++
++        xhr.setRequestHeader("Content-type", "application/json");
++        xhr.setRequestHeader("Content-length", results.length);
++        xhr.setRequestHeader("Connection", "close");
++
++        xhr.onreadystatechange = function() {
++            if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
++                const closeRequest = new XMLHttpRequest();
++                closeRequest.open("GET", "/shutdown");
++                closeRequest.send();
++            }
++        }
++        setTimeout(() => xhr.send(JSON.stringify(results)), 5000);
++    }
++})();
++
+ (function () {
+     if (!window.testRunner && location.search != '?webkit' && location.hash != '#webkit')
+         return;
diff --git a/Tools/Scripts/webkitpy/benchmark_runner/data/plans/stylebench.plan b/Tools/Scripts/webkitpy/benchmark_runner/data/plans/stylebench.plan
new file mode 100644 (file)
index 0000000..87485ce
--- /dev/null
@@ -0,0 +1,8 @@
+{
+    "timeout": 600,
+    "count": 4,
+    "svn_source": "https://svn.webkit.org/repository/webkit/trunk/PerformanceTests/StyleBench/@r227863",
+    "webserver_benchmark_patch": "data/patches/webserver/StyleBench.patch",
+    "entry_point": "index.html",
+    "output_file": "stylebench.result"
+}