| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ui/base/latency_info.h" | 5 #include "ui/base/latency_info.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 | 10 |
| 11 LatencyInfo::LatencyInfo() { | 11 LatencyInfo::LatencyInfo() { |
| 12 } | 12 } |
| 13 | 13 |
| 14 LatencyInfo::~LatencyInfo() { | 14 LatencyInfo::~LatencyInfo() { |
| 15 } | 15 } |
| 16 | 16 |
| 17 void LatencyInfo::MergeWith(const LatencyInfo& other) { | 17 void LatencyInfo::MergeWith(const LatencyInfo& other) { |
| 18 for (LatencyMap::const_iterator it = other.latency_components.begin(); | 18 for (LatencyMap::const_iterator it = other.latency_components.begin(); |
| 19 it != other.latency_components.end(); | 19 it != other.latency_components.end(); |
| 20 ++it) { | 20 ++it) { |
| 21 AddLatencyNumberWithTimestamp(it->first.first, | 21 AddLatencyNumberWithTimestamp(it->first.first, |
| 22 it->first.second, | 22 it->first.second, |
| 23 it->second.sequence_number, | 23 it->second.sequence_number, |
| 24 it->second.event_time, | 24 it->second.event_time, |
| 25 it->second.event_count); | 25 it->second.event_count); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 | 28 |
| 29 void LatencyInfo::AddNewLatencyFrom(const LatencyInfo& other) { |
| 30 for (LatencyMap::const_iterator it = other.latency_components.begin(); |
| 31 it != other.latency_components.end(); |
| 32 ++it) { |
| 33 if (!FindLatency(it->first.first, it->first.second, NULL)) { |
| 34 AddLatencyNumberWithTimestamp(it->first.first, |
| 35 it->first.second, |
| 36 it->second.sequence_number, |
| 37 it->second.event_time, |
| 38 it->second.event_count); |
| 39 } |
| 40 } |
| 41 } |
| 42 |
| 29 void LatencyInfo::AddLatencyNumber(LatencyComponentType component, | 43 void LatencyInfo::AddLatencyNumber(LatencyComponentType component, |
| 30 int64 id, | 44 int64 id, |
| 31 int64 component_sequence_number) { | 45 int64 component_sequence_number) { |
| 32 AddLatencyNumberWithTimestamp(component, id, component_sequence_number, | 46 AddLatencyNumberWithTimestamp(component, id, component_sequence_number, |
| 33 base::TimeTicks::HighResNow(), 1); | 47 base::TimeTicks::HighResNow(), 1); |
| 34 } | 48 } |
| 35 | 49 |
| 36 void LatencyInfo::AddLatencyNumberWithTimestamp(LatencyComponentType component, | 50 void LatencyInfo::AddLatencyNumberWithTimestamp(LatencyComponentType component, |
| 37 int64 id, | 51 int64 id, |
| 38 int64 component_sequence_number, | 52 int64 component_sequence_number, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 68 if (output) | 82 if (output) |
| 69 *output = it->second; | 83 *output = it->second; |
| 70 return true; | 84 return true; |
| 71 } | 85 } |
| 72 | 86 |
| 73 void LatencyInfo::Clear() { | 87 void LatencyInfo::Clear() { |
| 74 latency_components.clear(); | 88 latency_components.clear(); |
| 75 } | 89 } |
| 76 | 90 |
| 77 } // namespace ui | 91 } // namespace ui |
| OLD | NEW |