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/trace_event/trace_event_impl.h" | 5 #include "base/trace_event/trace_event_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/json/string_escape.h" | 10 #include "base/json/string_escape.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 StringAppendF(out, ",\"tts\":%" PRId64, thread_time_int64); | 351 StringAppendF(out, ",\"tts\":%" PRId64, thread_time_int64); |
352 } | 352 } |
353 | 353 |
354 // Output async tts marker field if flag is set. | 354 // Output async tts marker field if flag is set. |
355 if (flags_ & TRACE_EVENT_FLAG_ASYNC_TTS) { | 355 if (flags_ & TRACE_EVENT_FLAG_ASYNC_TTS) { |
356 StringAppendF(out, ", \"use_async_tts\":1"); | 356 StringAppendF(out, ", \"use_async_tts\":1"); |
357 } | 357 } |
358 | 358 |
359 // If id_ is set, print it out as a hex string so we don't loose any | 359 // If id_ is set, print it out as a hex string so we don't loose any |
360 // bits (it might be a 64-bit pointer). | 360 // bits (it might be a 64-bit pointer). |
361 if (flags_ & TRACE_EVENT_FLAG_HAS_ID) { | 361 unsigned int id_flags = flags_ & TRACE_EVENT_FLAG_ID_MASK; |
362 if (id_flags != TRACE_EVENT_FLAG_NONE) { | |
362 if (scope_ != trace_event_internal::kGlobalScope) | 363 if (scope_ != trace_event_internal::kGlobalScope) |
363 StringAppendF(out, ",\"scope\":\"%s\"", scope_); | 364 StringAppendF(out, ",\"scope\":\"%s\"", scope_); |
364 StringAppendF(out, ",\"id\":\"0x%" PRIx64 "\"", static_cast<uint64_t>(id_)); | 365 std::string id_field_name = "id"; |
366 if (id_flags == TRACE_EVENT_FLAG_HAS_LOCAL_ID) | |
367 id_field_name = "local_id"; | |
Primiano Tucci (use gerrit)
2016/08/31 19:11:22
instead of changing the field name, which feels qu
chiniforooshan
2016/08/31 21:28:45
Done.
Note that this was originally due to Andrey
chiniforooshan
2016/09/02 19:37:37
Nat, Ben, can one of you please tell us your prefe
chiniforooshan
2016/09/09 14:40:37
+petrcermak maybe?
| |
368 if (id_flags == TRACE_EVENT_FLAG_HAS_GLOBAL_ID) | |
369 id_field_name = "global_id"; | |
370 StringAppendF(out, ",\"%s\":\"0x%" PRIx64 "\"", | |
371 id_field_name.c_str(), static_cast<uint64_t>(id_)); | |
365 } | 372 } |
366 | 373 |
367 if (flags_ & TRACE_EVENT_FLAG_BIND_TO_ENCLOSING) | 374 if (flags_ & TRACE_EVENT_FLAG_BIND_TO_ENCLOSING) |
368 StringAppendF(out, ",\"bp\":\"e\""); | 375 StringAppendF(out, ",\"bp\":\"e\""); |
369 | 376 |
370 if ((flags_ & TRACE_EVENT_FLAG_FLOW_OUT) || | 377 if ((flags_ & TRACE_EVENT_FLAG_FLOW_OUT) || |
371 (flags_ & TRACE_EVENT_FLAG_FLOW_IN) || | 378 (flags_ & TRACE_EVENT_FLAG_FLOW_IN) || |
372 phase_ == TRACE_EVENT_PHASE_BIND_IDS) { | 379 phase_ == TRACE_EVENT_PHASE_BIND_IDS) { |
373 StringAppendF(out, ",\"bind_id\":\"0x%" PRIx64 "\"", | 380 StringAppendF(out, ",\"bind_id\":\"0x%" PRIx64 "\"", |
374 static_cast<uint64_t>(bind_id_)); | 381 static_cast<uint64_t>(bind_id_)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
418 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text); | 425 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text); |
419 | 426 |
420 *out << value_as_text; | 427 *out << value_as_text; |
421 } | 428 } |
422 *out << "}"; | 429 *out << "}"; |
423 } | 430 } |
424 } | 431 } |
425 | 432 |
426 } // namespace trace_event | 433 } // namespace trace_event |
427 } // namespace base | 434 } // namespace base |
OLD | NEW |