summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordneto@chromium.org <dneto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-14 16:57:59 +0000
committerdneto@chromium.org <dneto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-14 16:57:59 +0000
commitaebf4624ae95abebd8983aaf6f3b5c82c57946d2 (patch)
tree280ef6c2c36c0fee408912d06fe5c70f59945476
parent43d33e91527fc4320e5d555fd947910dbd95b9ad (diff)
downloadchromium_src-aebf4624ae95abebd8983aaf6f3b5c82c57946d2.zip
chromium_src-aebf4624ae95abebd8983aaf6f3b5c82c57946d2.tar.gz
chromium_src-aebf4624ae95abebd8983aaf6f3b5c82c57946d2.tar.bz2
Add a UMA for the number of layers in a frame.
Reported from the compositor thread. BUG=253919 Review URL: https://codereview.chromium.org/375093002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282964 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/trees/layer_tree_host_impl.cc3
-rw-r--r--cc/trees/layer_tree_impl.cc4
-rw-r--r--cc/trees/layer_tree_impl.h2
-rw-r--r--cc/trees/layer_tree_impl_unittest.cc15
-rw-r--r--tools/metrics/histograms/histograms.xml8
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>