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

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

Issue 2484743002: UMA metric for LayerUpdateTimes (Closed)
Patch Set: Address feedback 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"
31 #include "cc/base/histograms.h"
29 #include "cc/base/math_util.h" 32 #include "cc/base/math_util.h"
30 #include "cc/blimp/client_picture_cache.h" 33 #include "cc/blimp/client_picture_cache.h"
31 #include "cc/blimp/engine_picture_cache.h" 34 #include "cc/blimp/engine_picture_cache.h"
32 #include "cc/blimp/image_serialization_processor.h" 35 #include "cc/blimp/image_serialization_processor.h"
33 #include "cc/blimp/picture_data.h" 36 #include "cc/blimp/picture_data.h"
34 #include "cc/blimp/picture_data_conversions.h" 37 #include "cc/blimp/picture_data_conversions.h"
35 #include "cc/debug/devtools_instrumentation.h" 38 #include "cc/debug/devtools_instrumentation.h"
36 #include "cc/debug/frame_viewer_instrumentation.h" 39 #include "cc/debug/frame_viewer_instrumentation.h"
37 #include "cc/debug/rendering_stats_instrumentation.h" 40 #include "cc/debug/rendering_stats_instrumentation.h"
38 #include "cc/input/layer_selection_bound.h" 41 #include "cc/input/layer_selection_bound.h"
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 578
576 void LayerTreeHostInProcess::Composite(base::TimeTicks frame_begin_time) { 579 void LayerTreeHostInProcess::Composite(base::TimeTicks frame_begin_time) {
577 DCHECK(IsSingleThreaded()); 580 DCHECK(IsSingleThreaded());
578 // This function is only valid when not using the scheduler. 581 // This function is only valid when not using the scheduler.
579 DCHECK(!settings_.single_thread_proxy_scheduler); 582 DCHECK(!settings_.single_thread_proxy_scheduler);
580 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); 583 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get());
581 584
582 proxy->CompositeImmediately(frame_begin_time); 585 proxy->CompositeImmediately(frame_begin_time);
583 } 586 }
584 587
588 static int GetLayersUpdateTimeHistogramBucket(size_t numLayers) {
589 // We uses the following exponential (ratio 2) bucketization:
590 // [0, 10), [10, 30), [30, 70), [70, 150), [150, infinity)
591 if (numLayers < 10)
592 return 0;
593 if (numLayers < 30)
594 return 1;
595 if (numLayers < 70)
596 return 2;
597 if (numLayers < 150)
598 return 3;
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 if (const char* client_name = GetClientNameForMetrics()) {
612 std::string histogram_name = base::StringPrintf(
613 "Compositing.%s.LayersUpdateTime.%d", client_name,
614 GetLayersUpdateTimeHistogramBucket(layer_tree_->NumLayers()));
615 base::Histogram::FactoryGet(histogram_name, 0, 10000000, 50,
616 base::HistogramBase::kUmaTargetedHistogramFlag)
617 ->Add(timer.Elapsed().InMicroseconds());
618 }
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