Title: [121461] trunk/Source/WebCore
Revision
121461
Author
simon.fra...@apple.com
Date
2012-06-28 13:28:42 -0700 (Thu, 28 Jun 2012)

Log Message

Improve compositing logging output
https://bugs.webkit.org/show_bug.cgi?id=90199

Reviewed by Tim Horton (w00t!).

Improve the compositing logging channel output in a few
useful ways:
1. Report memory use, rather than megapixels
2. Show element class names

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::backingStoreMemoryEstimate):
* platform/graphics/GraphicsLayer.h:
(GraphicsLayer):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::backingStoreMemoryEstimate):
* platform/graphics/ca/GraphicsLayerCA.h:
(GraphicsLayerCA):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::nameForLayer):
(WebCore::RenderLayerBacking::backingStoreMemoryEstimate):
* rendering/RenderLayerBacking.h:
(RenderLayerBacking):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor):
(WebCore::RenderLayerCompositor::updateCompositingLayers):
(WebCore::RenderLayerCompositor::logLayerInfo):
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
* rendering/RenderLayerCompositor.h:
(RenderLayerCompositor):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121460 => 121461)


--- trunk/Source/WebCore/ChangeLog	2012-06-28 20:27:24 UTC (rev 121460)
+++ trunk/Source/WebCore/ChangeLog	2012-06-28 20:28:42 UTC (rev 121461)
@@ -1,3 +1,36 @@
+2012-06-28  Simon Fraser  <simon.fra...@apple.com>
+
+        Improve compositing logging output
+        https://bugs.webkit.org/show_bug.cgi?id=90199
+
+        Reviewed by Tim Horton (w00t!).
+
+        Improve the compositing logging channel output in a few
+        useful ways:
+        1. Report memory use, rather than megapixels
+        2. Show element class names
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::backingStoreMemoryEstimate):
+        * platform/graphics/GraphicsLayer.h:
+        (GraphicsLayer):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::backingStoreMemoryEstimate):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        (GraphicsLayerCA):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::nameForLayer):
+        (WebCore::RenderLayerBacking::backingStoreMemoryEstimate):
+        * rendering/RenderLayerBacking.h:
+        (RenderLayerBacking):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::RenderLayerCompositor):
+        (WebCore::RenderLayerCompositor::updateCompositingLayers):
+        (WebCore::RenderLayerCompositor::logLayerInfo):
+        (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
+        * rendering/RenderLayerCompositor.h:
+        (RenderLayerCompositor):
+
 2012-06-28  James Robinson  <jam...@chromium.org>
 
         [chromium] Fix up more includes in compositor code

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (121460 => 121461)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2012-06-28 20:27:24 UTC (rev 121460)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2012-06-28 20:28:42 UTC (rev 121461)
@@ -509,13 +509,13 @@
     return firstIndex;
 }
 
-double GraphicsLayer::backingStoreArea() const
+double GraphicsLayer::backingStoreMemoryEstimate() const
 {
     if (!drawsContent())
         return 0;
     
     // Effects of page and device scale are ignored; subclasses should override to take these into account.
-    return static_cast<double>(size().width()) * size().height();
+    return static_cast<double>(4 * size().width()) * size().height();
 }
 
 static void writeIndent(TextStream& ts, int indent)

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (121460 => 121461)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-06-28 20:27:24 UTC (rev 121460)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-06-28 20:28:42 UTC (rev 121461)
@@ -426,8 +426,8 @@
     // pointers for the layers and timing data will be included in the returned string.
     String layerTreeAsText(LayerTreeAsTextBehavior = LayerTreeAsTextBehaviorNormal) const;
 
-    // Return an estimate of the backing store area (in pixels). May be incorrect for tiled layers.
-    virtual double backingStoreArea() const;
+    // Return an estimate of the backing store memory cost (in bytes). May be incorrect for tiled layers.
+    virtual double backingStoreMemoryEstimate() const;
 
     bool usingTiledLayer() const { return m_usingTiledLayer; }
 

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (121460 => 121461)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-06-28 20:27:24 UTC (rev 121460)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-06-28 20:28:42 UTC (rev 121461)
@@ -2835,13 +2835,13 @@
     m_uncommittedChanges |= flags;
 }
 
