diff options
author | hartmanng@chromium.org <hartmanng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-24 16:18:43 +0000 |
---|---|---|
committer | hartmanng@chromium.org <hartmanng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-24 16:18:43 +0000 |
commit | 7924c1854df84611ce14ddb697dfb3f5a38c9067 (patch) | |
tree | 006677968217afa6d398952a7d565aae5d3ea078 | |
parent | 4f7a9adcf498a8b7faa1634e523063ee281f5461 (diff) | |
download | chromium_src-7924c1854df84611ce14ddb697dfb3f5a38c9067.zip chromium_src-7924c1854df84611ce14ddb697dfb3f5a38c9067.tar.gz chromium_src-7924c1854df84611ce14ddb697dfb3f5a38c9067.tar.bz2 |
Add UMA stats to track LCD text AA effort.
BUG=235480
Review URL: https://chromiumcodereview.appspot.com/14932016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202104 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/layers/content_layer.cc | 4 | ||||
-rw-r--r-- | cc/layers/content_layer.h | 2 | ||||
-rw-r--r-- | cc/layers/layer.cc | 4 | ||||
-rw-r--r-- | cc/layers/layer.h | 2 | ||||
-rw-r--r-- | cc/layers/picture_layer.cc | 4 | ||||
-rw-r--r-- | cc/layers/picture_layer.h | 1 | ||||
-rw-r--r-- | cc/trees/layer_tree_host.cc | 61 | ||||
-rw-r--r-- | cc/trees/layer_tree_host.h | 19 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 18 |
9 files changed, 114 insertions, 1 deletions
diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc index 44af47e..9269f7c 100644 --- a/cc/layers/content_layer.cc +++ b/cc/layers/content_layer.cc @@ -132,4 +132,8 @@ void ContentLayer::UpdateCanUseLCDText() { client_->DidChangeLayerCanUseLCDText(); } +bool ContentLayer::SupportsLCDText() const { + return true; +} + } // namespace cc diff --git a/cc/layers/content_layer.h b/cc/layers/content_layer.h index 79394de..db574bc 100644 --- a/cc/layers/content_layer.h +++ b/cc/layers/content_layer.h @@ -50,6 +50,8 @@ class CC_EXPORT ContentLayer : public TiledLayer { virtual void SetContentsOpaque(bool contents_opaque) OVERRIDE; + virtual bool SupportsLCDText() const OVERRIDE; + protected: explicit ContentLayer(ContentLayerClient* client); virtual ~ContentLayer(); diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index cdc2d8d..0390f04 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -852,4 +852,8 @@ RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { return layer_tree_host_->rendering_stats_instrumentation(); } +bool Layer::SupportsLCDText() const { + return false; +} + } // namespace cc diff --git a/cc/layers/layer.h b/cc/layers/layer.h index 1c1f3e4..ee8cd02 100644 --- a/cc/layers/layer.h +++ b/cc/layers/layer.h @@ -372,6 +372,8 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, float raster_scale() const { return raster_scale_; } bool raster_scale_is_unknown() const { return raster_scale_ == 0.f; } + virtual bool SupportsLCDText() const; + protected: friend class LayerImpl; friend class TreeSynchronizer; diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc index 4f4b385..e01656a 100644 --- a/cc/layers/picture_layer.cc +++ b/cc/layers/picture_layer.cc @@ -102,4 +102,8 @@ void PictureLayer::SetIsMask(bool is_mask) { is_mask_ = is_mask; } +bool PictureLayer::SupportsLCDText() const { + return true; +} + } // namespace cc diff --git a/cc/layers/picture_layer.h b/cc/layers/picture_layer.h index 0cb1583..bb5892a 100644 --- a/cc/layers/picture_layer.h +++ b/cc/layers/picture_layer.h @@ -35,6 +35,7 @@ class CC_EXPORT PictureLayer : public ContentsScalingLayer { const OcclusionTracker* occlusion, RenderingStats* stats) OVERRIDE; virtual void SetIsMask(bool is_mask) OVERRIDE; + virtual bool SupportsLCDText() const OVERRIDE; protected: explicit PictureLayer(ContentLayerClient* client); diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 4448f87..b8b02be 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -11,6 +11,7 @@ #include "base/command_line.h" #include "base/debug/trace_event.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/stl_util.h" #include "base/string_number_conversions.h" #include "cc/animation/animation_registrar.h" @@ -97,7 +98,8 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, background_color_(SK_ColorWHITE), has_transparent_background_(false), partial_texture_update_requests_(0), - in_paint_layer_contents_(false) { + in_paint_layer_contents_(false), + total_frames_used_for_lcd_text_metrics_(0) { if (settings_.accelerated_animation_enabled) animation_registrar_ = AnimationRegistrar::Create(); s_num_layer_tree_instances++; @@ -672,6 +674,42 @@ static Layer* FindFirstScrollableLayer(Layer* layer) { return NULL; } +class CalculateLCDTextMetricsFunctor { + public: + void operator()(Layer* layer) { + LayerTreeHost* layer_tree_host = layer->layer_tree_host(); + if (!layer_tree_host) + return; + + if (!layer->SupportsLCDText()) + return; + + bool update_total_num_cc_layers_can_use_lcd_text = false; + bool update_total_num_cc_layers_will_use_lcd_text = false; + if (layer->draw_properties().can_use_lcd_text) { + update_total_num_cc_layers_can_use_lcd_text = true; + if (layer->contents_opaque()) + update_total_num_cc_layers_will_use_lcd_text = true; + } + + layer_tree_host->IncrementLCDTextMetrics( + update_total_num_cc_layers_can_use_lcd_text, + update_total_num_cc_layers_will_use_lcd_text); + } +}; + +void LayerTreeHost::IncrementLCDTextMetrics( + bool update_total_num_cc_layers_can_use_lcd_text, + bool update_total_num_cc_layers_will_use_lcd_text) { + lcd_text_metrics_.total_num_cc_layers++; + if (update_total_num_cc_layers_can_use_lcd_text) + lcd_text_metrics_.total_num_cc_layers_can_use_lcd_text++; + if (update_total_num_cc_layers_will_use_lcd_text) { + DCHECK(update_total_num_cc_layers_can_use_lcd_text); + lcd_text_metrics_.total_num_cc_layers_will_use_lcd_text++; + } +} + void LayerTreeHost::UpdateLayers(Layer* root_layer, ResourceUpdateQueue* queue) { TRACE_EVENT1("cc", "LayerTreeHost::UpdateLayers", @@ -694,6 +732,27 @@ void LayerTreeHost::UpdateLayers(Layer* root_layer, settings_.can_use_lcd_text, settings_.layer_transforms_should_scale_layer_contents, &update_list); + + if (total_frames_used_for_lcd_text_metrics_ <= + kTotalFramesToUseForLCDTextMetrics) { + LayerTreeHostCommon::CallFunctionForSubtree< + CalculateLCDTextMetricsFunctor, Layer>(root_layer); + total_frames_used_for_lcd_text_metrics_++; + } + + if (total_frames_used_for_lcd_text_metrics_ == + kTotalFramesToUseForLCDTextMetrics) { + total_frames_used_for_lcd_text_metrics_++; + + UMA_HISTOGRAM_PERCENTAGE( + "Renderer4.LCDText.PercentageOfCandidateLayers", + lcd_text_metrics_.total_num_cc_layers_can_use_lcd_text * 100.0 / + lcd_text_metrics_.total_num_cc_layers); + UMA_HISTOGRAM_PERCENTAGE( + "Renderer4.LCDText.PercentageOfAALayers", + lcd_text_metrics_.total_num_cc_layers_will_use_lcd_text * 100.0 / + lcd_text_metrics_.total_num_cc_layers_can_use_lcd_text); + } } // Reset partial texture update requests. diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index ea2997a..d0f6801 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h @@ -255,6 +255,10 @@ class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { bool in_paint_layer_contents() const { return in_paint_layer_contents_; } + void IncrementLCDTextMetrics( + bool update_total_num_cc_layers_can_use_lcd_text, + bool update_total_num_cc_layers_will_use_lcd_text); + protected: LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings); bool Initialize(scoped_ptr<Thread> impl_thread); @@ -346,6 +350,21 @@ class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { LatencyInfo latency_info_; + static const int kTotalFramesToUseForLCDTextMetrics = 50; + int total_frames_used_for_lcd_text_metrics_; + + struct LCDTextMetrics { + LCDTextMetrics() + : total_num_cc_layers(0), + total_num_cc_layers_can_use_lcd_text(0), + total_num_cc_layers_will_use_lcd_text(0) {} + + int64 total_num_cc_layers; + int64 total_num_cc_layers_can_use_lcd_text; + int64 total_num_cc_layers_will_use_lcd_text; + }; + LCDTextMetrics lcd_text_metrics_; + DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); }; diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index bd799a0..5510996 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -7220,6 +7220,24 @@ other types of suffix sets. <summary>TBD</summary> </histogram> +<histogram name="Renderer4.LCDText.PercentageOfAALayers" units="%"> + <summary> + The ratio of LCDText CC Layers / candidate LCDText layers. Recorded in + LayerTreeHost, after LayerTreeHostCommon::CalculateDrawProperties() has + computed the properties we need. Only recorded for the first 50 frames of + every page. + </summary> +</histogram> + +<histogram name="Renderer4.LCDText.PercentageOfCandidateLayers" units="%"> + <summary> + The ratio of CC Layers which are candidates for LCDText AA / total picture + or content Layers. Recorded in LayerTreeHost, after + LayerTreeHostCommon::CalculateDrawProperties() has computed the properties + we need. Only recorded for the first 50 frames of every page. + </summary> +</histogram> + <histogram name="Renderer4.RequestToFinish" units="milliseconds"> <summary> Time from "request" to "finish." "Request"== |