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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc

Issue 2890173002: EQT: Record the max queueing time from navigation start to navigation away (Closed)
Patch Set: add DEP Created 3 years, 7 months 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
OLDNEW
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 timer_tasks_seem_expensive(false), 210 timer_tasks_seem_expensive(false),
211 touchstart_expected_soon(false), 211 touchstart_expected_soon(false),
212 have_seen_a_begin_main_frame(false), 212 have_seen_a_begin_main_frame(false),
213 have_reported_blocking_intervention_in_current_policy(false), 213 have_reported_blocking_intervention_in_current_policy(false),
214 have_reported_blocking_intervention_since_navigation(false), 214 have_reported_blocking_intervention_since_navigation(false),
215 has_visible_render_widget_with_touch_handler(false), 215 has_visible_render_widget_with_touch_handler(false),
216 begin_frame_not_expected_soon(false), 216 begin_frame_not_expected_soon(false),
217 in_idle_period_for_testing(false), 217 in_idle_period_for_testing(false),
218 use_virtual_time(false), 218 use_virtual_time(false),
219 is_audio_playing(false), 219 is_audio_playing(false),
220 max_queuing_time_histogram(
221 base::SingleSampleMetricsFactory::Get()->CreateCustomCountsMetric(
222 "RendererScheduler.MaxQueueingTime",
tdresser 2017/05/18 20:42:26 This needs to line up with the name in histograms.
Liquan (Max) Gu 2017/05/19 22:24:26 Done.
223 1,
224 10000,
225 50)),
220 rail_mode_observer(nullptr), 226 rail_mode_observer(nullptr),
221 wake_up_budget_pool(nullptr), 227 wake_up_budget_pool(nullptr),
222 task_duration_per_queue_type_histogram(base::Histogram::FactoryGet( 228 task_duration_per_queue_type_histogram(base::Histogram::FactoryGet(
223 "RendererScheduler.TaskDurationPerQueueType", 229 "RendererScheduler.TaskDurationPerQueueType",
224 1, 230 1,
225 static_cast<int>(TaskQueue::QueueType::COUNT), 231 static_cast<int>(TaskQueue::QueueType::COUNT),
226 static_cast<int>(TaskQueue::QueueType::COUNT) + 1, 232 static_cast<int>(TaskQueue::QueueType::COUNT) + 1,
227 base::HistogramBase::kUmaTargetedHistogramFlag)) { 233 base::HistogramBase::kUmaTargetedHistogramFlag)) {
228 foreground_main_thread_load_tracker.Resume(now); 234 foreground_main_thread_load_tracker.Resume(now);
229 } 235 }
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 DCHECK(!GetMainThreadOnly().renderer_backgrounded || 1666 DCHECK(!GetMainThreadOnly().renderer_backgrounded ||
1661 (GetMainThreadOnly().renderer_backgrounded && 1667 (GetMainThreadOnly().renderer_backgrounded &&
1662 !GetMainThreadOnly().renderer_suspended)); 1668 !GetMainThreadOnly().renderer_suspended));
1663 if (!GetMainThreadOnly().timer_queue_suspended_when_backgrounded) 1669 if (!GetMainThreadOnly().timer_queue_suspended_when_backgrounded)
1664 return; 1670 return;
1665 1671
1666 GetMainThreadOnly().timer_queue_suspended_when_backgrounded = false; 1672 GetMainThreadOnly().timer_queue_suspended_when_backgrounded = false;
1667 ForceUpdatePolicy(); 1673 ForceUpdatePolicy();
1668 } 1674 }
1669 1675
1670 void RendererSchedulerImpl::ResetForNavigationLocked() { 1676 void RendererSchedulerImpl::ResetForNavigationLocked() {
tdresser 2017/05/18 20:42:26 We should flush the histogram in here.
Liquan (Max) Gu 2017/05/19 22:24:26 Done.
1671 helper_.CheckOnValidThread(); 1677 helper_.CheckOnValidThread();
1672 any_thread_lock_.AssertAcquired(); 1678 any_thread_lock_.AssertAcquired();
1673 GetAnyThread().user_model.Reset(helper_.scheduler_tqm_delegate()->NowTicks()); 1679 GetAnyThread().user_model.Reset(helper_.scheduler_tqm_delegate()->NowTicks());
1674 GetAnyThread().have_seen_a_potentially_blocking_gesture = false; 1680 GetAnyThread().have_seen_a_potentially_blocking_gesture = false;
1675 GetAnyThread().waiting_for_meaningful_paint = true; 1681 GetAnyThread().waiting_for_meaningful_paint = true;
1676 GetAnyThread().have_seen_input_since_navigation = false; 1682 GetAnyThread().have_seen_input_since_navigation = false;
1677 GetMainThreadOnly().loading_task_cost_estimator.Clear(); 1683 GetMainThreadOnly().loading_task_cost_estimator.Clear();
1678 GetMainThreadOnly().timer_task_cost_estimator.Clear(); 1684 GetMainThreadOnly().timer_task_cost_estimator.Clear();
1679 GetMainThreadOnly().idle_time_estimator.Clear(); 1685 GetMainThreadOnly().idle_time_estimator.Clear();
1680 GetMainThreadOnly().have_seen_a_begin_main_frame = false; 1686 GetMainThreadOnly().have_seen_a_begin_main_frame = false;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 } 1903 }
1898 1904
1899 void RendererSchedulerImpl::RemoveTaskTimeObserver( 1905 void RendererSchedulerImpl::RemoveTaskTimeObserver(
1900 TaskTimeObserver* task_time_observer) { 1906 TaskTimeObserver* task_time_observer) {
1901 helper_.RemoveTaskTimeObserver(task_time_observer); 1907 helper_.RemoveTaskTimeObserver(task_time_observer);
1902 } 1908 }
1903 1909
1904 void RendererSchedulerImpl::OnQueueingTimeForWindowEstimated( 1910 void RendererSchedulerImpl::OnQueueingTimeForWindowEstimated(
1905 base::TimeDelta queueing_time, 1911 base::TimeDelta queueing_time,
1906 base::TimeTicks window_start_time) { 1912 base::TimeTicks window_start_time) {
1913 GetMainThreadOnly().max_queuing_time_histogram->SetSample(
1914 queueing_time.ToInternalValue());
tdresser 2017/05/18 20:42:26 We should be using InMilliseconds(), I think.
Liquan (Max) Gu 2017/05/19 22:24:26 Done.
1907 // RendererScheduler reports the queueing time once per window's duration. 1915 // RendererScheduler reports the queueing time once per window's duration.
1908 // |stepEQT|stepEQT|stepEQT|stepEQT|stepEQT|stepEQT| 1916 // |stepEQT|stepEQT|stepEQT|stepEQT|stepEQT|stepEQT|
1909 // Report: |-------window EQT------| 1917 // Report: |-------window EQT------|
1910 // Discard: |-------window EQT------| 1918 // Discard: |-------window EQT------|
1911 // Discard: |-------window EQT------| 1919 // Discard: |-------window EQT------|
1912 // Report: |-------window EQT------| 1920 // Report: |-------window EQT------|
1913 if (window_start_time - 1921 if (window_start_time -
1914 GetMainThreadOnly().uma_last_queueing_time_report_window_start_time < 1922 GetMainThreadOnly().uma_last_queueing_time_report_window_start_time <
1915 kQueueingTimeWindowDuration) { 1923 kQueueingTimeWindowDuration) {
1916 return; 1924 return;
1917 } 1925 }
1918 UMA_HISTOGRAM_TIMES("RendererScheduler.ExpectedTaskQueueingDuration", 1926 UMA_HISTOGRAM_TIMES("RendererScheduler.ExpectedTaskQueueingDuration",
1919 queueing_time); 1927 queueing_time);
1920 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), 1928 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"),
1921 "estimated_queueing_time_for_window", 1929 "estimated_queueing_time_for_window",
1922 queueing_time.InMillisecondsF()); 1930 queueing_time.InMillisecondsF());
1931
tdresser 2017/05/18 20:42:26 Try to avoid introducing unrelated whitespace chan
Liquan (Max) Gu 2017/05/19 22:24:26 Done.
1923 GetMainThreadOnly().uma_last_queueing_time_report_window_start_time = 1932 GetMainThreadOnly().uma_last_queueing_time_report_window_start_time =
1924 window_start_time; 1933 window_start_time;
1925 } 1934 }
1926 1935
1927 AutoAdvancingVirtualTimeDomain* RendererSchedulerImpl::GetVirtualTimeDomain() { 1936 AutoAdvancingVirtualTimeDomain* RendererSchedulerImpl::GetVirtualTimeDomain() {
1928 if (!virtual_time_domain_) { 1937 if (!virtual_time_domain_) {
1929 virtual_time_domain_.reset( 1938 virtual_time_domain_.reset(
1930 new AutoAdvancingVirtualTimeDomain(tick_clock()->NowTicks())); 1939 new AutoAdvancingVirtualTimeDomain(tick_clock()->NowTicks()));
1931 RegisterTimeDomain(virtual_time_domain_.get()); 1940 RegisterTimeDomain(virtual_time_domain_.get());
1932 } 1941 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2054 case TimeDomainType::VIRTUAL: 2063 case TimeDomainType::VIRTUAL:
2055 return "virtual"; 2064 return "virtual";
2056 default: 2065 default:
2057 NOTREACHED(); 2066 NOTREACHED();
2058 return nullptr; 2067 return nullptr;
2059 } 2068 }
2060 } 2069 }
2061 2070
2062 } // namespace scheduler 2071 } // namespace scheduler
2063 } // namespace blink 2072 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698