run-benchmark's results should contain Animometer's debug output
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 May 2016 03:57:34 +0000 (03:57 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 May 2016 03:57:34 +0000 (03:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157941

Reviewed by Stephanie Lewis.

PerformanceTests:

Made developer.html support the JSON generated by run-benchmark which stores everything under debugOutput.

* Animometer/resources/debug-runner/animometer.js:
(Utilities.initialize): Unwrap debugOutput in the case run-benchmark's result JSON is used.

Tools:

Modified the Animometer patch to store debug output and made benchmark_runner extract them together as a single array.
The result can be dragged and dropped into Animometer's developer.html page.

* Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
(BenchmarkRunner._run_one_test): Parse JSON here instead of doing it in multiple call sites.
(BenchmarkRunner._run_benchmark): Strip debugOutput from individual test result, and merge them together separately.
* Scripts/webkitpy/benchmark_runner/data/patches/Animometer.patch:
Modified the patch to store the debug output.
* Scripts/webkitpy/benchmark_runner/http_server_driver/http_server/twisted_http_server.py:
(ServerControl.render_POST): Fixed a bug that POST to /report results in 500 because getvalue is not defined
when the request body is larger than a certain size on twisted.

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

PerformanceTests/Animometer/resources/debug-runner/animometer.js
PerformanceTests/ChangeLog
Tools/ChangeLog
Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py
Tools/Scripts/webkitpy/benchmark_runner/data/patches/Animometer.patch
Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/http_server/twisted_http_server.py

index 8430b84..55d1a99 100644 (file)
@@ -531,6 +531,8 @@ Utilities.extendObject(window.benchmarkController, {
             reader.filename = file.name;
             reader.onload = function(e) {
                 var run = JSON.parse(e.target.result);
+                if (run.debugOutput instanceof Array)
+                    run = run.debugOutput[0];
                 benchmarkRunnerClient.results = new ResultsDashboard(run.options, run.data);
                 benchmarkController.showResults();
             };
index 6c63060..57f7e82 100644 (file)
@@ -1,3 +1,15 @@
+2016-05-20  Ryosuke Niwa  <rniwa@webkit.org>
+
+        run-benchmark's results should contain Animometer's debug output
+        https://bugs.webkit.org/show_bug.cgi?id=157941
+
+        Reviewed by Stephanie Lewis.
+
+        Made developer.html support the JSON generated by run-benchmark which stores everything under debugOutput.
+
+        * Animometer/resources/debug-runner/animometer.js:
+        (Utilities.initialize): Unwrap debugOutput in the case run-benchmark's result JSON is used.
+
 2016-05-18  Timothy Hatcher  <timothy@apple.com>
 
         Make Animometer work in all browsers
index 81c262d..61f3f2d 100644 (file)
@@ -1,3 +1,22 @@
+2016-05-20  Ryosuke Niwa  <rniwa@webkit.org>
+
+        run-benchmark's results should contain Animometer's debug output
+        https://bugs.webkit.org/show_bug.cgi?id=157941
+
+        Reviewed by Stephanie Lewis.
+
+        Modified the Animometer patch to store debug output and made benchmark_runner extract them together as a single array.
+        The result can be dragged and dropped into Animometer's developer.html page.
+
+        * Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
+        (BenchmarkRunner._run_one_test): Parse JSON here instead of doing it in multiple call sites.
+        (BenchmarkRunner._run_benchmark): Strip debugOutput from individual test result, and merge them together separately.
+        * Scripts/webkitpy/benchmark_runner/data/patches/Animometer.patch:
+        Modified the patch to store the debug output.
+        * Scripts/webkitpy/benchmark_runner/http_server_driver/http_server/twisted_http_server.py:
+        (ServerControl.render_POST): Fixed a bug that POST to /report results in 500 because getvalue is not defined
+        when the request body is larger than a certain size on twisted.
+
 2016-05-20  Srinivasan Vijayaraghavan  <svijayaraghavan@apple.com>
 
         Use clearer names for JSON output of javascriptcore test results
index e3a0425..25b3ba4 100644 (file)
@@ -78,10 +78,11 @@ class BenchmarkRunner(object):
             self._browser_driver.close_browsers()
             self._http_server_driver.kill_server()
 
-        return result
+        return json.loads(result)
 
     def _run_benchmark(self, count, web_root):
         results = []
+        debug_outputs = []
         for iteration in xrange(1, count + 1):
             _log.info('Start the iteration {current_iteration} of {iterations} for current benchmark'.format(current_iteration=iteration, iterations=count))
             try:
@@ -89,14 +90,16 @@ class BenchmarkRunner(object):
 
                 if 'entry_point' in self._plan:
                     result = self._run_one_test(web_root, self._plan['entry_point'])
+                    debug_outputs.append(result.pop('debugOutput', None))
                     assert(result)
-                    results.append(json.loads(result))
+                    results.append(result)
                 elif 'test_files' in self._plan:
                     run_result = {}
                     for test in self._plan['test_files']:
                         result = self._run_one_test(web_root, test)
                         assert(result)
-                        run_result = self._merge(run_result, json.loads(result))
+                        run_result = self._merge(run_result, result)
+                        debug_outputs.append(result.pop('debugOutput', None))
 
                     results.append(run_result)
                 else:
@@ -109,7 +112,8 @@ class BenchmarkRunner(object):
             _log.info('End the iteration {current_iteration} of {iterations} for current benchmark'.format(current_iteration=iteration, iterations=count))
 
         results = self._wrap(results)
-        self._dump(results, self._output_file if self._output_file else self._plan['output_file'])
+        output_file = self._output_file if self._output_file else self._plan['output_file']
+        self._dump(self._merge({'debugOutput': debug_outputs}, results), output_file)
         self.show_results(results, self._scale_unit)
 
     def execute(self):
index 592cc85..8e2126e 100644 (file)
@@ -2,7 +2,7 @@ diff --git a/resources/runner/animometer.js b/resources/runner/animometer.js
 index b20a1c9..e434e89 100644
 --- a/resources/runner/animometer.js
 +++ b/resources/runner/animometer.js
-@@ -320,6 +320,57 @@ window.benchmarkRunnerClient = {
+@@ -320,6 +320,61 @@ window.benchmarkRunnerClient = {
      didFinishLastIteration: function()
      {
          benchmarkController.showResults();
@@ -37,7 +37,11 @@ index b20a1c9..e434e89 100644
 +    {
 +        var results = this.results.results[0];
 +        var iterationReports = this._computeIterationReports(results);
-+        return {"Animometer": {"metrics" : {"Score" : ["Geometric"]}, "tests" : iterationReports } };
++        var debugOutput = {
++            options: benchmarkRunnerClient.results.options,
++            data: benchmarkRunnerClient.results.data,
++        }
++        return {"Animometer": {"metrics" : {"Score" : ["Geometric"]}, "tests" : iterationReports }, "debugOutput": debugOutput};
 +    },
 +
 +    didFinishLastIteration: function()
index 97f2848..9ff3fcd 100644 (file)
@@ -27,7 +27,7 @@ class ServerControl(Resource):
 
     def render_POST(self, request):
         _log.info("Serving request %s" % request)
-        sys.stdout.write(request.content.getvalue())
+        sys.stdout.write(request.content.read())
         sys.stdout.flush()
         reactor.stop()
         return 'OK'