Chromium Code Reviews| Index: third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc |
| diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc |
| index f3369ecb1d37ebb10a89938fb290bf28bd1e0067..99ba7c9eeeb6917ae8c7e19430332a34c3b9eb1d 100644 |
| --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc |
| +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc |
| @@ -50,6 +50,8 @@ constexpr base::TimeDelta kThreadLoadTrackerWaitingPeriodBeforeReporting = |
| // We do not throttle anything while audio is played and shortly after that. |
| constexpr base::TimeDelta kThrottlingDelayAfterAudioIsPlayed = |
| base::TimeDelta::FromSeconds(5); |
| +constexpr base::TimeDelta kQueueingTimeWindowDuration = |
| + base::TimeDelta::FromSeconds(1); |
| void ReportForegroundRendererTaskLoad(base::TimeTicks time, double load) { |
| if (!blink::RuntimeEnabledFeatures::timerThrottlingForBackgroundTabsEnabled()) |
| @@ -106,7 +108,7 @@ RendererSchedulerImpl::RendererSchedulerImpl( |
| base::Unretained(this)), |
| helper_.ControlTaskQueue()), |
| seqlock_queueing_time_estimator_( |
| - QueueingTimeEstimator(this, base::TimeDelta::FromSeconds(1))), |
| + QueueingTimeEstimator(this, kQueueingTimeWindowDuration, 20)), |
| main_thread_only_(this, |
| compositor_task_queue_, |
| helper_.scheduler_tqm_delegate().get(), |
| @@ -1670,7 +1672,6 @@ bool RendererSchedulerImpl::MainThreadSeemsUnresponsive( |
| base::TimeDelta estimated_queueing_time; |
| bool can_read = false; |
| - QueueingTimeEstimator::State queueing_time_estimator_state; |
| base::subtle::Atomic32 version; |
| seqlock_queueing_time_estimator_.seqlock.TryRead(&can_read, &version); |
| @@ -1680,7 +1681,7 @@ bool RendererSchedulerImpl::MainThreadSeemsUnresponsive( |
| if (!can_read) |
| return GetCompositorThreadOnly().main_thread_seems_unresponsive; |
| - queueing_time_estimator_state = |
| + QueueingTimeEstimator::State queueing_time_estimator_state = |
| seqlock_queueing_time_estimator_.data.GetState(); |
| // If we fail to determine if the main thread is busy, assume whether or not |
| @@ -1831,12 +1832,24 @@ void RendererSchedulerImpl::RemoveTaskTimeObserver( |
| } |
| void RendererSchedulerImpl::OnQueueingTimeForWindowEstimated( |
| - base::TimeDelta queueing_time) { |
| + base::TimeDelta queueing_time, |
| + base::TimeTicks window_start_time) { |
| + // RendererScheduler reports the queueing time once per window's duration. |
| + // |stepEQT|stepEQT|stepEQT|stepEQT|stepEQT|stepEQT| |
| + // Report: |-------window EQT------| |
| + // Discard: |-------window EQT------| |
| + // Discard: |-------window EQT------| |
| + // Report: |-------window EQT------| |
| + if (window_start_time - this->uma_last_report_window_start_time_ < |
|
tdresser
2017/05/11 13:52:45
this->uma_last_report_window_start_time_ -> uma_la
Liquan (Max) Gu
2017/05/11 15:14:13
Right.
|
| + kQueueingTimeWindowDuration) { |
| + return; |
| + } |
| UMA_HISTOGRAM_TIMES("RendererScheduler.ExpectedTaskQueueingDuration", |
| queueing_time); |
| TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
| "estimated_queueing_time_for_window", |
| queueing_time.InMillisecondsF()); |
| + this->uma_last_report_window_start_time_ = window_start_time; |
| } |
| AutoAdvancingVirtualTimeDomain* RendererSchedulerImpl::GetVirtualTimeDomain() { |