| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 ts = base::TimeTicks::NowFromSystemTraceTime().ToInternalValue(); | 245 ts = base::TimeTicks::NowFromSystemTraceTime().ToInternalValue(); |
| 246 } | 246 } |
| 247 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0( | 247 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0( |
| 248 "benchmark", | 248 "benchmark", |
| 249 "InputLatency", | 249 "InputLatency", |
| 250 TRACE_ID_DONT_MANGLE(trace_id), | 250 TRACE_ID_DONT_MANGLE(trace_id), |
| 251 ts); | 251 ts); |
| 252 } | 252 } |
| 253 | 253 |
| 254 TRACE_EVENT_FLOW_BEGIN0( | 254 TRACE_EVENT_FLOW_BEGIN0( |
| 255 "input,benchmark", "LatencyInfo.Flow", TRACE_ID_DONT_MANGLE(trace_id)); | 255 "input", "LatencyInfo.Flow", TRACE_ID_DONT_MANGLE(trace_id)); |
| 256 } | 256 } |
| 257 | 257 |
| 258 LatencyMap::key_type key = std::make_pair(component, id); | 258 LatencyMap::key_type key = std::make_pair(component, id); |
| 259 LatencyMap::iterator it = latency_components.find(key); | 259 LatencyMap::iterator it = latency_components.find(key); |
| 260 if (it == latency_components.end()) { | 260 if (it == latency_components.end()) { |
| 261 LatencyComponent info = {component_sequence_number, time, event_count}; | 261 LatencyComponent info = {component_sequence_number, time, event_count}; |
| 262 latency_components[key] = info; | 262 latency_components[key] = info; |
| 263 } else { | 263 } else { |
| 264 it->second.sequence_number = std::max(component_sequence_number, | 264 it->second.sequence_number = std::max(component_sequence_number, |
| 265 it->second.sequence_number); | 265 it->second.sequence_number); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 280 terminated = true; | 280 terminated = true; |
| 281 | 281 |
| 282 if (*benchmark_enabled) { | 282 if (*benchmark_enabled) { |
| 283 TRACE_EVENT_ASYNC_END1("benchmark", | 283 TRACE_EVENT_ASYNC_END1("benchmark", |
| 284 "InputLatency", | 284 "InputLatency", |
| 285 TRACE_ID_DONT_MANGLE(trace_id), | 285 TRACE_ID_DONT_MANGLE(trace_id), |
| 286 "data", AsTraceableData(*this)); | 286 "data", AsTraceableData(*this)); |
| 287 } | 287 } |
| 288 | 288 |
| 289 TRACE_EVENT_FLOW_END0( | 289 TRACE_EVENT_FLOW_END0( |
| 290 "input,benchmark", "LatencyInfo.Flow", TRACE_ID_DONT_MANGLE(trace_id)); | 290 "input", "LatencyInfo.Flow", TRACE_ID_DONT_MANGLE(trace_id)); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 bool LatencyInfo::FindLatency(LatencyComponentType type, | 294 bool LatencyInfo::FindLatency(LatencyComponentType type, |
| 295 int64 id, | 295 int64 id, |
| 296 LatencyComponent* output) const { | 296 LatencyComponent* output) const { |
| 297 LatencyMap::const_iterator it = latency_components.find( | 297 LatencyMap::const_iterator it = latency_components.find( |
| 298 std::make_pair(type, id)); | 298 std::make_pair(type, id)); |
| 299 if (it == latency_components.end()) | 299 if (it == latency_components.end()) |
| 300 return false; | 300 return false; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 321 } | 321 } |
| 322 | 322 |
| 323 void LatencyInfo::TraceEventType(const char* event_type) { | 323 void LatencyInfo::TraceEventType(const char* event_type) { |
| 324 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark", | 324 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark", |
| 325 "InputLatency", | 325 "InputLatency", |
| 326 TRACE_ID_DONT_MANGLE(trace_id), | 326 TRACE_ID_DONT_MANGLE(trace_id), |
| 327 event_type); | 327 event_type); |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace ui | 330 } // namespace ui |
| OLD | NEW |