Title: [96110] trunk
Revision
96110
Author
loi...@chromium.org
Date
2011-09-27 08:26:34 -0700 (Tue, 27 Sep 2011)

Log Message

Web Inspector: UI performance: introduce heap size tracking stats.
https://bugs.webkit.org/show_bug.cgi?id=68901

It is interesting how much the heap memory is used by Inspector in order of running the test.

Reviewed by Yury Semikhatsky.

Tools:

* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::showDevTools):
(TestShell::closeDevTools):

LayoutTests:

* inspector/performance/resources/network-append-30-requests.html:
* inspector/performance/resources/performance-test.js:
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._getJSHeapSize):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.done):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._dump):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96109 => 96110)


--- trunk/LayoutTests/ChangeLog	2011-09-27 15:17:53 UTC (rev 96109)
+++ trunk/LayoutTests/ChangeLog	2011-09-27 15:26:34 UTC (rev 96110)
@@ -1,3 +1,19 @@
+2011-09-27  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: UI performance: introduce heap size tracking stats.
+        https://bugs.webkit.org/show_bug.cgi?id=68901
+
+        It is interesting how much the heap memory is used by Inspector in order of running the test.
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/performance/resources/network-append-30-requests.html:
+        * inspector/performance/resources/performance-test.js:
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer):
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._getJSHeapSize):
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.done):
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._dump):
+
 2011-09-27  W. James MacLean  <wjmacl...@chromium.org>
 
         Layout Test platform/chromium/compositing/zoom-animator-scale-test.html is failing.

Modified: trunk/LayoutTests/inspector/performance/resources/network-append-30-requests.html (96109 => 96110)


--- trunk/LayoutTests/inspector/performance/resources/network-append-30-requests.html	2011-09-27 15:17:53 UTC (rev 96109)
+++ trunk/LayoutTests/inspector/performance/resources/network-append-30-requests.html	2011-09-27 15:26:34 UTC (rev 96110)
@@ -8,7 +8,7 @@
 {
     for (var i = 0; i < count; ++i) {
         var xhr = new XMLHttpRequest();
-        xhr.open("GET", document.url, true);
+        xhr.open("GET", document.URL, true);
         xhr.send();
     }
 }

Modified: trunk/LayoutTests/inspector/performance/resources/performance-test.js (96109 => 96110)


--- trunk/LayoutTests/inspector/performance/resources/performance-test.js	2011-09-27 15:17:53 UTC (rev 96109)
+++ trunk/LayoutTests/inspector/performance/resources/performance-test.js	2011-09-27 15:26:34 UTC (rev 96110)
@@ -8,6 +8,8 @@
         this._test = test;
         this._times = {};
         this._testStartTime = new Date();
+        this._heapSizeDeltas = [];
+        this._jsHeapSize = this._getJSHeapSize();
     }
 
     Timer.prototype = {
@@ -24,8 +26,18 @@
             this._times[cookie.name].push(endTime - cookie.startTime);
         },
 
+        _getJSHeapSize: function()
+        {
+            window.gc();
+            window.gc();
+            return console.memory.usedJSHeapSize;
+        },
+
         done: function()
         {
+            this._heapSizeDeltas.push(console.memory.usedJSHeapSize - this._jsHeapSize);
+            this._jsHeapSize = this._getJSHeapSize();
+
             var time = new Date();
             if (time - this._testStartTime < executeTime)
                 this._runTest();
@@ -53,16 +65,25 @@
 
         _dump: function()
         {
-            for (var testName in this._times) {
-                var samples = this._times[testName];
-                var stripNResults = Math.floor(samples.length / 10);
-                samples.sort(function(a, b) { return a - b; });
-                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)));
-                InspectorTest.addResult(testName + " min/max/count: " + samples[0] + "/" + samples[samples.length-1] + "/" + samples.length);
-            }
+            for (var testName in this._times)
+                this._dumpTestStats(testName, this._times[testName]);
+
+            var url = ""
+            var regExp = /([^\/]+)\.html/;
+            var matches = regExp.exec(url);
+            this._dumpTestStats("heap-delta-kb-" + matches[1], this._heapSizeDeltas, 1024);
+        },
+
+        _dumpTestStats: function(testName, samples, divider)
+        {
+            divider = divider || 1;
+            var stripNResults = Math.floor(samples.length / 10);
+            samples.sort(function(a, b) { return a - b; });
+            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);
         }
     }
 
@@ -85,5 +106,4 @@
     }
 }
 
-
 }

Modified: trunk/Tools/ChangeLog (96109 => 96110)


--- trunk/Tools/ChangeLog	2011-09-27 15:17:53 UTC (rev 96109)
+++ trunk/Tools/ChangeLog	2011-09-27 15:26:34 UTC (rev 96110)
@@ -1,3 +1,16 @@
+2011-09-27  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: UI performance: introduce heap size tracking stats.
+        https://bugs.webkit.org/show_bug.cgi?id=68901
+
+        It is interesting how much the heap memory is used by Inspector in order of running the test.
+
+        Reviewed by Yury Semikhatsky.
+
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::showDevTools):
+        (TestShell::closeDevTools):
+
 2011-09-23  Tor Arne Vestbø  <tor.arne.ves...@nokia.com>
 
         [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi

Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.cpp (96109 => 96110)


--- trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2011-09-27 15:17:53 UTC (rev 96109)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2011-09-27 15:26:34 UTC (rev 96110)
@@ -176,6 +176,7 @@
             return;
         }
         m_devTools = createNewWindow(url);
+        m_devTools->webView()->settings()->setMemoryInfoEnabled(true);
         ASSERT(m_devTools);
         createDRTDevToolsClient(m_drtDevToolsAgent.get());
     }
@@ -185,6 +186,7 @@
 void TestShell::closeDevTools()
 {
     if (m_devTools) {
+        m_devTools->webView()->settings()->setMemoryInfoEnabled(false);
         m_drtDevToolsAgent->reset();
         m_drtDevToolsClient.clear();
         closeWindow(m_devTools);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to