OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/overdraw_metrics.h" | 5 #include "cc/overdraw_metrics.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "cc/layer_tree_host.h" | 9 #include "cc/layer_tree_host.h" |
10 #include "cc/layer_tree_host_impl.h" | 10 #include "cc/layer_tree_host_impl.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 { | 137 { |
138 // This gives approximately 10x the percentage of pixels to fill the viewpor
t once. | 138 // This gives approximately 10x the percentage of pixels to fill the viewpor
t once. |
139 float normalization = 1000.f / (layerTreeHost->deviceViewportSize().width()
* layerTreeHost->deviceViewportSize().height()); | 139 float normalization = 1000.f / (layerTreeHost->deviceViewportSize().width()
* layerTreeHost->deviceViewportSize().height()); |
140 // This gives approximately 100x the percentage of tiles to fill the viewpor
t once, if all tiles were 256x256. | 140 // This gives approximately 100x the percentage of tiles to fill the viewpor
t once, if all tiles were 256x256. |
141 float tileNormalization = 10000.f / (layerTreeHost->deviceViewportSize().wid
th() / 256.f * layerTreeHost->deviceViewportSize().height() / 256.f); | 141 float tileNormalization = 10000.f / (layerTreeHost->deviceViewportSize().wid
th() / 256.f * layerTreeHost->deviceViewportSize().height() / 256.f); |
142 // This gives approximately 10x the percentage of bytes to fill the viewport
once, assuming 4 bytes per pixel. | 142 // This gives approximately 10x the percentage of bytes to fill the viewport
once, assuming 4 bytes per pixel. |
143 float byteNormalization = normalization / 4; | 143 float byteNormalization = normalization / 4; |
144 | 144 |
145 switch (metricsType) { | 145 switch (metricsType) { |
146 case DrawingToScreen: { | 146 case DrawingToScreen: { |
147 HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountOpaque_Draw", static_cast<i
nt>(normalization * m_pixelsDrawnOpaque), 100, 1000000, 50); | 147 UMA_HISTOGRAM_CUSTOM_COUNTS( |
148 HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountTranslucent_Draw", static_c
ast<int>(normalization * m_pixelsDrawnTranslucent), 100, 1000000, 50); | 148 "Renderer4.pixelCountOpaque_Draw", |
149 HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountCulled_Draw", static_cast<i
nt>(normalization * m_pixelsCulledForDrawing), 100, 1000000, 50); | 149 static_cast<int>(normalization * m_pixelsDrawnOpaque), |
| 150 100, 1000000, 50); |
| 151 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 152 "Renderer4.pixelCountTranslucent_Draw", |
| 153 static_cast<int>(normalization * m_pixelsDrawnTranslucent), |
| 154 100, 1000000, 50); |
| 155 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 156 "Renderer4.pixelCountCulled_Draw", |
| 157 static_cast<int>(normalization * m_pixelsCulledForDrawing), |
| 158 100, 1000000, 50); |
150 | 159 |
151 TRACE_COUNTER_ID1("cc", "DrawPixelsCulled", layerTreeHost, m_pixelsCulle
dForDrawing); | 160 TRACE_COUNTER_ID1("cc", "DrawPixelsCulled", layerTreeHost, m_pixelsCulle
dForDrawing); |
152 TRACE_EVENT2("cc", "OverdrawMetrics", "PixelsDrawnOpaque", m_pixelsDrawn
Opaque, "PixelsDrawnTranslucent", m_pixelsDrawnTranslucent); | 161 TRACE_EVENT2("cc", "OverdrawMetrics", "PixelsDrawnOpaque", m_pixelsDrawn
Opaque, "PixelsDrawnTranslucent", m_pixelsDrawnTranslucent); |
153 break; | 162 break; |
154 } | 163 } |
155 case UpdateAndCommit: { | 164 case UpdateAndCommit: { |
156 HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountPainted", static_cast<int>(
normalization * m_pixelsPainted), 100, 1000000, 50); | 165 UMA_HISTOGRAM_CUSTOM_COUNTS( |
157 HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountOpaque_Upload", static_cast
<int>(normalization * m_pixelsUploadedOpaque), 100, 1000000, 50); | 166 "Renderer4.pixelCountPainted", |
158 HISTOGRAM_CUSTOM_COUNTS("Renderer4.pixelCountTranslucent_Upload", static
_cast<int>(normalization * m_pixelsUploadedTranslucent), 100, 1000000, 50); | 167 static_cast<int>(normalization * m_pixelsPainted), |
159 HISTOGRAM_CUSTOM_COUNTS("Renderer4.tileCountCulled_Upload", static_cast<
int>(tileNormalization * m_tilesCulledForUpload), 100, 10000000, 50); | 168 100, 1000000, 50); |
160 HISTOGRAM_CUSTOM_COUNTS("Renderer4.renderSurfaceTextureBytes_ViewportSca
led", static_cast<int>(byteNormalization * m_renderSurfaceTextureUseBytes), 10,
1000000, 50); | 169 UMA_HISTOGRAM_CUSTOM_COUNTS( |
161 HISTOGRAM_CUSTOM_COUNTS("Renderer4.renderSurfaceTextureBytes_Unscaled",
static_cast<int>(m_renderSurfaceTextureUseBytes / 1000), 1000, 100000000, 50); | 170 "Renderer4.pixelCountOpaque_Upload", |
162 HISTOGRAM_CUSTOM_COUNTS("Renderer4.contentsTextureBytes_ViewportScaled",
static_cast<int>(byteNormalization * m_contentsTextureUseBytes), 10, 1000000, 5
0); | 171 static_cast<int>(normalization * m_pixelsUploadedOpaque), |
163 HISTOGRAM_CUSTOM_COUNTS("Renderer4.contentsTextureBytes_Unscaled", stati
c_cast<int>(m_contentsTextureUseBytes / 1000), 1000, 100000000, 50); | 172 100, 1000000, 50); |
| 173 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 174 "Renderer4.pixelCountTranslucent_Upload", |
| 175 static_cast<int>(normalization * m_pixelsUploadedTranslucent), |
| 176 100, 1000000, 50); |
| 177 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 178 "Renderer4.tileCountCulled_Upload", |
| 179 static_cast<int>(tileNormalization * m_tilesCulledForUpload), |
| 180 100, 10000000, 50); |
| 181 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 182 "Renderer4.renderSurfaceTextureBytes_ViewportScaled", |
| 183 static_cast<int>( |
| 184 byteNormalization * m_renderSurfaceTextureUseBytes), |
| 185 10, 1000000, 50); |
| 186 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 187 "Renderer4.renderSurfaceTextureBytes_Unscaled", |
| 188 static_cast<int>(m_renderSurfaceTextureUseBytes / 1000), |
| 189 1000, 100000000, 50); |
| 190 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 191 "Renderer4.contentsTextureBytes_ViewportScaled", |
| 192 static_cast<int>(byteNormalization * m_contentsTextureUseBytes), |
| 193 10, 1000000, 50); |
| 194 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 195 "Renderer4.contentsTextureBytes_Unscaled", |
| 196 static_cast<int>(m_contentsTextureUseBytes / 1000), |
| 197 1000, 100000000, 50); |
164 | 198 |
165 { | 199 { |
166 TRACE_COUNTER_ID1("cc", "UploadTilesCulled", layerTreeHost, m_tilesC
ulledForUpload); | 200 TRACE_COUNTER_ID1("cc", "UploadTilesCulled", layerTreeHost, m_tilesC
ulledForUpload); |
167 TRACE_EVENT2("cc", "OverdrawMetrics", "PixelsUploadedOpaque", m_pixe
lsUploadedOpaque, "PixelsUploadedTranslucent", m_pixelsUploadedTranslucent); | 201 TRACE_EVENT2("cc", "OverdrawMetrics", "PixelsUploadedOpaque", m_pixe
lsUploadedOpaque, "PixelsUploadedTranslucent", m_pixelsUploadedTranslucent); |
168 } | 202 } |
169 { | 203 { |
170 // This must be in a different scope than the TRACE_EVENT2 above. | 204 // This must be in a different scope than the TRACE_EVENT2 above. |
171 TRACE_EVENT1("cc", "OverdrawPaintMetrics", "PixelsPainted", m_pixels
Painted); | 205 TRACE_EVENT1("cc", "OverdrawPaintMetrics", "PixelsPainted", m_pixels
Painted); |
172 } | 206 } |
173 { | 207 { |
174 // This must be in a different scope than the TRACE_EVENTs above. | 208 // This must be in a different scope than the TRACE_EVENTs above. |
175 TRACE_EVENT2("cc", "OverdrawPaintMetrics", "ContentsTextureBytes", m
_contentsTextureUseBytes, "RenderSurfaceTextureBytes", m_renderSurfaceTextureUse
Bytes); | 209 TRACE_EVENT2("cc", "OverdrawPaintMetrics", "ContentsTextureBytes", m
_contentsTextureUseBytes, "RenderSurfaceTextureBytes", m_renderSurfaceTextureUse
Bytes); |
176 } | 210 } |
177 break; | 211 break; |
178 } | 212 } |
179 } | 213 } |
180 } | 214 } |
181 | 215 |
182 } // namespace cc | 216 } // namespace cc |
OLD | NEW |