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

Side by Side Diff: Source/core/dom/ScriptedIdleTaskController.cpp

Issue 1344053002: Add UMA tracing to requestIdleCallback. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix overrun UMA name Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "config.h" 5 #include "config.h"
6 #include "core/dom/ScriptedIdleTaskController.h" 6 #include "core/dom/ScriptedIdleTaskController.h"
7 7
8 #include "core/dom/ExecutionContext.h" 8 #include "core/dom/ExecutionContext.h"
9 #include "core/dom/IdleRequestCallback.h" 9 #include "core/dom/IdleRequestCallback.h"
10 #include "platform/Logging.h" 10 #include "platform/Logging.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 runCallback(id, deadlineSeconds, callbackType); 112 runCallback(id, deadlineSeconds, callbackType);
113 } 113 }
114 114
115 void ScriptedIdleTaskController::runCallback(CallbackId id, double deadlineSecon ds, IdleDeadline::CallbackType callbackType) 115 void ScriptedIdleTaskController::runCallback(CallbackId id, double deadlineSecon ds, IdleDeadline::CallbackType callbackType)
116 { 116 {
117 ASSERT(!m_suspended); 117 ASSERT(!m_suspended);
118 auto callback = m_callbacks.take(id); 118 auto callback = m_callbacks.take(id);
119 if (!callback) 119 if (!callback)
120 return; 120 return;
121 121
122 double allotedTimeMillis = std::max((deadlineSeconds - monotonicallyIncreasi ngTime()) * 1000, 0.0);
123 Platform::current()->histogramCustomCounts("WebCore.ScriptedIdleTaskControll er.IdleCallbackDeadline", allotedTimeMillis, 0, 50, 50);
124
122 // TODO(rmcilroy): Add devtools tracing. 125 // TODO(rmcilroy): Add devtools tracing.
123 callback->handleEvent(IdleDeadline::create(deadlineSeconds, callbackType)); 126 callback->handleEvent(IdleDeadline::create(deadlineSeconds, callbackType));
127
128 double overrunMillis = std::max((monotonicallyIncreasingTime() - deadlineSec onds) * 1000, 0.0);
129 Platform::current()->histogramCustomCounts("WebCore.ScriptedIdleTaskControll er.IdleCallbackOverrun", overrunMillis, 0, 10000, 50);
124 } 130 }
125 131
126 void ScriptedIdleTaskController::stop() 132 void ScriptedIdleTaskController::stop()
127 { 133 {
128 m_callbacks.clear(); 134 m_callbacks.clear();
129 } 135 }
130 136
131 void ScriptedIdleTaskController::suspend() 137 void ScriptedIdleTaskController::suspend()
132 { 138 {
133 m_suspended = true; 139 m_suspended = true;
(...skipping 16 matching lines...) Expand all
150 m_scheduler->postIdleTask(FROM_HERE, WTF::bind<double>(&internal::IdleRe questCallbackWrapper::idleTaskFired, callbackWrapper)); 156 m_scheduler->postIdleTask(FROM_HERE, WTF::bind<double>(&internal::IdleRe questCallbackWrapper::idleTaskFired, callbackWrapper));
151 } 157 }
152 } 158 }
153 159
154 bool ScriptedIdleTaskController::hasPendingActivity() const 160 bool ScriptedIdleTaskController::hasPendingActivity() const
155 { 161 {
156 return !m_callbacks.isEmpty(); 162 return !m_callbacks.isEmpty();
157 } 163 }
158 164
159 } // namespace blink 165 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698