Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Side by Side Diff: base/trace_event/trace_event_impl.cc

Issue 2253973003: Add an explicit way of making IDs local or global (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 StringAppendF(out, ",\"id\":\"0x%" PRIx64 "\"", static_cast<uint64_t>(id_));
366 if (id_flags == TRACE_EVENT_FLAG_HAS_LOCAL_ID)
367 *out += ",\"id_is_global\":false";
caseq 2016/08/22 19:48:52 rather than emitting it as a bool flag, can we var
chiniforooshan 2016/08/23 19:54:53 Is there anything wrong with using a boolean here?
368 if (id_flags == TRACE_EVENT_FLAG_HAS_GLOBAL_ID)
369 *out += ",\"id_is_global\":true";
365 } 370 }
366 371
367 if (flags_ & TRACE_EVENT_FLAG_BIND_TO_ENCLOSING) 372 if (flags_ & TRACE_EVENT_FLAG_BIND_TO_ENCLOSING)
368 StringAppendF(out, ",\"bp\":\"e\""); 373 StringAppendF(out, ",\"bp\":\"e\"");
369 374
370 if ((flags_ & TRACE_EVENT_FLAG_FLOW_OUT) || 375 if ((flags_ & TRACE_EVENT_FLAG_FLOW_OUT) ||
371 (flags_ & TRACE_EVENT_FLAG_FLOW_IN) || 376 (flags_ & TRACE_EVENT_FLAG_FLOW_IN) ||
372 phase_ == TRACE_EVENT_PHASE_BIND_IDS) { 377 phase_ == TRACE_EVENT_PHASE_BIND_IDS) {
373 StringAppendF(out, ",\"bind_id\":\"0x%" PRIx64 "\"", 378 StringAppendF(out, ",\"bind_id\":\"0x%" PRIx64 "\"",
374 static_cast<uint64_t>(bind_id_)); 379 static_cast<uint64_t>(bind_id_));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text); 423 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text);
419 424
420 *out << value_as_text; 425 *out << value_as_text;
421 } 426 }
422 *out << "}"; 427 *out << "}";
423 } 428 }
424 } 429 }
425 430
426 } // namespace trace_event 431 } // namespace trace_event
427 } // namespace base 432 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698