[PerformanceTests] run-perf-tests should output correct units
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2012 03:13:28 +0000 (03:13 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2012 03:13:28 +0000 (03:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78303

Reviewed by Ryosuke Niwa.

Previously run-perf-tests just supported "ms" for units.
Consequently, Dromaeo perf tests had been reporting runs/s as "ms".
This patch fixes run-perf-tests so that they can support custom units.
The default unit is "ms".

The test result looks like this:

$ ./Tools/Scripts/run-perf-tests Dromaeo/dom-attr.html
RESULT Dromaeo: dom-attr= 6465.9525483 runs/s
median= 0.0 runs/s, stdev= 24.2983433436 runs/s, min= 6435.87649402 runs/s, max= 6515.63693392 runs/s

PerformanceTests:

* Dromaeo/resources/dromaeorunner.js:
(.):
* resources/runner.js:
(PerfTestRunner.computeStatistics):
(PerfTestRunner.printStatistics):

Tools:

* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(PerfTestsRunner._process_parser_test_result):

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

PerformanceTests/ChangeLog
PerformanceTests/Dromaeo/resources/dromaeorunner.js
PerformanceTests/resources/runner.js
Tools/ChangeLog
Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py

index dc412d3..954fa30 100644 (file)
@@ -1,3 +1,27 @@
+2012-03-15  Kentaro Hara  <haraken@chromium.org>
+
+        [PerformanceTests] run-perf-tests should output correct units
+        https://bugs.webkit.org/show_bug.cgi?id=78303
+
+        Reviewed by Ryosuke Niwa.
+
+        Previously run-perf-tests just supported "ms" for units.
+        Consequently, Dromaeo perf tests had been reporting runs/s as "ms".
+        This patch fixes run-perf-tests so that they can support custom units.
+        The default unit is "ms".
+
+        The test result looks like this:
+
+        $ ./Tools/Scripts/run-perf-tests Dromaeo/dom-attr.html
+        RESULT Dromaeo: dom-attr= 6465.9525483 runs/s
+        median= 0.0 runs/s, stdev= 24.2983433436 runs/s, min= 6435.87649402 runs/s, max= 6515.63693392 runs/s
+
+        * Dromaeo/resources/dromaeorunner.js:
+        (.):
+        * resources/runner.js:
+        (PerfTestRunner.computeStatistics):
+        (PerfTestRunner.printStatistics):
+
 2012-03-15  Alexis Menard  <alexis.menard@openbossa.org>
 
         Fix the test failing with run-perf-tests.
index 136093e..c89ac71 100644 (file)
@@ -18,7 +18,8 @@
                  mean: mean,
                  min: min,
                  max: max,
-                 stdev: Math.sqrt(varsum)
+                 stdev: Math.sqrt(varsum),
+                 unit: "runs/s"
              };
          },
 
@@ -32,7 +33,7 @@
                      DRT.targetDocument = iframe.contentDocument;
                      DRT.targetWindow = iframe.contentDocument.defaultView;
                  });
-             
+
              window.addEventListener(
                  "message",
                  function(event) {
index 9a7d9ad..1bc2a10 100644 (file)
@@ -75,6 +75,7 @@ PerfTestRunner.computeStatistics = function (times) {
     }
     result.variance = squareSum / data.length;
     result.stdev = Math.sqrt(result.variance);
+    result.unit = "ms";
 
     return result;
 }
@@ -87,11 +88,11 @@ PerfTestRunner.logStatistics = function (times) {
 
 PerfTestRunner.printStatistics = function (statistics) {
     this.log("");
-    this.log("avg " + statistics.mean);
-    this.log("median " + statistics.median);
-    this.log("stdev " + statistics.stdev);
-    this.log("min " + statistics.min);
-    this.log("max " + statistics.max);
+    this.log("avg " + statistics.mean + " " + statistics.unit);
+    this.log("median " + statistics.median + " " + statistics.unit);
+    this.log("stdev " + statistics.stdev + " " + statistics.unit);
+    this.log("min " + statistics.min + " " + statistics.unit);
+    this.log("max " + statistics.max + " " + statistics.unit);
 }
 
 PerfTestRunner.gc = function () {
index 942f0d4..be87b6d 100644 (file)
@@ -1,3 +1,24 @@
+2012-03-15  Kentaro Hara  <haraken@chromium.org>
+
+        [PerformanceTests] run-perf-tests should output correct units
+        https://bugs.webkit.org/show_bug.cgi?id=78303
+
+        Reviewed by Ryosuke Niwa.
+
+        Previously run-perf-tests just supported "ms" for units.
+        Consequently, Dromaeo perf tests had been reporting runs/s as "ms".
+        This patch fixes run-perf-tests so that they can support custom units.
+        The default unit is "ms".
+
+        The test result looks like this:
+
+        $ ./Tools/Scripts/run-perf-tests Dromaeo/dom-attr.html
+        RESULT Dromaeo: dom-attr= 6465.9525483 runs/s
+        median= 0.0 runs/s, stdev= 24.2983433436 runs/s, min= 6435.87649402 runs/s, max= 6515.63693392 runs/s
+
+        * Scripts/webkitpy/performance_tests/perftestsrunner.py:
+        (PerfTestsRunner._process_parser_test_result):
+
 2012-03-15  Brent Fulgham  <bfulgham@webkit.org>
 
         [WinCairo] Unreviewed build change after wtf path changes.
index 8cc0d74..ce1c7e9 100644 (file)
@@ -284,11 +284,14 @@ class PerfTestsRunner(object):
         test_name = filesystem.splitext(test_name)[0]
         results = {}
         keys = ['avg', 'median', 'stdev', 'min', 'max']
-        score_regex = re.compile(r'^(' + r'|'.join(keys) + r')\s+([0-9\.]+)')
+        score_regex = re.compile(r'^(?P<key>' + r'|'.join(keys) + r')\s+(?P<value>[0-9\.]+)\s*(?P<unit>.*)')
+        unit = "ms"
         for line in re.split('\n', output.text):
             score = score_regex.match(line)
             if score:
-                results[score.group(1)] = float(score.group(2))
+                results[score.group('key')] = float(score.group('value'))
+                if score.group('unit'):
+                    unit = score.group('unit')
                 continue
 
             if not self._should_ignore_line_in_parser_test_result(line):
@@ -298,8 +301,8 @@ class PerfTestsRunner(object):
         if test_failed or set(keys) != set(results.keys()):
             return True
         self._results[filesystem.join(category, test_name).replace('\\', '/')] = results
-        self._buildbot_output.write('RESULT %s: %s= %s ms\n' % (category, test_name, results['avg']))
-        self._buildbot_output.write(', '.join(['%s= %s ms' % (key, results[key]) for key in keys[1:]]) + '\n')
+        self._buildbot_output.write('RESULT %s: %s= %s %s\n' % (category, test_name, results['avg'], unit))
+        self._buildbot_output.write(', '.join(['%s= %s %s' % (key, results[key], unit) for key in keys[1:]]) + '\n')
         return False
 
     def _run_single_test(self, test, driver, is_chromium_style):