| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "platform/scheduler/renderer/renderer_scheduler_impl.h" | 5 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 const int kTimerTaskEstimationSampleCount = 1000; | 34 const int kTimerTaskEstimationSampleCount = 1000; |
| 35 const double kTimerTaskEstimationPercentile = 99; | 35 const double kTimerTaskEstimationPercentile = 99; |
| 36 const int kShortIdlePeriodDurationSampleCount = 10; | 36 const int kShortIdlePeriodDurationSampleCount = 10; |
| 37 const double kShortIdlePeriodDurationPercentile = 50; | 37 const double kShortIdlePeriodDurationPercentile = 50; |
| 38 // Amount of idle time left in a frame (as a ratio of the vsync interval) above | 38 // Amount of idle time left in a frame (as a ratio of the vsync interval) above |
| 39 // which main thread compositing can be considered fast. | 39 // which main thread compositing can be considered fast. |
| 40 const double kFastCompositingIdleTimeThreshold = .2; | 40 const double kFastCompositingIdleTimeThreshold = .2; |
| 41 // We do not throttle anything while audio is played and shortly after that. | 41 // We do not throttle anything while audio is played and shortly after that. |
| 42 constexpr base::TimeDelta kThrottlingDelayAfterAudioIsPlayed = | 42 constexpr base::TimeDelta kThrottlingDelayAfterAudioIsPlayed = |
| 43 base::TimeDelta::FromSeconds(5); | 43 base::TimeDelta::FromSeconds(5); |
| 44 constexpr base::TimeDelta kThreadLoadTrackerReportingInterval = |
| 45 base::TimeDelta::FromMinutes(1); |
| 46 constexpr base::TimeDelta kThreadLoadTrackerWaitingPeriodBeforeReporting = |
| 47 base::TimeDelta::FromMinutes(2); |
| 44 | 48 |
| 45 void ReportForegroundRendererTaskLoad(base::TimeTicks time, double load) { | 49 void ReportForegroundRendererTaskLoad(base::TimeTicks time, double load) { |
| 46 int load_percentage = static_cast<int>(load * 100); | 50 int load_percentage = static_cast<int>(load * 100); |
| 47 UMA_HISTOGRAM_PERCENTAGE("RendererScheduler.ForegroundRendererMainThreadLoad", | 51 UMA_HISTOGRAM_PERCENTAGE("RendererScheduler.ForegroundRendererMainThreadLoad", |
| 48 load_percentage); | 52 load_percentage); |
| 49 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 53 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
| 50 "RendererScheduler.ForegroundRendererLoad", load_percentage); | 54 "RendererScheduler.ForegroundRendererLoad", load_percentage); |
| 51 } | 55 } |
| 52 | 56 |
| 53 void ReportBackgroundRendererTaskLoad(base::TimeTicks time, double load) { | 57 void ReportBackgroundRendererTaskLoad(base::TimeTicks time, double load) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 kTimerTaskEstimationSampleCount, | 154 kTimerTaskEstimationSampleCount, |
| 151 kTimerTaskEstimationPercentile), | 155 kTimerTaskEstimationPercentile), |
| 152 queueing_time_estimator(renderer_scheduler_impl, | 156 queueing_time_estimator(renderer_scheduler_impl, |
| 153 base::TimeDelta::FromSeconds(1)), | 157 base::TimeDelta::FromSeconds(1)), |
| 154 idle_time_estimator(compositor_task_runner, | 158 idle_time_estimator(compositor_task_runner, |
| 155 time_source, | 159 time_source, |
| 156 kShortIdlePeriodDurationSampleCount, | 160 kShortIdlePeriodDurationSampleCount, |
| 157 kShortIdlePeriodDurationPercentile), | 161 kShortIdlePeriodDurationPercentile), |
| 158 background_main_thread_load_tracker( | 162 background_main_thread_load_tracker( |
| 159 now, | 163 now, |
| 160 base::Bind(&ReportBackgroundRendererTaskLoad)), | 164 base::Bind(&ReportBackgroundRendererTaskLoad), |
| 165 kThreadLoadTrackerReportingInterval, |
| 166 kThreadLoadTrackerWaitingPeriodBeforeReporting), |
| 161 foreground_main_thread_load_tracker( | 167 foreground_main_thread_load_tracker( |
| 162 now, | 168 now, |
| 163 base::Bind(&ReportForegroundRendererTaskLoad)), | 169 base::Bind(&ReportForegroundRendererTaskLoad), |
| 170 kThreadLoadTrackerReportingInterval, |
| 171 kThreadLoadTrackerWaitingPeriodBeforeReporting), |
| 164 current_use_case(UseCase::NONE), | 172 current_use_case(UseCase::NONE), |
| 165 timer_queue_suspend_count(0), | 173 timer_queue_suspend_count(0), |
| 166 navigation_task_expected_count(0), | 174 navigation_task_expected_count(0), |
| 167 expensive_task_policy(ExpensiveTaskPolicy::RUN), | 175 expensive_task_policy(ExpensiveTaskPolicy::RUN), |
| 168 renderer_hidden(false), | 176 renderer_hidden(false), |
| 169 renderer_backgrounded(false), | 177 renderer_backgrounded(false), |
| 170 renderer_suspended(false), | 178 renderer_suspended(false), |
| 171 timer_queue_suspension_when_backgrounded_enabled(false), | 179 timer_queue_suspension_when_backgrounded_enabled(false), |
| 172 timer_queue_suspended_when_backgrounded(false), | 180 timer_queue_suspended_when_backgrounded(false), |
| 173 was_shutdown(false), | 181 was_shutdown(false), |
| (...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 case v8::PERFORMANCE_LOAD: | 1661 case v8::PERFORMANCE_LOAD: |
| 1654 return "load"; | 1662 return "load"; |
| 1655 default: | 1663 default: |
| 1656 NOTREACHED(); | 1664 NOTREACHED(); |
| 1657 return nullptr; | 1665 return nullptr; |
| 1658 } | 1666 } |
| 1659 } | 1667 } |
| 1660 | 1668 |
| 1661 } // namespace scheduler | 1669 } // namespace scheduler |
| 1662 } // namespace blink | 1670 } // namespace blink |
| OLD | NEW |