Index: cc/scheduler/compositor_timing_history.cc |
diff --git a/cc/scheduler/compositor_timing_history.cc b/cc/scheduler/compositor_timing_history.cc |
index e9be0b03e3314194c83e32998244cd4fa681b195..34726d5ddf8795792d6f0fa7a85aeef5ba9193de 100644 |
--- a/cc/scheduler/compositor_timing_history.cc |
+++ b/cc/scheduler/compositor_timing_history.cc |
@@ -38,7 +38,6 @@ namespace { |
// second. |
// TODO(brianderson): Fine tune the percentiles below. |
const size_t kDurationHistorySize = 60; |
-const size_t kDrawsBeforeEstimatesAffected = 2; |
const double kBeginMainFrameToCommitEstimationPercentile = 90.0; |
const double kCommitToReadyToActivateEstimationPercentile = 90.0; |
const double kPrepareTilesEstimationPercentile = 90.0; |
@@ -199,7 +198,6 @@ CompositorTimingHistory::CompositorTimingHistory( |
UMACategory uma_category, |
RenderingStatsInstrumentation* rendering_stats_instrumentation) |
: enabled_(false), |
- draws_left_before_estimates_affected_(0), |
begin_main_frame_to_commit_duration_history_(kDurationHistorySize), |
commit_to_ready_to_activate_duration_history_(kDurationHistorySize), |
prepare_tiles_duration_history_(kDurationHistorySize), |
@@ -246,18 +244,8 @@ base::TimeTicks CompositorTimingHistory::Now() const { |
return base::TimeTicks::Now(); |
} |
-bool CompositorTimingHistory::AffectsEstimate() const { |
- return enabled_ && (draws_left_before_estimates_affected_ == 0); |
-} |
- |
void CompositorTimingHistory::SetRecordingEnabled(bool enabled) { |
- if (enabled == enabled_) |
- return; |
- |
enabled_ = enabled; |
- |
- if (enabled_) |
- draws_left_before_estimates_affected_ = kDrawsBeforeEstimatesAffected; |
} |
base::TimeDelta |
@@ -307,15 +295,13 @@ void CompositorTimingHistory::DidCommit() { |
// of our predictions. |
base::TimeDelta begin_main_frame_to_commit_estimate = |
BeginMainFrameToCommitDurationEstimate(); |
- |
+ uma_reporter_->AddBeginMainFrameToCommitDuration( |
+ begin_main_frame_to_commit_duration, begin_main_frame_to_commit_estimate, |
+ enabled_); |
rendering_stats_instrumentation_->AddBeginMainFrameToCommitDuration( |
begin_main_frame_to_commit_duration, begin_main_frame_to_commit_estimate); |
- bool affects_estimate = AffectsEstimate(); |
- uma_reporter_->AddBeginMainFrameToCommitDuration( |
- begin_main_frame_to_commit_duration, begin_main_frame_to_commit_estimate, |
- affects_estimate); |
- if (affects_estimate) { |
+ if (enabled_) { |
begin_main_frame_to_commit_duration_history_.InsertSample( |
begin_main_frame_to_commit_duration); |
} |
@@ -332,11 +318,9 @@ void CompositorTimingHistory::DidPrepareTiles() { |
DCHECK_NE(base::TimeTicks(), start_prepare_tiles_time_); |
base::TimeDelta prepare_tiles_duration = Now() - start_prepare_tiles_time_; |
- |
- bool affects_estimate = AffectsEstimate(); |
uma_reporter_->AddPrepareTilesDuration( |
- prepare_tiles_duration, PrepareTilesDurationEstimate(), affects_estimate); |
- if (affects_estimate) |
+ prepare_tiles_duration, PrepareTilesDurationEstimate(), enabled_); |
+ if (enabled_) |
prepare_tiles_duration_history_.InsertSample(prepare_tiles_duration); |
start_prepare_tiles_time_ = base::TimeTicks(); |
@@ -356,14 +340,12 @@ void CompositorTimingHistory::ReadyToActivate() { |
base::TimeDelta commit_to_ready_to_activate_estimate = |
CommitToReadyToActivateDurationEstimate(); |
+ uma_reporter_->AddCommitToReadyToActivateDuration( |
+ time_since_commit, commit_to_ready_to_activate_estimate, enabled_); |
rendering_stats_instrumentation_->AddCommitToActivateDuration( |
time_since_commit, commit_to_ready_to_activate_estimate); |
- bool affects_estimate = AffectsEstimate(); |
- uma_reporter_->AddCommitToReadyToActivateDuration( |
- time_since_commit, commit_to_ready_to_activate_estimate, |
- affects_estimate); |
- if (affects_estimate) { |
+ if (enabled_) { |
commit_to_ready_to_activate_duration_history_.InsertSample( |
time_since_commit); |
} |
@@ -380,10 +362,9 @@ void CompositorTimingHistory::DidActivate() { |
DCHECK_NE(base::TimeTicks(), start_activate_time_); |
base::TimeDelta activate_duration = Now() - start_activate_time_; |
- bool affects_estimate = AffectsEstimate(); |
- uma_reporter_->AddActivateDuration( |
- activate_duration, ActivateDurationEstimate(), affects_estimate); |
- if (affects_estimate) |
+ uma_reporter_->AddActivateDuration(activate_duration, |
+ ActivateDurationEstimate(), enabled_); |
+ if (enabled_) |
activate_duration_history_.InsertSample(activate_duration); |
start_activate_time_ = base::TimeTicks(); |
@@ -405,14 +386,11 @@ void CompositorTimingHistory::DidDraw() { |
rendering_stats_instrumentation_->AddDrawDuration(draw_duration, |
draw_estimate); |
- bool affects_estimate = AffectsEstimate(); |
- uma_reporter_->AddDrawDuration(draw_duration, draw_estimate, |
- affects_estimate); |
- if (affects_estimate) |
- draw_duration_history_.InsertSample(draw_duration); |
+ uma_reporter_->AddDrawDuration(draw_duration, draw_estimate, enabled_); |
- if (draws_left_before_estimates_affected_ > 0) |
- draws_left_before_estimates_affected_--; |
+ if (enabled_) { |
+ draw_duration_history_.InsertSample(draw_duration); |
+ } |
start_draw_time_ = base::TimeTicks(); |
} |