Title: [191985] trunk/Source/WebCore
Revision
191985
Author
akl...@apple.com
Date
2015-11-03 15:30:25 -0800 (Tue, 03 Nov 2015)

Log Message

ResourceUsageOverlay should show GC-owned malloc memory.
<https://webkit.org/b/150846>

Reviewed by Anders Carlsson.

Add a memory category for GC-owned malloc memory. This carves a significant chunk off of
the gigantic "bmalloc" mystery slice.

* page/ResourceUsageOverlay.h:
* page/cocoa/ResourceUsageOverlayCocoa.mm:
(WebCore::drawMemoryPie):
(WebCore::ResourceUsageOverlay::draw):
(WebCore::runSamplerThread):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (191984 => 191985)


--- trunk/Source/WebCore/ChangeLog	2015-11-03 23:27:04 UTC (rev 191984)
+++ trunk/Source/WebCore/ChangeLog	2015-11-03 23:30:25 UTC (rev 191985)
@@ -1,3 +1,19 @@
+2015-11-03  Andreas Kling  <akl...@apple.com>
+
+        ResourceUsageOverlay should show GC-owned malloc memory.
+        <https://webkit.org/b/150846>
+
+        Reviewed by Anders Carlsson.
+
+        Add a memory category for GC-owned malloc memory. This carves a significant chunk off of
+        the gigantic "bmalloc" mystery slice.
+
+        * page/ResourceUsageOverlay.h:
+        * page/cocoa/ResourceUsageOverlayCocoa.mm:
+        (WebCore::drawMemoryPie):
+        (WebCore::ResourceUsageOverlay::draw):
+        (WebCore::runSamplerThread):
+
 2015-11-03  Saam barati  <sbar...@apple.com>
 
         Rewrite "const" as "var" for iTunes/iBooks on the Mac

Modified: trunk/Source/WebCore/page/ResourceUsageOverlay.h (191984 => 191985)


--- trunk/Source/WebCore/page/ResourceUsageOverlay.h	2015-11-03 23:27:04 UTC (rev 191984)
+++ trunk/Source/WebCore/page/ResourceUsageOverlay.h	2015-11-03 23:30:25 UTC (rev 191985)
@@ -80,7 +80,7 @@
 #endif
 
     static const int normalWidth = 500;
-    static const int normalHeight = 120;
+    static const int normalHeight = 130;
 };
 
 }

Modified: trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm (191984 => 191985)


--- trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm	2015-11-03 23:27:04 UTC (rev 191984)
+++ trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm	2015-11-03 23:30:25 UTC (rev 191985)
@@ -77,6 +77,7 @@
 static const RGBA32 colorForLibcMalloc = 0xFF00FF00;
 static const RGBA32 colorForFastMalloc = 0xFFFF6060;
 static const RGBA32 colorForOther      = 0xFFC0FF00;
+static const RGBA32 colorForGCOwned    = 0xFFFFC060;
 static const RGBA32 colorForLabels     = 0xFFE0E0E0;
 
 template<typename T, size_t size = 50>
@@ -136,6 +137,7 @@
     size_t layers { 0 };
     size_t images { 0 };
     size_t jitCode { 0 };
+    size_t gcOwned { 0 };
     size_t libcMalloc { 0 };
     size_t bmalloc { 0 };
     size_t sumDirty { 0 };
@@ -284,12 +286,13 @@
 
     FloatPoint center(x - 15, y + 60);
 
-    size_t bmallocWithDeductions = data.bmalloc - data.gcHeapCapacityHistory.last();
+    size_t bmallocWithDeductions = data.bmalloc - data.gcHeapCapacityHistory.last() - data.gcOwned;
 
     float angle = 0;
     drawSlice(context, center, angle, bmallocWithDeductions, data.sumDirty, colorForFastMalloc);
     drawSlice(context, center, angle, data.libcMalloc, data.sumDirty, colorForLibcMalloc);
     drawSlice(context, center, angle, data.gcHeapCapacityHistory.last(), data.sumDirty, colorForGCHeap);
+    drawSlice(context, center, angle, data.gcOwned, data.sumDirty, colorForGCOwned);
     drawSlice(context, center, angle, data.layers, data.sumDirty, colorForLayers);
     drawSlice(context, center, angle, data.images, data.sumDirty, colorForImages);
     drawSlice(context, center, angle, data.jitCode, data.sumDirty, colorForJITCode);
@@ -344,7 +347,7 @@
     context.clearRect(m_overlay->bounds());
     CGRect viewBounds = m_overlay->bounds();
 
-    size_t bmallocWithDeductions = data.bmalloc - gcHeapCapacity;
+    size_t bmallocWithDeductions = data.bmalloc - gcHeapCapacity - data.gcOwned;
     size_t footprintWithDeductions = data.sumDirty - data.bmalloc - data.layers - data.images - data.libcMalloc - data.jitCode;
 
     showText(context, 10,  20, colorForLabels, String::format("        CPU: %g", data.cpuHistory.last()));
@@ -356,7 +359,8 @@
     showText(context, 10,  80, colorForLayers,     "     Layers: " + formatByteNumber(data.layers));
     showText(context, 10,  90, colorForJITCode,    "     JS JIT: " + formatByteNumber(data.jitCode));
     showText(context, 10, 100, colorForGCHeap,     "    GC heap: " + formatByteNumber(gcHeapSize) + " (" + formatByteNumber(gcHeapCapacity) + ")");
-    showText(context, 10, 110, colorForOther,      "      Other: " + formatByteNumber(footprintWithDeductions));
+    showText(context, 10, 110, colorForGCOwned,    "   GC owned: " + formatByteNumber(data.gcOwned));
+    showText(context, 10, 120, colorForOther,      "      Other: " + formatByteNumber(footprintWithDeductions));
 
     drawCpuHistory(context, m_overlay->frame().width() - 50, 0, viewBounds.size.height, data.cpuHistory);
     drawGCHistory(context, m_overlay->frame().width() - 100, 0, viewBounds.size.height, data.gcHeapSizeHistory, data.gcHeapCapacityHistory);
@@ -444,6 +448,7 @@
             copyToVector(data.overlayLayers, layers);
 
             data.gcHeapCapacityHistory.append(data.vm->heap.blockBytesAllocated());
+            data.gcOwned = data.vm->heap.extraMemorySize();
         }
 
         [CATransaction begin];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to