diff options
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 3 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl.h | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl_unittest.cc | 15 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 8 |
5 files changed, 32 insertions, 0 deletions
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 3b97191..fd0d1d3 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -1102,6 +1102,9 @@ DrawResult LayerTreeHostImpl::PrepareToDraw(FrameData* frame) { } need_to_update_visible_tiles_before_draw_ = true; + UMA_HISTOGRAM_CUSTOM_COUNTS( + "Compositing.NumActiveLayers", active_tree_->NumLayers(), 1, 400, 20); + bool ok = active_tree_->UpdateDrawProperties(); DCHECK(ok) << "UpdateDrawProperties failed during draw"; diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 908e993..bf0a996 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc @@ -561,6 +561,10 @@ void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) { layer_id_map_.erase(layer->id()); } +size_t LayerTreeImpl::NumLayers() { + return layer_id_map_.size(); +} + void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pending_tree) { pending_tree->SetCurrentlyScrollingLayer( LayerTreeHostCommon::FindLayerInSubtree(pending_tree->root_layer(), diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index ea636ca..13746c3 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h @@ -205,6 +205,8 @@ class CC_EXPORT LayerTreeImpl { void RegisterLayer(LayerImpl* layer); void UnregisterLayer(LayerImpl* layer); + size_t NumLayers(); + AnimationRegistrar* animationRegistrar() const; void PushPersistedState(LayerTreeImpl* pending_tree); diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc index 9edf838..d215349 100644 --- a/cc/trees/layer_tree_impl_unittest.cc +++ b/cc/trees/layer_tree_impl_unittest.cc @@ -2319,5 +2319,20 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) { EXPECT_TRUE(right_output.visible); } +TEST_F(LayerTreeImplTest, NumLayersTestOne) { + EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); + scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); + EXPECT_EQ(1u, host_impl().active_tree()->NumLayers()); +} + +TEST_F(LayerTreeImplTest, NumLayersSmallTree) { + EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); + scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); + root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); + root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); + root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); + EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); +} + } // namespace } // namespace cc diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 1374c6a..6a00a56 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -2743,6 +2743,14 @@ Therefore, the affected-histogram name has to have at least one dot in it. </summary> </histogram> +<histogram name="Compositing.NumActiveLayers"> + <owner>dneto@chromium.org</owner> + <summary> + The number of layers in the active tree for each compositor frame. This is + logged once per frame, before the frame is drawn. + </summary> +</histogram> + <histogram name="ConnectivityDiagnostics.ChromeOsSignalStrength" units="percent"> <owner>ebeach@google.com</owner> |