-double GraphicsLayerCA::backingStoreArea() const
+double GraphicsLayerCA::backingStoreMemoryEstimate() const
 {
     if (!drawsContent())
         return 0;
     
     // contentsLayer is given to us, so we don't really know anything about its contents.
-    return static_cast<double>(size().width()) * size().height() * m_layer->contentsScale();
+    return static_cast<double>(4 * size().width()) * size().height() * m_layer->contentsScale();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (121460 => 121461)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2012-06-28 20:27:24 UTC (rev 121460)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2012-06-28 20:28:42 UTC (rev 121461)
@@ -162,7 +162,7 @@
     virtual void platformCALayerDidCreateTiles(const Vector<FloatRect>& dirtyRects) OVERRIDE;
     virtual float platformCALayerDeviceScaleFactor() OVERRIDE;
 
-    virtual double backingStoreArea() const;
+    virtual double backingStoreMemoryEstimate() const;
 
     void updateOpacityOnLayer();
     

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (121460 => 121461)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-06-28 20:27:24 UTC (rev 121460)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-06-28 20:28:42 UTC (rev 121461)
@@ -1541,7 +1541,18 @@
         if (node->isElementNode())
             name += " " + static_cast<Element*>(node)->tagName();
         if (node->hasID())
-            name += " \'" + static_cast<Element*>(node)->getIdAttribute() + "\'";
+            name += " id=\'" + static_cast<Element*>(node)->getIdAttribute() + "\'";
+
+        if (node->hasClass()) {
+            StyledElement* styledElement = static_cast<StyledElement*>(node);
+            String classes;
+            for (size_t i = 0; i < styledElement->classNames().size(); ++i) {
+                if (i > 0)
+                    classes += " ";
+                classes += styledElement->classNames()[i];
+            }
+            name += " class=\'" + classes + "\'";
+        }
     }
 
     if (m_owningLayer->isReflection())
@@ -1561,27 +1572,27 @@
     return ContainerCompositingLayer;
 }
 
-double RenderLayerBacking::backingStoreArea() const
+double RenderLayerBacking::backingStoreMemoryEstimate() const
 {
-    double backingArea;
+    double backingMemory;
     
     // m_ancestorClippingLayer and m_clippingLayer are just used for masking, so have no backing.
-    backingArea = m_graphicsLayer->backingStoreArea();
+    backingMemory = m_graphicsLayer->backingStoreMemoryEstimate();
     if (m_foregroundLayer)
-        backingArea += m_foregroundLayer->backingStoreArea();
+        backingMemory += m_foregroundLayer->backingStoreMemoryEstimate();
     if (m_maskLayer)
-        backingArea += m_maskLayer->backingStoreArea();
+        backingMemory += m_maskLayer->backingStoreMemoryEstimate();
 
     if (m_layerForHorizontalScrollbar)
-        backingArea += m_layerForHorizontalScrollbar->backingStoreArea();
+        backingMemory += m_layerForHorizontalScrollbar->backingStoreMemoryEstimate();
 
     if (m_layerForVerticalScrollbar)
-        backingArea += m_layerForVerticalScrollbar->backingStoreArea();
+        backingMemory += m_layerForVerticalScrollbar->backingStoreMemoryEstimate();
 
     if (m_layerForScrollCorner)
-        backingArea += m_layerForScrollCorner->backingStoreArea();
+        backingMemory += m_layerForScrollCorner->backingStoreMemoryEstimate();
     
-    return backingArea;
+    return backingMemory;
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (121460 => 121461)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2012-06-28 20:27:24 UTC (rev 121460)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2012-06-28 20:28:42 UTC (rev 121461)
@@ -160,7 +160,7 @@
 #endif
 
     // Return an estimate of the backing store area (in pixels) allocated by this object's GraphicsLayers.
-    double backingStoreArea() const;
+    double backingStoreMemoryEstimate() const;
 
     String nameForLayer() const;
     

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (121460 => 121461)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-06-28 20:27:24 UTC (rev 121460)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-06-28 20:28:42 UTC (rev 121461)
@@ -172,8 +172,6 @@
 #endif
 }
 
-#define PIXELS_PER_MEGAPIXEL 1000000.0
-
 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView)
     : m_renderView(renderView)
     , m_updateCompositingLayersTimer(this, &RenderLayerCompositor::updateCompositingLayersTimerFired)
@@ -194,8 +192,8 @@
     , m_rootLayerUpdateCount(0)
     , m_obligateCompositedLayerCount(0)
     , m_secondaryCompositedLayerCount(0)
-    , m_obligatoryBackingAreaMegaPixels(0)
-    , m_secondaryBackingAreaMegaPixels(0)
+    , m_obligatoryBackingStoreBytes(0)
+    , m_secondaryBackingStoreBytes(0)
 #endif
 {
 }
@@ -415,8 +413,8 @@
     if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needGeometryUpdate)) {
         m_obligateCompositedLayerCount = 0;
         m_secondaryCompositedLayerCount = 0;
-        m_obligatoryBackingAreaMegaPixels = 0;
-        m_secondaryBackingAreaMegaPixels = 0;
+        m_obligatoryBackingStoreBytes = 0;
+        m_secondaryBackingStoreBytes = 0;
 
         Frame* frame = m_renderView->frameView()->frame();
         bool isMainFrame = !m_renderView->document()->ownerElement();
@@ -448,11 +446,11 @@
 #if !LOG_DISABLED
     if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needGeometryUpdate)) {
         double endTime = currentTime();
-        LOG(Compositing, "Total layers   primary   secondary   obligatory backing (MP)   secondary backing(MP)   total backing (MP)  update time (ms)\n");
+        LOG(Compositing, "Total layers   primary   secondary   obligatory backing (KB)   secondary backing(KB)   total backing (KB)  update time (ms)\n");
 
         LOG(Compositing, "%8d %11d %9d %20.2f %22.2f %22.2f %18.2f\n",
             m_obligateCompositedLayerCount + m_secondaryCompositedLayerCount, m_obligateCompositedLayerCount,
-            m_secondaryCompositedLayerCount, m_obligatoryBackingAreaMegaPixels, m_secondaryBackingAreaMegaPixels, m_obligatoryBackingAreaMegaPixels + m_secondaryBackingAreaMegaPixels, 1000.0 * (endTime - startTime));
+            m_secondaryCompositedLayerCount, m_obligatoryBackingStoreBytes / 1024, m_secondaryBackingStoreBytes / 1024, (m_obligatoryBackingStoreBytes + m_secondaryBackingStoreBytes) / 1024, 1000.0 * (endTime - startTime));
     }
 #endif
     ASSERT(updateRoot || !m_compositingLayersNeedRebuild);
