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/events/latency_info.h" | 5 #include "ui/events/latency_info.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 trace_name = std::string("Latency::") + trace_name_str; | 296 trace_name = std::string("Latency::") + trace_name_str; |
297 } | 297 } |
298 | 298 |
299 TRACE_EVENT_COPY_ASYNC_BEGIN_WITH_TIMESTAMP0( | 299 TRACE_EVENT_COPY_ASYNC_BEGIN_WITH_TIMESTAMP0( |
300 "benchmark,latencyInfo", | 300 "benchmark,latencyInfo", |
301 trace_name.c_str(), | 301 trace_name.c_str(), |
302 TRACE_ID_DONT_MANGLE(trace_id), | 302 TRACE_ID_DONT_MANGLE(trace_id), |
303 ts); | 303 ts); |
304 } | 304 } |
305 | 305 |
| 306 TRACE_EVENT_WITH_FLOW0("toplevel", "LatencyInfo::AddLatencyNumberWithTimesta
mpImpl", |
| 307 TRACE_ID_DONT_MANGLE(trace_id), |
| 308 TRACE_EVENT_FLAG_FLOW_OUT); |
306 TRACE_EVENT_FLOW_BEGIN1( | 309 TRACE_EVENT_FLOW_BEGIN1( |
307 "input,benchmark", "LatencyInfo.Flow", TRACE_ID_DONT_MANGLE(trace_id), | 310 "input,benchmark", "LatencyInfo.Flow", TRACE_ID_DONT_MANGLE(trace_id), |
308 "trace_id", trace_id); | 311 "trace_id", trace_id); |
309 } | 312 } |
310 | 313 |
311 LatencyMap::key_type key = std::make_pair(component, id); | 314 LatencyMap::key_type key = std::make_pair(component, id); |
312 LatencyMap::iterator it = latency_components.find(key); | 315 LatencyMap::iterator it = latency_components.find(key); |
313 if (it == latency_components.end()) { | 316 if (it == latency_components.end()) { |
314 LatencyComponent info = {component_sequence_number, time, event_count}; | 317 LatencyComponent info = {component_sequence_number, time, event_count}; |
315 latency_components[key] = info; | 318 latency_components[key] = info; |
(...skipping 16 matching lines...) Expand all Loading... |
332 CHECK(!terminated); | 335 CHECK(!terminated); |
333 terminated = true; | 336 terminated = true; |
334 | 337 |
335 if (*benchmark_enabled) { | 338 if (*benchmark_enabled) { |
336 TRACE_EVENT_COPY_ASYNC_END1("benchmark,latencyInfo", | 339 TRACE_EVENT_COPY_ASYNC_END1("benchmark,latencyInfo", |
337 trace_name.c_str(), | 340 trace_name.c_str(), |
338 TRACE_ID_DONT_MANGLE(trace_id), | 341 TRACE_ID_DONT_MANGLE(trace_id), |
339 "data", AsTraceableData(*this)); | 342 "data", AsTraceableData(*this)); |
340 } | 343 } |
341 | 344 |
| 345 TRACE_EVENT_WITH_FLOW0("toplevel", "LatencyInfo::AddLatencyNumberWithTimesta
mpImpl", |
| 346 TRACE_ID_DONT_MANGLE(trace_id), |
| 347 TRACE_EVENT_FLAG_FLOW_IN); |
342 TRACE_EVENT_FLOW_END_BIND_TO_ENCLOSING0( | 348 TRACE_EVENT_FLOW_END_BIND_TO_ENCLOSING0( |
343 "input,benchmark", "LatencyInfo.Flow", TRACE_ID_DONT_MANGLE(trace_id)); | 349 "input,benchmark", "LatencyInfo.Flow", TRACE_ID_DONT_MANGLE(trace_id)); |
344 } | 350 } |
345 } | 351 } |
346 | 352 |
347 bool LatencyInfo::FindLatency(LatencyComponentType type, | 353 bool LatencyInfo::FindLatency(LatencyComponentType type, |
348 int64 id, | 354 int64 id, |
349 LatencyComponent* output) const { | 355 LatencyComponent* output) const { |
350 LatencyMap::const_iterator it = latency_components.find( | 356 LatencyMap::const_iterator it = latency_components.find( |
351 std::make_pair(type, id)); | 357 std::make_pair(type, id)); |
(...skipping 15 matching lines...) Expand all Loading... |
367 it++; | 373 it++; |
368 } | 374 } |
369 } | 375 } |
370 } | 376 } |
371 | 377 |
372 void LatencyInfo::Clear() { | 378 void LatencyInfo::Clear() { |
373 latency_components.clear(); | 379 latency_components.clear(); |
374 } | 380 } |
375 | 381 |
376 } // namespace ui | 382 } // namespace ui |
OLD | NEW |