Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: cc/trees/layer_tree_host_in_process.cc

Issue 2484743002: UMA metric for LayerUpdateTimes (Closed)
Patch Set: Add missing header Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_in_process.h" 5 #include "cc/trees/layer_tree_host_in_process.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <memory> 11 #include <memory>
12 #include <stack> 12 #include <stack>
13 #include <string> 13 #include <string>
14 #include <unordered_map> 14 #include <unordered_map>
15 15
16 #include "base/atomic_sequence_num.h" 16 #include "base/atomic_sequence_num.h"
17 #include "base/bind.h" 17 #include "base/bind.h"
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "base/location.h" 19 #include "base/location.h"
20 #include "base/memory/ptr_util.h" 20 #include "base/memory/ptr_util.h"
21 #include "base/metrics/histogram_macros.h" 21 #include "base/metrics/histogram_macros.h"
22 #include "base/numerics/safe_math.h" 22 #include "base/numerics/safe_math.h"
23 #include "base/single_thread_task_runner.h" 23 #include "base/single_thread_task_runner.h"
24 #include "base/stl_util.h" 24 #include "base/stl_util.h"
25 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
26 #include "base/strings/stringprintf.h"
26 #include "base/threading/thread_task_runner_handle.h" 27 #include "base/threading/thread_task_runner_handle.h"
28 #include "base/timer/elapsed_timer.h"
27 #include "base/trace_event/trace_event.h" 29 #include "base/trace_event/trace_event.h"
28 #include "base/trace_event/trace_event_argument.h" 30 #include "base/trace_event/trace_event_argument.h"
29 #include "cc/base/math_util.h" 31 #include "cc/base/math_util.h"
30 #include "cc/blimp/client_picture_cache.h" 32 #include "cc/blimp/client_picture_cache.h"
31 #include "cc/blimp/engine_picture_cache.h" 33 #include "cc/blimp/engine_picture_cache.h"
32 #include "cc/blimp/image_serialization_processor.h" 34 #include "cc/blimp/image_serialization_processor.h"
33 #include "cc/blimp/picture_data.h" 35 #include "cc/blimp/picture_data.h"
34 #include "cc/blimp/picture_data_conversions.h" 36 #include "cc/blimp/picture_data_conversions.h"
35 #include "cc/debug/devtools_instrumentation.h" 37 #include "cc/debug/devtools_instrumentation.h"
36 #include "cc/debug/frame_viewer_instrumentation.h" 38 #include "cc/debug/frame_viewer_instrumentation.h"
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 577
576 void LayerTreeHostInProcess::Composite(base::TimeTicks frame_begin_time) { 578 void LayerTreeHostInProcess::Composite(base::TimeTicks frame_begin_time) {
577 DCHECK(IsSingleThreaded()); 579 DCHECK(IsSingleThreaded());
578 // This function is only valid when not using the scheduler. 580 // This function is only valid when not using the scheduler.
579 DCHECK(!settings_.single_thread_proxy_scheduler); 581 DCHECK(!settings_.single_thread_proxy_scheduler);
580 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); 582 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get());
581 583
582 proxy->CompositeImmediately(frame_begin_time); 584 proxy->CompositeImmediately(frame_begin_time);
583 } 585 }
584 586
587 static int GetLayersUpdateTimeHistogramBucket(size_t numLayers) {
588 // We uses the following exponential (ratio 2) bucketization:
589 // [0, 10), [10, 30), [30, 70), [70, 150), [150, infinity)
590 if (numLayers < 10)
591 return 0;
592 else if (numLayers >= 10 && numLayers < 30)
593 return 1;
594 else if (numLayers >= 30 && numLayers < 70)
595 return 2;
596 else if (numLayers >= 70 && numLayers < 150)
597 return 3;
598 else
599 return 4;
600 }
601
585 bool LayerTreeHostInProcess::UpdateLayers() { 602 bool LayerTreeHostInProcess::UpdateLayers() {
586 if (!layer_tree_->root_layer()) 603 if (!layer_tree_->root_layer())
587 return false; 604 return false;
588 DCHECK(!layer_tree_->root_layer()->parent()); 605 DCHECK(!layer_tree_->root_layer()->parent());
606 base::ElapsedTimer timer;
607
589 bool result = DoUpdateLayers(layer_tree_->root_layer()); 608 bool result = DoUpdateLayers(layer_tree_->root_layer());
590 micro_benchmark_controller_.DidUpdateLayers(); 609 micro_benchmark_controller_.DidUpdateLayers();
610
611 std::string histogram_name = base::StringPrintf(
612 "Compositing.Renderer.LayersUpdateTime.%d",
ajuma 2016/12/03 01:28:23 This is going to get called for both the browser a
majidvp 2016/12/08 20:19:18 Thanks for the comment. Fixed!
613 GetLayersUpdateTimeHistogramBucket(layer_tree_->NumLayers()));
614 base::Histogram::FactoryTimeGet(
615 histogram_name, base::TimeDelta::FromMilliseconds(1),
616 base::TimeDelta::FromSeconds(10), 50,
617 base::HistogramBase::kUmaTargetedHistogramFlag)
618 ->AddTime(timer.Elapsed());
619
591 return result || next_commit_forces_redraw_; 620 return result || next_commit_forces_redraw_;
592 } 621 }
593 622
594 void LayerTreeHostInProcess::DidCompletePageScaleAnimation() { 623 void LayerTreeHostInProcess::DidCompletePageScaleAnimation() {
595 did_complete_scale_animation_ = true; 624 did_complete_scale_animation_ = true;
596 } 625 }
597 626
598 void LayerTreeHostInProcess::RecordGpuRasterizationHistogram() { 627 void LayerTreeHostInProcess::RecordGpuRasterizationHistogram() {
599 // Gpu rasterization is only supported for Renderer compositors. 628 // Gpu rasterization is only supported for Renderer compositors.
600 // Checking for IsSingleThreaded() to exclude Browser compositors. 629 // Checking for IsSingleThreaded() to exclude Browser compositors.
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 return compositor_mode_ == CompositorMode::SINGLE_THREADED; 850 return compositor_mode_ == CompositorMode::SINGLE_THREADED;
822 } 851 }
823 852
824 bool LayerTreeHostInProcess::IsThreaded() const { 853 bool LayerTreeHostInProcess::IsThreaded() const {
825 DCHECK(compositor_mode_ != CompositorMode::THREADED || 854 DCHECK(compositor_mode_ != CompositorMode::THREADED ||
826 task_runner_provider_->HasImplThread()); 855 task_runner_provider_->HasImplThread());
827 return compositor_mode_ == CompositorMode::THREADED; 856 return compositor_mode_ == CompositorMode::THREADED;
828 } 857 }
829 858
830 } // namespace cc 859 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698