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 "cc/debug/lap_timer.h" | 5 #include "cc/debug/lap_timer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 base::TimeTicks Now() { | 13 base::TimeTicks Now() { |
14 return base::TimeTicks::IsThreadNowSupported() | 14 return base::TimeTicks::IsThreadNowSupported() ? base::TimeTicks::ThreadNow() |
15 ? base::TimeTicks::ThreadNow() | 15 : base::TimeTicks::Now(); |
16 : base::TimeTicks::HighResNow(); | |
17 } | 16 } |
18 | 17 |
19 } // namespace | 18 } // namespace |
20 | 19 |
21 LapTimer::LapTimer(int warmup_laps, | 20 LapTimer::LapTimer(int warmup_laps, |
22 base::TimeDelta time_limit, | 21 base::TimeDelta time_limit, |
23 int check_interval) | 22 int check_interval) |
24 : warmup_laps_(warmup_laps), | 23 : warmup_laps_(warmup_laps), |
25 remaining_warmups_(0), | 24 remaining_warmups_(0), |
26 remaining_no_check_laps_(0), | 25 remaining_no_check_laps_(0), |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 71 } |
73 | 72 |
74 float LapTimer::LapsPerSecond() { | 73 float LapTimer::LapsPerSecond() { |
75 DCHECK(HasTimedAllLaps()); | 74 DCHECK(HasTimedAllLaps()); |
76 return num_laps_ / accumulator_.InSecondsF(); | 75 return num_laps_ / accumulator_.InSecondsF(); |
77 } | 76 } |
78 | 77 |
79 int LapTimer::NumLaps() { return num_laps_; } | 78 int LapTimer::NumLaps() { return num_laps_; } |
80 | 79 |
81 } // namespace cc | 80 } // namespace cc |
OLD | NEW |