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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl.cc

Issue 2781663003: Fix WorkerThread.Runtime UMA (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/child/worker_scheduler_impl.h" 5 #include "platform/scheduler/child/worker_scheduler_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 void WorkerSchedulerImpl::RemoveTaskObserver( 75 void WorkerSchedulerImpl::RemoveTaskObserver(
76 base::MessageLoop::TaskObserver* task_observer) { 76 base::MessageLoop::TaskObserver* task_observer) {
77 DCHECK(initialized_); 77 DCHECK(initialized_);
78 helper_.RemoveTaskObserver(task_observer); 78 helper_.RemoveTaskObserver(task_observer);
79 } 79 }
80 80
81 void WorkerSchedulerImpl::Shutdown() { 81 void WorkerSchedulerImpl::Shutdown() {
82 DCHECK(initialized_); 82 DCHECK(initialized_);
83 base::TimeTicks end_time = helper_.scheduler_tqm_delegate()->NowTicks(); 83 base::TimeTicks end_time = helper_.scheduler_tqm_delegate()->NowTicks();
84 base::TimeDelta delta = thread_start_time_ - end_time; 84 base::TimeDelta delta = end_time - thread_start_time_;
85 85
86 // The lifetime could be radically different for different workers, 86 // The lifetime could be radically different for different workers,
87 // some workers could be short-lived (but last at least 1 sec in 87 // some workers could be short-lived (but last at least 1 sec in
88 // Service Workers case) or could be around as long as the tab is open. 88 // Service Workers case) or could be around as long as the tab is open.
89 UMA_HISTOGRAM_CUSTOM_TIMES( 89 UMA_HISTOGRAM_CUSTOM_TIMES(
90 "WorkerThread.Runtime", delta, base::TimeDelta::FromSeconds(1), 90 "WorkerThread.Runtime", delta, base::TimeDelta::FromSeconds(1),
91 base::TimeDelta::FromDays(1), 50 /* bucket count */); 91 base::TimeDelta::FromDays(1), 50 /* bucket count */);
92 helper_.Shutdown(); 92 helper_.Shutdown();
93 } 93 }
94 94
95 SchedulerHelper* WorkerSchedulerImpl::GetSchedulerHelperForTesting() { 95 SchedulerHelper* WorkerSchedulerImpl::GetSchedulerHelperForTesting() {
96 return &helper_; 96 return &helper_;
97 } 97 }
98 98
99 bool WorkerSchedulerImpl::CanEnterLongIdlePeriod(base::TimeTicks, 99 bool WorkerSchedulerImpl::CanEnterLongIdlePeriod(base::TimeTicks,
100 base::TimeDelta*) { 100 base::TimeDelta*) {
101 return true; 101 return true;
102 } 102 }
103 103
104 base::TimeTicks WorkerSchedulerImpl::CurrentIdleTaskDeadlineForTesting() const { 104 base::TimeTicks WorkerSchedulerImpl::CurrentIdleTaskDeadlineForTesting() const {
105 return idle_helper_.CurrentIdleTaskDeadline(); 105 return idle_helper_.CurrentIdleTaskDeadline();
106 } 106 }
107 107
108 } // namespace scheduler 108 } // namespace scheduler
109 } // namespace blink 109 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698