@@ -470,14 +468,14 @@
     RenderLayerBacking* backing = layer->backing();
     if (requiresCompositingLayer(layer) || layer->isRootLayer()) {
         ++m_obligateCompositedLayerCount;
-        m_obligatoryBackingAreaMegaPixels += backing->backingStoreArea() / PIXELS_PER_MEGAPIXEL;
+        m_obligatoryBackingStoreBytes += backing->backingStoreMemoryEstimate();
     } else {
         ++m_secondaryCompositedLayerCount;
-        m_secondaryBackingAreaMegaPixels += backing->backingStoreArea() / PIXELS_PER_MEGAPIXEL;
+        m_secondaryBackingStoreBytes += backing->backingStoreMemoryEstimate();
     }
 
-    LOG(Compositing, "%*p %dx%d %.3fMP (%s) %s\n", 12 + depth * 2, layer, backing->compositedBounds().width(), backing->compositedBounds().height(),
-        backing->backingStoreArea() / PIXELS_PER_MEGAPIXEL,
+    LOG(Compositing, "%*p %dx%d %.2fKB (%s) %s\n", 12 + depth * 2, layer, backing->compositedBounds().width(), backing->compositedBounds().height(),
+        backing->backingStoreMemoryEstimate() / 1024,
         reasonForCompositing(layer), layer->backing()->nameForLayer().utf8().data());
 }
 #endif
@@ -2087,12 +2085,12 @@
     if (requiresHorizontalScrollbarLayer()) {
         if (!m_layerForHorizontalScrollbar) {
             m_layerForHorizontalScrollbar = GraphicsLayer::create(this);
-    #ifndef NDEBUG
+#ifndef NDEBUG
             m_layerForHorizontalScrollbar->setName("horizontal scrollbar");
-    #endif
-    #if PLATFORM(MAC) && USE(CA)
+#endif
+#if PLATFORM(MAC) && USE(CA)
             m_layerForHorizontalScrollbar->setAcceleratesDrawing(acceleratedDrawingEnabled());
-    #endif
+#endif
             m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get());
 
             if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
@@ -2109,12 +2107,12 @@
     if (requiresVerticalScrollbarLayer()) {
         if (!m_layerForVerticalScrollbar) {
             m_layerForVerticalScrollbar = GraphicsLayer::create(this);
-    #ifndef NDEBUG
+#ifndef NDEBUG
             m_layerForVerticalScrollbar->setName("vertical scrollbar");
-    #endif
-    #if PLATFORM(MAC) && USE(CA)
-            m_layerForVerticalScrollbar->setAcceleratesDrawing(acceleratedDrawingEnabled());
-    #endif
+#endif
+#if PLATFORM(MAC) && USE(CA)
+        m_layerForVerticalScrollbar->setAcceleratesDrawing(acceleratedDrawingEnabled());
+#endif
             m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get());
 
             if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
@@ -2131,12 +2129,12 @@
     if (requiresScrollCornerLayer()) {
         if (!m_layerForScrollCorner) {
             m_layerForScrollCorner = GraphicsLayer::create(this);
-    #ifndef NDEBUG
+#ifndef NDEBUG
             m_layerForScrollCorner->setName("scroll corner");
-    #endif
-    #if PLATFORM(MAC) && USE(CA)
+#endif
+#if PLATFORM(MAC) && USE(CA)
             m_layerForScrollCorner->setAcceleratesDrawing(acceleratedDrawingEnabled());
-    #endif
+#endif
             m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get());
         }
     } else if (m_layerForScrollCorner) {

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (121460 => 121461)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2012-06-28 20:27:24 UTC (rev 121460)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2012-06-28 20:28:42 UTC (rev 121461)
@@ -353,8 +353,8 @@
     int m_rootLayerUpdateCount;
     int m_obligateCompositedLayerCount; // count of layer that have to be composited.
     int m_secondaryCompositedLayerCount; // count of layers that have to be composited because of stacking or overlap.
-    double m_obligatoryBackingAreaMegaPixels;
-    double m_secondaryBackingAreaMegaPixels;
+    double m_obligatoryBackingStoreBytes;
+    double m_secondaryBackingStoreBytes;
 #endif
 };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to