OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_impl.h" | 5 #include "base/debug/trace_event_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 *out += arg_names_[i]; | 401 *out += arg_names_[i]; |
402 *out += "\":"; | 402 *out += "\":"; |
403 AppendValueAsJSON(arg_types_[i], arg_values_[i], out); | 403 AppendValueAsJSON(arg_types_[i], arg_values_[i], out); |
404 } | 404 } |
405 *out += "}"; | 405 *out += "}"; |
406 | 406 |
407 // If id_ is set, print it out as a hex string so we don't loose any | 407 // If id_ is set, print it out as a hex string so we don't loose any |
408 // bits (it might be a 64-bit pointer). | 408 // bits (it might be a 64-bit pointer). |
409 if (flags_ & TRACE_EVENT_FLAG_HAS_ID) | 409 if (flags_ & TRACE_EVENT_FLAG_HAS_ID) |
410 StringAppendF(out, ",\"id\":\"%" PRIx64 "\"", static_cast<uint64>(id_)); | 410 StringAppendF(out, ",\"id\":\"%" PRIx64 "\"", static_cast<uint64>(id_)); |
| 411 |
| 412 // Instant events also output their scope. |
| 413 if (phase_ == TRACE_EVENT_PHASE_INSTANT) { |
| 414 char scope = '?'; |
| 415 switch (flags_ & TRACE_EVENT_FLAG_SCOPE_MASK) { |
| 416 case TRACE_EVENT_SCOPE_GLOBAL: |
| 417 scope = TRACE_EVENT_SCOPE_NAME_GLOBAL; |
| 418 break; |
| 419 |
| 420 case TRACE_EVENT_SCOPE_PROCESS: |
| 421 scope = TRACE_EVENT_SCOPE_NAME_PROCESS; |
| 422 break; |
| 423 |
| 424 case TRACE_EVENT_SCOPE_THREAD: |
| 425 scope = TRACE_EVENT_SCOPE_NAME_THREAD; |
| 426 break; |
| 427 } |
| 428 StringAppendF(out, ",\"s\":\"%c\"", scope); |
| 429 } |
| 430 |
411 *out += "}"; | 431 *out += "}"; |
412 } | 432 } |
413 | 433 |
414 //////////////////////////////////////////////////////////////////////////////// | 434 //////////////////////////////////////////////////////////////////////////////// |
415 // | 435 // |
416 // TraceResultBuffer | 436 // TraceResultBuffer |
417 // | 437 // |
418 //////////////////////////////////////////////////////////////////////////////// | 438 //////////////////////////////////////////////////////////////////////////////// |
419 | 439 |
420 TraceResultBuffer::OutputCallback | 440 TraceResultBuffer::OutputCallback |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 0, // num_args | 1257 0, // num_args |
1238 NULL, // arg_names | 1258 NULL, // arg_names |
1239 NULL, // arg_types | 1259 NULL, // arg_types |
1240 NULL, // arg_values | 1260 NULL, // arg_values |
1241 TRACE_EVENT_FLAG_NONE); // flags | 1261 TRACE_EVENT_FLAG_NONE); // flags |
1242 } | 1262 } |
1243 } | 1263 } |
1244 | 1264 |
1245 } // namespace trace_event_internal | 1265 } // namespace trace_event_internal |
1246 | 1266 |
OLD | NEW |