Web Inspector: chromium: move and adapt Inspector's performance tests for running...
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2011 19:31:51 +0000 (19:31 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2011 19:31:51 +0000 (19:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=72260

Reviewed by Pavel Feldman.

PerformanceTests:

* inspector/first-open-elements.html: Renamed from LayoutTests/inspector/performance/resources/first-open-elements.html.
* inspector/first-open-scripts.html: Renamed from LayoutTests/inspector/performance/resources/first-open-scripts.html.
* inspector/inspector-startup-time.html: Renamed from LayoutTests/inspector/performance/resources/inspector-startup-time.html.
* inspector/network-append-30-requests.html: Renamed from LayoutTests/inspector/performance/resources/network-append-30-requests.html.
* inspector/performance-test.js: Renamed from LayoutTests/inspector/performance/resources/performance-test.js.
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.start):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.finish):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._getJSHeapSize):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.done):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._runTest):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._dump):
(initialize_TimeTracker.InspectorTest.runPerformanceTest):
(initialize_TimeTracker.InspectorTest.mark):
* inspector/show-panel.html: Renamed from LayoutTests/inspector/performance/resources/show-panel.html.

LayoutTests:

* inspector/performance/resources/console-append-100-lines.html: Removed.
* inspector/performance/resources/first-open-resources.html: Removed.

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

LayoutTests/ChangeLog
LayoutTests/inspector/performance/resources/console-append-100-lines.html [deleted file]
LayoutTests/inspector/performance/resources/first-open-resources.html [deleted file]
PerformanceTests/ChangeLog
PerformanceTests/inspector/first-open-elements.html [moved from LayoutTests/inspector/performance/resources/first-open-elements.html with 91% similarity]
PerformanceTests/inspector/first-open-scripts.html [moved from LayoutTests/inspector/performance/resources/first-open-scripts.html with 82% similarity]
PerformanceTests/inspector/inspector-startup-time.html [moved from LayoutTests/inspector/performance/resources/inspector-startup-time.html with 91% similarity]
PerformanceTests/inspector/network-append-30-requests.html [moved from LayoutTests/inspector/performance/resources/network-append-30-requests.html with 90% similarity]
PerformanceTests/inspector/performance-test.js [moved from LayoutTests/inspector/performance/resources/performance-test.js with 82% similarity]
PerformanceTests/inspector/show-panel.html [moved from LayoutTests/inspector/performance/resources/show-panel.html with 92% similarity]

index eaf4d41..b6a096a 100644 (file)
@@ -1,3 +1,13 @@
+2011-12-01  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: chromium: move and adapt Inspector's performance tests for running with run-inspector-perf-tests.py.
+        https://bugs.webkit.org/show_bug.cgi?id=72260
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/performance/resources/console-append-100-lines.html: Removed.
+        * inspector/performance/resources/first-open-resources.html: Removed.
+
 2011-11-30  Benjamin Poulain  <benjamin@webkit.org>
 
         URLs are encoded in UTF-8, then decoded as if they are Latin1
