Commit aebf4624 authored by dneto@chromium.org's avatar dneto@chromium.org

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
parent 43d33e91
......@@ -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";
......
......@@ -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(),
......
......@@ -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);
......
......@@ -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
......@@ -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>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment