diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-18 08:13:51 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-18 08:13:51 +0000 |
commit | 6a144160dfb2945b0099071662d2dd392594a24f (patch) | |
tree | 0a01d645fbbd22e2ce3a2d5c47c5501ae3e932a2 /cc | |
parent | 74b81dae8774b9f3888ef2aede971f5eb009cce5 (diff) | |
download | chromium_src-6a144160dfb2945b0099071662d2dd392594a24f.zip chromium_src-6a144160dfb2945b0099071662d2dd392594a24f.tar.gz chromium_src-6a144160dfb2945b0099071662d2dd392594a24f.tar.bz2 |
Use base/metrics/histogram.h instead of WebKit::Platform::histogramCustomCounts in cc
The base/ macros are chromium style and marginally more efficient since the
histogram bucket lookup is cached in a static local.
This produced yet more LOG vs LOG collisions. I rewrote the LayerSorter's
logging from WTF channels to use VLOG - it can be turned on by adding
"--vmodule=layer_sorter=2" to the command line.
BUG=154451,144577
Review URL: https://chromiumcodereview.appspot.com/11209002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162672 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/content_layer.cc | 9 | ||||
-rw-r--r-- | cc/frame_rate_counter.cc | 8 | ||||
-rw-r--r-- | cc/layer_sorter.cc | 51 | ||||
-rw-r--r-- | cc/overdraw_metrics.cc | 36 | ||||
-rw-r--r-- | cc/throttled_texture_uploader.cc | 4 |
5 files changed, 44 insertions, 64 deletions
diff --git a/cc/content_layer.cc b/cc/content_layer.cc index 750ec7c..6387652 100644 --- a/cc/content_layer.cc +++ b/cc/content_layer.cc @@ -8,13 +8,16 @@ #include "CCLayerTreeHost.h" #include "CCSettings.h" +#ifdef LOG +#undef LOG +#endif +#include "base/metrics/histogram.h" #include "base/time.h" #include "cc/bitmap_canvas_layer_texture_updater.h" #include "cc/bitmap_skpicture_canvas_layer_texture_updater.h" #include "cc/content_layer_client.h" #include "cc/frame_buffer_skpicture_canvas_layer_texture_updater.h" #include "cc/layer_painter.h" -#include <public/Platform.h> namespace cc { @@ -34,8 +37,8 @@ void ContentLayerPainter::paint(SkCanvas* canvas, const IntRect& contentRect, Fl m_client->paintContents(canvas, contentRect, opaque); base::TimeTicks paintEnd = base::TimeTicks::HighResNow(); double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart).InSecondsF(); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintDurationMS", (paintEnd - paintStart).InMillisecondsF(), 0, 120, 30); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.AccelContentPaintDurationMS", (paintEnd - paintStart).InMilliseconds(), 0, 120, 30); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.AccelContentPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); } scoped_refptr<ContentLayerChromium> ContentLayerChromium::create(ContentLayerChromiumClient* client) diff --git a/cc/frame_rate_counter.cc b/cc/frame_rate_counter.cc index a02486b..f9b203c 100644 --- a/cc/frame_rate_counter.cc +++ b/cc/frame_rate_counter.cc @@ -9,7 +9,10 @@ #include <cmath> #include "CCProxy.h" -#include <public/Platform.h> +#ifdef LOG +#undef LOG +#endif +#include "base/metrics/histogram.h" namespace cc { @@ -55,8 +58,7 @@ void CCFrameRateCounter::markBeginningOfFrame(base::TimeTicks timestamp) base::TimeDelta frameIntervalSeconds = frameInterval(m_currentFrameNumber); if (CCProxy::hasImplThread() && m_currentFrameNumber > 0) { - double drawDelayMs = frameIntervalSeconds.InMillisecondsF(); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.CompositorThreadImplDrawDelay", static_cast<int>(drawDelayMs), 1, 120, 60); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.CompositorThreadImplDrawDelay", frameIntervalSeconds.InMilliseconds(), 1, 120, 60); } if (!isBadFrameInterval(frameIntervalSeconds) && diff --git a/cc/layer_sorter.cc b/cc/layer_sorter.cc index bc252a4..597f403 100644 --- a/cc/layer_sorter.cc +++ b/cc/layer_sorter.cc @@ -8,6 +8,10 @@ #include "CCMathUtil.h" #include "CCRenderSurface.h" +#ifdef LOG +#undef LOG +#endif +#include "base/logging.h" #include <limits.h> #include <public/WebTransformationMatrix.h> #include <deque> @@ -16,17 +20,6 @@ using namespace std; using WebKit::WebTransformationMatrix; -#define LOG_CHANNEL_PREFIX Log -#define SHOW_DEBUG_LOG 0 - -#if !defined( NDEBUG ) -#if SHOW_DEBUG_LOG -static WTFLogChannel LogCCLayerSorter = { 0x00000000, "", WTFLogChannelOn }; -#else -static WTFLogChannel LogCCLayerSorter = { 0x00000000, "", WTFLogChannelOff }; -#endif -#endif - namespace cc { inline static float perpProduct(const FloatSize& u, const FloatSize& v) @@ -224,9 +217,7 @@ float CCLayerSorter::LayerShape::layerZFromProjectedPoint(const FloatPoint& p) c void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::iterator last) { -#if !defined( NDEBUG ) - LOG(CCLayerSorter, "Creating graph nodes:\n"); -#endif + DVLOG(2) << "Creating graph nodes:"; float minZ = FLT_MAX; float maxZ = -FLT_MAX; for (LayerList::const_iterator it = first; it < last; it++) { @@ -236,9 +227,7 @@ void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::itera if (!node.layer->drawsContent() && !renderSurface) continue; -#if !defined( NDEBUG ) - LOG(CCLayerSorter, "Layer %d (%d x %d)\n", node.layer->id(), node.layer->bounds().width(), node.layer->bounds().height()); -#endif + DVLOG(2) << "Layer " << node.layer->id() << " (" << node.layer->bounds().width() << " x " << node.layer->bounds().height() << ")"; WebTransformationMatrix drawTransform; float layerWidth, layerHeight; @@ -263,9 +252,7 @@ void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::itera void CCLayerSorter::createGraphEdges() { -#if !defined( NDEBUG ) - LOG(CCLayerSorter, "Edges:\n"); -#endif + DVLOG(2) << "Edges:"; // Fraction of the total zRange below which z differences // are not considered reliable. const float zThresholdFactor = 0.01f; @@ -292,9 +279,7 @@ void CCLayerSorter::createGraphEdges() } if (startNode) { -#if !defined( NDEBUG ) - LOG(CCLayerSorter, "%d -> %d\n", startNode->layer->id(), endNode->layer->id()); -#endif + DVLOG(2) << startNode->layer->id() << " -> " << endNode->layer->id(); m_edges.append(GraphEdge(startNode, endNode, weight)); } } @@ -347,9 +332,7 @@ void CCLayerSorter::removeEdgeFromList(GraphEdge* edge, Vector<GraphEdge*>& list // void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) { -#if !defined( NDEBUG ) - LOG(CCLayerSorter, "Sorting start ----\n"); -#endif + DVLOG(2) << "Sorting start ----"; createGraphNodes(first, last); createGraphEdges(); @@ -363,9 +346,7 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) noIncomingEdgeNodeList.push_back(la); } -#if !defined( NDEBUG ) - LOG(CCLayerSorter, "Sorted list: "); -#endif + DVLOG(2) << "Sorted list: "; while (m_activeEdges.size() || noIncomingEdgeNodeList.size()) { while (noIncomingEdgeNodeList.size()) { @@ -379,9 +360,7 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) // Add it to the final list. sortedList.push_back(fromNode); -#if !defined( NDEBUG ) - LOG(CCLayerSorter, "%d, ", fromNode->layer->id()); -#endif + DVLOG(2) << fromNode->layer->id() << ", "; // Remove all its outgoing edges from the graph. for (unsigned i = 0; i < fromNode->outgoing.size(); i++) { @@ -424,9 +403,7 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) nextNode->incoming.clear(); nextNode->incomingEdgeWeight = 0; noIncomingEdgeNodeList.push_back(nextNode); -#if !defined( NDEBUG ) - LOG(CCLayerSorter, "Breaking cycle by cleaning up incoming edges from %d (weight = %f)\n", nextNode->layer->id(), minIncomingEdgeWeight); -#endif + DVLOG(2) << "Breaking cycle by cleaning up incoming edges from " << nextNode->layer->id() << " (weight = " << minIncomingEdgeWeight << ")"; } // Note: The original elements of the list are in no danger of having their ref count go to zero @@ -435,9 +412,7 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) for (LayerList::iterator it = first; it < last; it++) *it = sortedList[count++]->layer; -#if !defined( NDEBUG ) - LOG(CCLayerSorter, "Sorting end ----\n"); -#endif + DVLOG(2) << "Sorting end ----"; m_nodes.clear(); m_edges.clear(); diff --git a/cc/overdraw_metrics.cc b/cc/overdraw_metrics.cc index 8c43dec..f0b077d 100644 --- a/cc/overdraw_metrics.cc +++ b/cc/overdraw_metrics.cc @@ -12,7 +12,7 @@ #include "FloatQuad.h" #include "IntRect.h" #include "TraceEvent.h" -#include <public/Platform.h> +#include "base/metrics/histogram.h" #include <public/WebTransformationMatrix.h> using WebKit::WebTransformationMatrix; @@ -147,25 +147,24 @@ void CCOverdrawMetrics::recordMetricsInternal(MetricsType metricsType, const Lay float byteNormalization = normalization / 4; switch (metricsType) { - case DrawingToScreen: - WebKit::Platform::current()->histogramCustomCounts("Renderer4.pixelCountOpaque_Draw", static_cast<int>(normalization * m_pixelsDrawnOpaque), 100, 1000000, 50); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.pixelCountTranslucent_Draw", static_cast<int>(normalization * m_pixelsDrawnTranslucent), 100, 1000000, 50); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.pixelCountCulled_Draw", static_cast<int>(normalization * m_pixelsCulledForDrawing), 100, 1000000, 50); + case DrawingToScreen: { + HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountOpaque_Draw", static_cast<int>(normalization * m_pixelsDrawnOpaque), 100, 1000000, 50); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountTranslucent_Draw", static_cast<int>(normalization * m_pixelsDrawnTranslucent), 100, 1000000, 50); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountCulled_Draw", static_cast<int>(normalization * m_pixelsCulledForDrawing), 100, 1000000, 50); - { - TRACE_COUNTER_ID1("cc", "DrawPixelsCulled", layerTreeHost, m_pixelsCulledForDrawing); - TRACE_EVENT2("cc", "CCOverdrawMetrics", "PixelsDrawnOpaque", m_pixelsDrawnOpaque, "PixelsDrawnTranslucent", m_pixelsDrawnTranslucent); - } + TRACE_COUNTER_ID1("cc", "DrawPixelsCulled", layerTreeHost, m_pixelsCulledForDrawing); + TRACE_EVENT2("cc", "CCOverdrawMetrics", "PixelsDrawnOpaque", m_pixelsDrawnOpaque, "PixelsDrawnTranslucent", m_pixelsDrawnTranslucent); break; - case UpdateAndCommit: - WebKit::Platform::current()->histogramCustomCounts("Renderer4.pixelCountPainted", static_cast<int>(normalization * m_pixelsPainted), 100, 1000000, 50); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.pixelCountOpaque_Upload", static_cast<int>(normalization * m_pixelsUploadedOpaque), 100, 1000000, 50); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.pixelCountTranslucent_Upload", static_cast<int>(normalization * m_pixelsUploadedTranslucent), 100, 1000000, 50); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.tileCountCulled_Upload", static_cast<int>(tileNormalization * m_tilesCulledForUpload), 100, 10000000, 50); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.renderSurfaceTextureBytes_ViewportScaled", static_cast<int>(byteNormalization * m_renderSurfaceTextureUseBytes), 10, 1000000, 50); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.renderSurfaceTextureBytes_Unscaled", static_cast<int>(m_renderSurfaceTextureUseBytes / 1000), 1000, 100000000, 50); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.contentsTextureBytes_ViewportScaled", static_cast<int>(byteNormalization * m_contentsTextureUseBytes), 10, 1000000, 50); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.contentsTextureBytes_Unscaled", static_cast<int>(m_contentsTextureUseBytes / 1000), 1000, 100000000, 50); + } + case UpdateAndCommit: { + HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountPainted", static_cast<int>(normalization * m_pixelsPainted), 100, 1000000, 50); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountOpaque_Upload", static_cast<int>(normalization * m_pixelsUploadedOpaque), 100, 1000000, 50); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountTranslucent_Upload", static_cast<int>(normalization * m_pixelsUploadedTranslucent), 100, 1000000, 50); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.tileCountCulled_Upload", static_cast<int>(tileNormalization * m_tilesCulledForUpload), 100, 10000000, 50); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.renderSurfaceTextureBytes_ViewportScaled", static_cast<int>(byteNormalization * m_renderSurfaceTextureUseBytes), 10, 1000000, 50); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.renderSurfaceTextureBytes_Unscaled", static_cast<int>(m_renderSurfaceTextureUseBytes / 1000), 1000, 100000000, 50); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.contentsTextureBytes_ViewportScaled", static_cast<int>(byteNormalization * m_contentsTextureUseBytes), 10, 1000000, 50); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.contentsTextureBytes_Unscaled", static_cast<int>(m_contentsTextureUseBytes / 1000), 1000, 100000000, 50); { TRACE_COUNTER_ID1("cc", "UploadTilesCulled", layerTreeHost, m_tilesCulledForUpload); @@ -181,6 +180,7 @@ void CCOverdrawMetrics::recordMetricsInternal(MetricsType metricsType, const Lay } break; } + } } } // namespace cc diff --git a/cc/throttled_texture_uploader.cc b/cc/throttled_texture_uploader.cc index f2e95ce..fab8e3d 100644 --- a/cc/throttled_texture_uploader.cc +++ b/cc/throttled_texture_uploader.cc @@ -8,8 +8,8 @@ #include "CCPrioritizedTexture.h" #include "Extensions3DChromium.h" #include "TraceEvent.h" +#include "base/metrics/histogram.h" #include <algorithm> -#include <public/Platform.h> #include <public/WebGraphicsContext3D.h> #include <vector> @@ -184,7 +184,7 @@ void ThrottledTextureUploader::processQueries() break; unsigned usElapsed = m_pendingQueries.first()->value(); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.TextureGpuUploadTimeUS", usElapsed, 0, 100000, 50); + HISTOGRAM_CUSTOM_COUNTS("Renderer4.TextureGpuUploadTimeUS", usElapsed, 0, 100000, 50); if (!m_pendingQueries.first()->isNonBlocking()) m_numBlockingTextureUploads--; |