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

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: versioning the id field Created 4 years, 3 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
« no previous file with comments | « base/trace_event/trace_event.h ('k') | base/trace_event/trace_event_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_HAS_ID |
362 TRACE_EVENT_FLAG_HAS_LOCAL_ID |
363 TRACE_EVENT_FLAG_HAS_GLOBAL_ID);
364 if (id_flags_) {
362 if (scope_ != trace_event_internal::kGlobalScope) 365 if (scope_ != trace_event_internal::kGlobalScope)
363 StringAppendF(out, ",\"scope\":\"%s\"", scope_); 366 StringAppendF(out, ",\"scope\":\"%s\"", scope_);
364 StringAppendF(out, ",\"id\":\"0x%" PRIx64 "\"", static_cast<uint64_t>(id_)); 367
368 switch (id_flags_) {
369 case TRACE_EVENT_FLAG_HAS_ID:
370 StringAppendF(out, ",\"id\":\"0x%" PRIx64 "\"",
371 static_cast<uint64_t>(id_));
372 break;
373
374 case TRACE_EVENT_FLAG_HAS_LOCAL_ID:
375 StringAppendF(out, ",\"id2\":{\"local\":\"0x%" PRIx64 "\"}",
376 static_cast<uint64_t>(id_));
377 break;
378
379 case TRACE_EVENT_FLAG_HAS_GLOBAL_ID:
380 StringAppendF(out, ",\"id2\":{\"global\":\"0x%" PRIx64 "\"}",
381 static_cast<uint64_t>(id_));
382 break;
383
384 default:
385 NOTREACHED() << "More than one of the ID flags are set";
386 break;
387 }
365 } 388 }
366 389
367 if (flags_ & TRACE_EVENT_FLAG_BIND_TO_ENCLOSING) 390 if (flags_ & TRACE_EVENT_FLAG_BIND_TO_ENCLOSING)
368 StringAppendF(out, ",\"bp\":\"e\""); 391 StringAppendF(out, ",\"bp\":\"e\"");
369 392
370 if ((flags_ & TRACE_EVENT_FLAG_FLOW_OUT) || 393 if ((flags_ & TRACE_EVENT_FLAG_FLOW_OUT) ||
371 (flags_ & TRACE_EVENT_FLAG_FLOW_IN) || 394 (flags_ & TRACE_EVENT_FLAG_FLOW_IN) ||
372 phase_ == TRACE_EVENT_PHASE_BIND_IDS) { 395 phase_ == TRACE_EVENT_PHASE_BIND_IDS) {
373 StringAppendF(out, ",\"bind_id\":\"0x%" PRIx64 "\"", 396 StringAppendF(out, ",\"bind_id\":\"0x%" PRIx64 "\"",
374 static_cast<uint64_t>(bind_id_)); 397 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); 441 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text);
419 442
420 *out << value_as_text; 443 *out << value_as_text;
421 } 444 }
422 *out << "}"; 445 *out << "}";
423 } 446 }
424 } 447 }
425 448
426 } // namespace trace_event 449 } // namespace trace_event
427 } // namespace base 450 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_event.h ('k') | base/trace_event/trace_event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698