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 "base/debug/trace_event.h" | 5 #include "base/debug/trace_event.h" |
6 #include "base/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "ui/events/latency_info.h" | 9 #include "ui/events/latency_info.h" |
10 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 | 148 |
149 void LatencyInfo::AddLatencyNumberWithTimestamp(LatencyComponentType component, | 149 void LatencyInfo::AddLatencyNumberWithTimestamp(LatencyComponentType component, |
150 int64 id, | 150 int64 id, |
151 int64 component_sequence_number, | 151 int64 component_sequence_number, |
152 base::TimeTicks time, | 152 base::TimeTicks time, |
153 uint32 event_count, | 153 uint32 event_count, |
154 bool dump_to_trace) { | 154 bool dump_to_trace) { |
155 if (dump_to_trace && IsBeginComponent(component)) { | 155 if (dump_to_trace && IsBeginComponent(component)) { |
156 // Should only ever add begin component once. | 156 // Should only ever add begin component once. |
157 CHECK_EQ(-1, trace_id); | 157 // Put the CHECK back once crbug.com/321116 is resolved. |
| 158 // CHECK_EQ(-1, trace_id); |
158 trace_id = component_sequence_number; | 159 trace_id = component_sequence_number; |
159 TRACE_EVENT_ASYNC_BEGIN0("benchmark", | 160 TRACE_EVENT_ASYNC_BEGIN0("benchmark", |
160 "InputLatency", | 161 "InputLatency", |
161 TRACE_ID_DONT_MANGLE(trace_id)); | 162 TRACE_ID_DONT_MANGLE(trace_id)); |
162 } | 163 } |
163 | 164 |
164 LatencyMap::key_type key = std::make_pair(component, id); | 165 LatencyMap::key_type key = std::make_pair(component, id); |
165 LatencyMap::iterator it = latency_components.find(key); | 166 LatencyMap::iterator it = latency_components.find(key); |
166 if (it == latency_components.end()) { | 167 if (it == latency_components.end()) { |
167 LatencyComponent info = {component_sequence_number, time, event_count}; | 168 LatencyComponent info = {component_sequence_number, time, event_count}; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if (output) | 202 if (output) |
202 *output = it->second; | 203 *output = it->second; |
203 return true; | 204 return true; |
204 } | 205 } |
205 | 206 |
206 void LatencyInfo::Clear() { | 207 void LatencyInfo::Clear() { |
207 latency_components.clear(); | 208 latency_components.clear(); |
208 } | 209 } |
209 | 210 |
210 } // namespace ui | 211 } // namespace ui |
OLD | NEW |