Title: [107223] trunk/Source/WebCore
Revision
107223
Author
[email protected]
Date
2012-02-09 05:04:13 -0800 (Thu, 09 Feb 2012)

Log Message

Web Inspector: Timeline memory graph would have been more useful if it had used minUsedHeapSize as the lower bound. Currently it uses zero as the lower bound.
https://bugs.webkit.org/show_bug.cgi?id=78222

Reviewed by Pavel Feldman.

* inspector/front-end/TimelineOverviewPane.js:
(WebInspector.HeapGraph):
(WebInspector.HeapGraph.prototype.update):
* inspector/front-end/timelinePanel.css:
(.memory-graph-label):
(.max.memory-graph-label):
(.min.memory-graph-label):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (107222 => 107223)


--- trunk/Source/WebCore/ChangeLog	2012-02-09 12:55:42 UTC (rev 107222)
+++ trunk/Source/WebCore/ChangeLog	2012-02-09 13:04:13 UTC (rev 107223)
@@ -1,3 +1,18 @@
+2012-02-09  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: Timeline memory graph would have been more useful if it had used minUsedHeapSize as the lower bound. Currently it uses zero as the lower bound.
+        https://bugs.webkit.org/show_bug.cgi?id=78222
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/TimelineOverviewPane.js:
+        (WebInspector.HeapGraph):
+        (WebInspector.HeapGraph.prototype.update):
+        * inspector/front-end/timelinePanel.css:
+        (.memory-graph-label):
+        (.max.memory-graph-label):
+        (.min.memory-graph-label):
+
 2012-02-09  Alexander Pavlov  <[email protected]>
 
         Web Inspector: Update protocol and UI to follow bug 77204 (Kill per-Attribute style declarations)

Modified: trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js (107222 => 107223)


--- trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js	2012-02-09 12:55:42 UTC (rev 107222)
+++ trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js	2012-02-09 13:04:13 UTC (rev 107223)
@@ -524,12 +524,17 @@
     this._canvas = document.createElement("canvas");
 
     this._maxHeapSizeLabel = document.createElement("div");
+    this._maxHeapSizeLabel.addStyleClass("max");
     this._maxHeapSizeLabel.addStyleClass("memory-graph-label");
+    this._minHeapSizeLabel = document.createElement("div");
+    this._minHeapSizeLabel.addStyleClass("min");
+    this._minHeapSizeLabel.addStyleClass("memory-graph-label");
 
     this._element = document.createElement("div");
     this._element.addStyleClass("hidden");
     this._element.appendChild(this._canvas);
     this._element.appendChild(this._maxHeapSizeLabel);
+    this._element.appendChild(this._minHeapSizeLabel);
 }
 
 WebInspector.HeapGraph.prototype = {
@@ -560,30 +565,33 @@
         if (!records.length)
             return;
 
-        var maxTotalHeapSize = 0;
+        const lowerOffset = 3;
+        var maxUsedHeapSize = 0;
+        var minUsedHeapSize = 100000000000;
         var minTime;
         var maxTime;
         this._forAllRecords(records, function(r) {
-            if (r.totalHeapSize && r.totalHeapSize > maxTotalHeapSize)
-                maxTotalHeapSize = r.totalHeapSize;
+            maxUsedHeapSize = Math.max(maxUsedHeapSize, r.usedHeapSize || maxUsedHeapSize);
+            minUsedHeapSize = Math.min(minUsedHeapSize, r.usedHeapSize || minUsedHeapSize);
 
             if (typeof minTime === "undefined" || r.startTime < minTime)
                 minTime = r.startTime;
             if (typeof maxTime === "undefined" || r.endTime > maxTime)
                 maxTime = r.endTime;
         });
+        minUsedHeapSize = Math.min(minUsedHeapSize, maxUsedHeapSize);
 
         var width = this._canvas.width;
-        var height = this._canvas.height;
+        var height = this._canvas.height - lowerOffset;
         var xFactor = width / (maxTime - minTime);
-        var yFactor = height / maxTotalHeapSize;
+        var yFactor = height / (maxUsedHeapSize - minUsedHeapSize);
 
         var histogram = new Array(width);
         this._forAllRecords(records, function(r) {
             if (!r.usedHeapSize)
                 return;
              var x = Math.round((r.endTime - minTime) * xFactor);
-             var y = Math.round(r.usedHeapSize * yFactor);
+             var y = Math.round((r.usedHeapSize - minUsedHeapSize) * yFactor);
              histogram[x] = Math.max(histogram[x] || 0, y);
         });
 
@@ -620,7 +628,8 @@
         ctx.fill();
         ctx.closePath();
 
-        this._maxHeapSizeLabel.textContent = Number.bytesToString(maxTotalHeapSize);
+        this._maxHeapSizeLabel.textContent = Number.bytesToString(maxUsedHeapSize);
+        this._minHeapSizeLabel.textContent = Number.bytesToString(minUsedHeapSize);
     },
 
     _clear: function(ctx) {

Modified: trunk/Source/WebCore/inspector/front-end/timelinePanel.css (107222 => 107223)


--- trunk/Source/WebCore/inspector/front-end/timelinePanel.css	2012-02-09 12:55:42 UTC (rev 107222)
+++ trunk/Source/WebCore/inspector/front-end/timelinePanel.css	2012-02-09 13:04:13 UTC (rev 107223)
@@ -496,13 +496,20 @@
 
 .memory-graph-label {
     position: absolute;
-    top: 5px;
     left: 5px;
     font-size: 9px;
     color: rgb(50%, 50%, 50%);
     white-space: nowrap;
 }
 
+.max.memory-graph-label {
+    top: 5px;
+}
+
+.min.memory-graph-label {
+    bottom: 5px;
+}
+
 #timeline-memory-splitter {
     position: absolute;
     z-index: 5;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to