OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/latency_info.h" | 5 #include "cc/debug/latency_info.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 } else { | 41 } else { |
42 f->second.sequence_number = std::max(component_sequence_number, | 42 f->second.sequence_number = std::max(component_sequence_number, |
43 f->second.sequence_number); | 43 f->second.sequence_number); |
44 uint32 new_count = event_count + f->second.event_count; | 44 uint32 new_count = event_count + f->second.event_count; |
45 if (event_count > 0 && new_count != 0) { | 45 if (event_count > 0 && new_count != 0) { |
46 // Do a weighted average, so that the new event_time is the average of | 46 // Do a weighted average, so that the new event_time is the average of |
47 // the times of events currently in this structure with the time passed | 47 // the times of events currently in this structure with the time passed |
48 // into this method. | 48 // into this method. |
49 f->second.event_time += (time - f->second.event_time) * event_count / | 49 f->second.event_time += (time - f->second.event_time) * event_count / |
50 new_count; | 50 new_count; |
51 f->second.event_count += new_count; | 51 f->second.event_count = new_count; |
52 } | 52 } |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 void LatencyInfo::Clear() { | 56 void LatencyInfo::Clear() { |
57 latency_components.clear(); | 57 latency_components.clear(); |
58 } | 58 } |
59 | 59 |
60 } // namespace cc | 60 } // namespace cc |
61 | 61 |
OLD | NEW |