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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 for (ui::LatencyInfo::LatencyMap::const_iterator it = | 110 for (ui::LatencyInfo::LatencyMap::const_iterator it = |
111 latency.latency_components.begin(); | 111 latency.latency_components.begin(); |
112 it != latency.latency_components.end(); ++it) { | 112 it != latency.latency_components.end(); ++it) { |
113 base::DictionaryValue* component_info = new base::DictionaryValue(); | 113 base::DictionaryValue* component_info = new base::DictionaryValue(); |
114 component_info->SetDouble("comp_id", it->first.second); | 114 component_info->SetDouble("comp_id", it->first.second); |
115 component_info->SetDouble("time", it->second.event_time.ToInternalValue()); | 115 component_info->SetDouble("time", it->second.event_time.ToInternalValue()); |
116 component_info->SetDouble("count", it->second.event_count); | 116 component_info->SetDouble("count", it->second.event_count); |
117 record_data->Set(GetComponentName(it->first.first), component_info); | 117 record_data->Set(GetComponentName(it->first.first), component_info); |
118 } | 118 } |
119 record_data->SetDouble("trace_id", latency.trace_id); | 119 record_data->SetDouble("trace_id", latency.trace_id); |
120 | |
121 scoped_ptr<base::ListValue> values(new base::ListValue()); | |
Sami
2014/09/04 19:10:43
|coordinates|
cvicentiu
2014/09/05 17:19:56
Done.
| |
122 printf("Adding coordinates;\n"); | |
123 for (size_t i = 0; i < latency.coordinates.size(); i++) { | |
124 printf("x = %d, y = %d\n", latency.coordinates[i].first, latency.coordinates[ i].second); | |
125 base::DictionaryValue* coordinatePair = new base::DictionaryValue(); | |
Sami
2014/09/04 19:10:43
scoped_ptr<base::DictionaryValue> coordinate_pair(
Sami
2014/09/04 19:10:43
indent++
cvicentiu
2014/09/05 17:19:56
Done.
| |
126 coordinatePair->SetDouble("x", latency.coordinates[i].first); | |
127 coordinatePair->SetDouble("y", latency.coordinates[i].second); | |
128 values->Append(coordinatePair); | |
129 } | |
130 record_data->Set("coordinates", values.release()); | |
131 printf("Added coordinates"); | |
120 return LatencyInfoTracedValue::FromValue(record_data.PassAs<base::Value>()); | 132 return LatencyInfoTracedValue::FromValue(record_data.PassAs<base::Value>()); |
121 } | 133 } |
122 | 134 |
123 } // namespace | 135 } // namespace |
124 | 136 |
125 namespace ui { | 137 namespace ui { |
126 | 138 |
127 LatencyInfo::LatencyInfo() : trace_id(-1), terminated(false) { | 139 LatencyInfo::LatencyInfo() : trace_id(-1), terminated(false) { |
128 } | 140 } |
129 | 141 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 } | 305 } |
294 | 306 |
295 void LatencyInfo::TraceEventType(const char* event_type) { | 307 void LatencyInfo::TraceEventType(const char* event_type) { |
296 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark", | 308 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark", |
297 "InputLatency", | 309 "InputLatency", |
298 TRACE_ID_DONT_MANGLE(trace_id), | 310 TRACE_ID_DONT_MANGLE(trace_id), |
299 event_type); | 311 event_type); |
300 } | 312 } |
301 | 313 |
302 } // namespace ui | 314 } // namespace ui |
OLD | NEW |