diff --git a/LayoutTests/inspector/performance/resources/console-append-100-lines.html b/LayoutTests/inspector/performance/resources/console-append-100-lines.html
deleted file mode 100644 (file)
index fbc3bca..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<html>
-<head>
-<script src="../../../http/tests/inspector/inspector-test.js"></script>
-<script src="performance-test.js"></script>
-<script>
-
-function makeConsoleEvents(count)
-{
-    for (var i = 0; i < count; ++i)
-        console.log("Console log: " + i);
-}
-
-function test()
-{
-    WebInspector.showPanel("console");
-
-    function test(timer)
-    {
-        WebInspector.console.clearMessages();
-        InspectorTest.addSniffer(WebInspector.consoleView.promptElement, "scrollIntoView", finish);
-        cookie = timer.start("console-append-100-lines");
-
-        InspectorTest.evaluateInPage("makeConsoleEvents(100)");
-
-        function finish()
-        {
-            timer.finish(cookie);
-            timer.done();
-        }
-    }
-
-    InspectorTest.runPerformanceTest(test, 10000);
-}
-
-if (!window.layoutTestController) {
-    setTimeout(function() {
-        makeConsoleEvents(100);
-    }, 3000);
-}
-
-</script>
-</head>
-
-<body onload="runTest()">
-</body>
-</html>
diff --git a/LayoutTests/inspector/performance/resources/first-open-resources.html b/LayoutTests/inspector/performance/resources/first-open-resources.html
deleted file mode 100644 (file)
index 7b1116d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<html>
-<head>
-<script src="../../../http/tests/inspector/inspector-test.js"></script>
-<script src="performance-test.js"></script>
-<script>
-
-function test()
-{
-    WebInspector.showPanel("resources");
-    WebInspector.settings.resourcesLastSelectedItem.set(WebInspector.inspectedPageURL);
-
-    function test(timer)
-    {
-        WebInspector.showPanel("audits");
-
-        var showPanelTimerCookie = timer.start("first-open-resources");
-        InspectorTest.addBackendResponseSniffer(PageAgent, "getResourceContent", function() {
-            timer.finish(showPanelTimerCookie);
-            timer.done();
-        });
-        WebInspector.panels.resources._resetResourcesTree();
-        WebInspector.resourceTreeModel.frontendReused();
-        WebInspector.showPanel("resources");
-    }
-
-    InspectorTest.runPerformanceTest(test, 5000);
-}
-
-</script>
-</head>
-
-<body onload="runTest()">
-</body>
-</body>
-</html>
-
index f1c01b8..98b23a9 100644 (file)
@@ -1,3 +1,26 @@
+2011-12-01  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: chromium: move and adapt Inspector's performance tests for running with run-inspector-perf-tests.py.
+        https://bugs.webkit.org/show_bug.cgi?id=72260
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/first-open-elements.html: Renamed from LayoutTests/inspector/performance/resources/first-open-elements.html.
+        * inspector/first-open-scripts.html: Renamed from LayoutTests/inspector/performance/resources/first-open-scripts.html.
+        * inspector/inspector-startup-time.html: Renamed from LayoutTests/inspector/performance/resources/inspector-startup-time.html.
+        * inspector/network-append-30-requests.html: Renamed from LayoutTests/inspector/performance/resources/network-append-30-requests.html.
+        * inspector/performance-test.js: Renamed from LayoutTests/inspector/performance/resources/performance-test.js.
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer):
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.start):
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.finish):
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._getJSHeapSize):
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.done):
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._runTest):
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._dump):
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest):
+        (initialize_TimeTracker.InspectorTest.mark):
+        * inspector/show-panel.html: Renamed from LayoutTests/inspector/performance/resources/show-panel.html.
+
 2011-11-09  Adam Klein  <adamk@chromium.org>
 
         [MutationObservers] Microbenchmarks for appendChild, removeChild, and innerHTML
@@ -1,6 +1,6 @@
 <html>
 <head>
-<script src="../../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../LayoutTests/http/tests/inspector/inspector-test.js"></script>
 <script src="performance-test.js"></script>
 <script>
 
@@ -17,7 +17,7 @@ function test()
         var showPanelTimerCookie = timer.start("first-open-elements");
         InspectorTest.addBackendResponseSniffer(DOMAgent, "requestChildNodes", function() {
             timer.finish(showPanelTimerCookie);
-            timer.done();
+            timer.done("first-open");
         });
         WebInspector.showPanel("elements");
     }
@@ -1,13 +1,12 @@
 <html>
 <head>
