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

Side by Side Diff: components/scheduler/renderer/coarse_duration_timer.cc

Issue 1898233002: Report expected task queueing time via UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Super rough alternative approach. Created 4 years, 6 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/scheduler/renderer/coarse_duration_timer.h"
6
7 #include "base/message_loop/message_loop.h"
8
9 namespace scheduler {
10
11 void CoarseDurationTimer::OnUpdateRecentTime(base::TimeTicks recent_time) {
12 most_recent_time_ = recent_time;
13 if (state_ == State::WITHIN_INTERVAL_NEEDS_START) {
14 start_time_ = recent_time;
15 state_ = State::WITHIN_INTERVAL;
16 }
17 }
18
19 void CoarseDurationTimer::BeginInterval() {
20 // DCHECK(state_ == State::OUTSIDE_INTERVAL);
21 state_ = State::WITHIN_INTERVAL_NEEDS_START;
22 }
23
24 base::TimeDelta CoarseDurationTimer::EndInterval() {
25 base::TimeDelta duration;
26 // DCHECK(state_ != State::OUTSIDE_INTERVAL);
27
28 // If we haven't received a single time update within this interval, report
29 // a duration of 0.
30 if (state_ != State::WITHIN_INTERVAL_NEEDS_START)
31 duration = most_recent_time_ - start_time_;
32 state_ = State::OUTSIDE_INTERVAL;
33
34 if (!duration.is_zero())
35 LOG(ERROR) << "DURATION IS " << duration.InMillisecondsF();
36 return duration;
37 }
38
39 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698