Don't append log lines while perf tests are running.
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 May 2012 19:28:47 +0000 (19:28 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 May 2012 19:28:47 +0000 (19:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86028

Reviewed by Ryosuke Niwa.

In some tests, the extra DOM nodes can cause the test timing to change.
Avoid adding DOM nodes until the test is over. When running in a browser,
we append nodes as we run so the user can have some feedback.

* resources/runner.js:
(PerfTestRunner.log): Store the log lines in an array until the test is finished.

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

PerformanceTests/ChangeLog
PerformanceTests/resources/runner.js

index 8d8809b..1ccdbfa 100644 (file)
@@ -1,3 +1,17 @@
+2012-05-14  Tony Chang  <tony@chromium.org>
+
+        Don't append log lines while perf tests are running.
+        https://bugs.webkit.org/show_bug.cgi?id=86028
+
+        Reviewed by Ryosuke Niwa.
+
+        In some tests, the extra DOM nodes can cause the test timing to change.
+        Avoid adding DOM nodes until the test is over. When running in a browser,
+        we append nodes as we run so the user can have some feedback.
+
+        * resources/runner.js:
+        (PerfTestRunner.log): Store the log lines in an array until the test is finished.
+
 2012-05-14  Ryosuke Niwa  <rniwa@webkit.org>
 
         Build fix. Don't adjust calls per iteration in the second run.
index 65ac5cc..cfc9b16 100644 (file)
@@ -24,6 +24,10 @@ PerfTestRunner.random = Math.random = function() {
 };
 
 PerfTestRunner.log = function (text) {
+    if (this._logLines) {
+        this._logLines.push(text);
+        return;
+    }
     if (!document.getElementById("log")) {
         var pre = document.createElement('pre');
         pre.id = 'log';
@@ -118,6 +122,12 @@ PerfTestRunner._runLoop = function () {
         window.setTimeout(function () { PerfTestRunner._runner(); }, 0);
     } else {
         this.logStatistics(this._results);
+        if (this._logLines) {
+            var logLines = this._logLines;
+            this._logLines = null;
+            var self = this;
+            logLines.forEach(function(text) { self.log(text); });
+        }
         this._doneFunction();
         if (window.layoutTestController)
             layoutTestController.notifyDone();
@@ -160,6 +170,7 @@ PerfTestRunner.initAndStartLoop = function() {
     this._completedRuns = -1;
     this.customRunFunction = null;
     this._results = [];
+    this._logLines = window.layoutTestController ? [] : null;
     this.log("Running " + this._runCount + " times");
     this._runLoop();
 }