-<script src="../../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../LayoutTests/http/tests/inspector/inspector-test.js"></script>
 <script src="performance-test.js"></script>
 <script>
 
 function test()
 {
     WebInspector.showPanel("scripts");
-
     var files = WebInspector.panels.scripts._filesSelectElement;
     for (var i = 0; i < files.options.length; ++i) {
          if (files.options[i].value.indexOf("inspector-test.js") !== -1) {
@@ -20,23 +19,20 @@ function test()
     function test(timer)
     {
         WebInspector.showPanel("audits");
-
         var showPanelTimerCookie = timer.start("first-open-scripts");
         WebInspector.showPanel("scripts");
         var count = WebInspector.panels.scripts._visibleView._textViewer._mainPanel._textChunks.length;
         WebInspector.panels.scripts._visibleView._textViewer._mainPanel._expandChunks(0, count);
         WebInspector.panels.scripts._visibleView._textViewer._mainPanel._paintScheduledLines();
         timer.finish(showPanelTimerCookie);
-        timer.done();
+        timer.done("first-open");
     }
 
-    InspectorTest.runPerformanceTest(test, 5000);
+    InspectorTest.runAfterPendingDispatches(InspectorTest.runPerformanceTest.bind(null, test, 5000));
 }
 
 </script>
-
 </head>
-
 <body onload="runTest()">
 </body>
 </html>
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script src="../../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../LayoutTests/http/tests/inspector/inspector-test.js"></script>
 <script src="performance-test.js"></script>
 <script>
 
@@ -18,7 +18,7 @@ function inspectorIsReady()
 {
     times.push(Date.now() - startTime);
     if (Date.now() - testStartTime > 20000) {
-        layoutTestController.evaluateInWebInspector(2, "InspectorTest.dumpTestStats('inspector-startup-time', " + JSON.stringify(times) + ")")
+        layoutTestController.evaluateInWebInspector(2, "InspectorTest.dumpTestStats('inspector-startup-time', 'time', " + JSON.stringify(times) + ", 'ms')")
         layoutTestController.evaluateInWebInspector(3, "(InspectorTest.completeTest())")
         return;
     }
@@ -43,8 +43,6 @@ function test()
 
 </head>
 <body onload="onload()">
-<p>Tests Web Inspector startup time.</p>
-
 <div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
 <div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
 <div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
@@ -55,6 +53,5 @@ function test()
 <div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
 <div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
 <div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
-
 </body>
 </html>
@@ -1,6 +1,6 @@
 <html>
 <head>
-<script src="../../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../LayoutTests/http/tests/inspector/inspector-test.js"></script>
 <script src="performance-test.js"></script>
 <script>
 
@@ -27,7 +27,7 @@ function test()
         WebInspector.panels.network._networkLogView._reset();
         // In real life this array is cleaning up at navigation event.
         WebInspector.networkLog._resources = [];
-        InspectorTest.timer.done();
+        InspectorTest.timer.done("panel-update");
     }
 
     function test(timer)
@@ -28,12 +28,14 @@ InspectorTest.runPerformanceTest = function(perfTest, executeTime, callback)
 
         _getJSHeapSize: function()
         {
-            window.gc();
-            window.gc();
+            if (window.gc) {
+                window.gc();
+                window.gc();
+            }
             return console.memory.usedJSHeapSize;
         },
 
-        done: function()
+        done: function(groupName)
         {
             var newJSHeapSize = this._getJSHeapSize();
             this._heapSizeDeltas.push(newJSHeapSize - this._jsHeapSize);
@@ -47,7 +49,7 @@ InspectorTest.runPerformanceTest = function(perfTest, executeTime, callback)
                     return;
                 this._complete = true;
 
-                this._dump();
+                this._dump(groupName);
                 if (this._callback)
                     this._callback();
                 else
@@ -68,15 +70,15 @@ InspectorTest.runPerformanceTest = function(perfTest, executeTime, callback)
             this._guard = false;
         },
 
-        _dump: function()
+        _dump: function(groupName)
         {
             for (var testName in this._times)
-                InspectorTest.dumpTestStats(testName, this._times[testName]);
+                InspectorTest.dumpTestStats(groupName, testName, this._times[testName], "ms");
 
             var url = WebInspector.inspectedPageURL;
             var regExp = /([^\/]+)\.html/;
             var matches = regExp.exec(url);
-            InspectorTest.dumpTestStats("heap-delta-kb-" + matches[1], this._heapSizeDeltas, 1024);
+            InspectorTest.dumpTestStats(groupName, "heap-delta-" + matches[1], this._heapSizeDeltas, "kB", 1024);
         },
 
     }
@@ -97,7 +99,7 @@ InspectorTest.mark = function(markerName)
     InspectorTest.lastMarkCookie = markerName ? timer.start(markerName) : null;
 }
 
-InspectorTest.dumpTestStats = function(testName, samples, divider)
+InspectorTest.dumpTestStats = function(groupName, testName, samples, units, divider)
 {
     divider = divider || 1;
     var stripNResults = Math.floor(samples.length / 10);
@@ -105,8 +107,7 @@ InspectorTest.dumpTestStats = function(testName, samples, divider)
     var sum = 0;
     for (var i = stripNResults; i < samples.length - stripNResults; ++i)
         sum += samples[i];
-    InspectorTest.addResult("* " + testName + ": " + Math.floor(sum / (samples.length - stripNResults * 2) / divider));
-    InspectorTest.addResult(testName + " min/max/count: " + Math.floor(samples[0] / divider) + "/" + Math.floor(samples[samples.length-1] / divider) + "/" + samples.length);
+    InspectorTest.addResult("RESULT " + groupName + ': ' + testName + "= " + Math.floor(sum / (samples.length - stripNResults * 2) / divider) + " " + units);
 }
 
 InspectorTest.addBackendResponseSniffer = function(object, methodName, override, opt_sticky)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<script src="../../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../LayoutTests/http/tests/inspector/inspector-test.js"></script>
 <script src="performance-test.js"></script>
 <script>
 
@@ -42,10 +42,10 @@ function test()
         for (var panelName in WebInspector.panels) {
             var timerCookie = timer.start("show-panel-" + panelName);
             WebInspector.showPanel(panelName);
-            layoutTestController.display();
+            InspectorTest.evaluateInPage("layoutTestController.display();");
             timer.finish(timerCookie);
         }
-        timer.done();
+        timer.done("panel-switch");
     }
 }
 </script>