OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/frame_rate_counter.h" | 5 #include "cc/debug/frame_rate_counter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.CompositorThreadImplDrawDelay", | 66 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.CompositorThreadImplDrawDelay", |
67 frame_interval_seconds.InMilliseconds(), | 67 frame_interval_seconds.InMilliseconds(), |
68 1, | 68 1, |
69 120, | 69 120, |
70 60); | 70 60); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 if (!IsBadFrameInterval(frame_interval_seconds) && | 74 if (!IsBadFrameInterval(frame_interval_seconds) && |
75 frame_interval_seconds.InSecondsF() > kDroppedFrameTime) | 75 frame_interval_seconds.InSecondsF() > kDroppedFrameTime) |
76 ++dropped_frame_count_; | 76 dropped_frame_count_ += |
| 77 frame_interval_seconds.InSecondsF() / kDroppedFrameTime; |
77 } | 78 } |
78 | 79 |
79 bool FrameRateCounter::IsBadFrameInterval( | 80 bool FrameRateCounter::IsBadFrameInterval( |
80 base::TimeDelta interval_between_consecutive_frames) const { | 81 base::TimeDelta interval_between_consecutive_frames) const { |
81 double delta = interval_between_consecutive_frames.InSecondsF(); | 82 double delta = interval_between_consecutive_frames.InSecondsF(); |
82 bool scheduler_allows_double_frames = !has_impl_thread_; | 83 bool scheduler_allows_double_frames = !has_impl_thread_; |
83 bool interval_too_fast = | 84 bool interval_too_fast = |
84 scheduler_allows_double_frames ? delta < kFrameTooFast : delta <= 0.0; | 85 scheduler_allows_double_frames ? delta < kFrameTooFast : delta <= 0.0; |
85 bool interval_too_slow = delta > kFrameTooSlow; | 86 bool interval_too_slow = delta > kFrameTooSlow; |
86 return interval_too_fast || interval_too_slow; | 87 return interval_too_fast || interval_too_slow; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 139 |
139 if (frame_count) { | 140 if (frame_count) { |
140 DCHECK_GT(frame_times_total, 0.0); | 141 DCHECK_GT(frame_times_total, 0.0); |
141 average_fps = frame_count / frame_times_total; | 142 average_fps = frame_count / frame_times_total; |
142 } | 143 } |
143 | 144 |
144 return average_fps; | 145 return average_fps; |
145 } | 146 } |
146 | 147 |
147 } // namespace cc | 148 } // namespace cc |
OLD | NEW |