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

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

Issue 12252058: Add a |scope| argument to TRACE_EVENT_INSTANT* and require its presence. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use flags to record scope Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/debug/trace_event_internal.h » ('j') | base/debug/trace_event_internal.h » ('J')
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/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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 *out += arg_names_[i]; 262 *out += arg_names_[i];
263 *out += "\":"; 263 *out += "\":";
264 AppendValueAsJSON(arg_types_[i], arg_values_[i], out); 264 AppendValueAsJSON(arg_types_[i], arg_values_[i], out);
265 } 265 }
266 *out += "}"; 266 *out += "}";
267 267
268 // If id_ is set, print it out as a hex string so we don't loose any 268 // If id_ is set, print it out as a hex string so we don't loose any
269 // bits (it might be a 64-bit pointer). 269 // bits (it might be a 64-bit pointer).
270 if (flags_ & TRACE_EVENT_FLAG_HAS_ID) 270 if (flags_ & TRACE_EVENT_FLAG_HAS_ID)
271 StringAppendF(out, ",\"id\":\"%" PRIx64 "\"", static_cast<uint64>(id_)); 271 StringAppendF(out, ",\"id\":\"%" PRIx64 "\"", static_cast<uint64>(id_));
272
273 // Instant events also output their scope.
274 if (phase_ == TRACE_EVENT_PHASE_INSTANT) {
275 char scope = '?';
276 switch (flags_ & TRACE_EVENT_FLAG_SCOPE_MASK) {
277 case TRACE_EVENT_SCOPE_GLOBAL:
278 scope = TRACE_SCOPE_NAME_GLOBAL;
279 break;
280
281 case TRACE_EVENT_SCOPE_PROCESS:
282 scope = TRACE_SCOPE_NAME_PROCESS;
283 break;
284
285 case TRACE_EVENT_SCOPE_THREAD:
286 scope = TRACE_SCOPE_NAME_THREAD;
287 break;
288 }
289 StringAppendF(out, ",\"s\":\"%c\"", scope);
290 }
291
272 *out += "}"; 292 *out += "}";
273 } 293 }
274 294
275 //////////////////////////////////////////////////////////////////////////////// 295 ////////////////////////////////////////////////////////////////////////////////
276 // 296 //
277 // TraceResultBuffer 297 // TraceResultBuffer
278 // 298 //
279 //////////////////////////////////////////////////////////////////////////////// 299 ////////////////////////////////////////////////////////////////////////////////
280 300
281 TraceResultBuffer::OutputCallback 301 TraceResultBuffer::OutputCallback
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 0, // num_args 882 0, // num_args
863 NULL, // arg_names 883 NULL, // arg_names
864 NULL, // arg_types 884 NULL, // arg_types
865 NULL, // arg_values 885 NULL, // arg_values
866 TRACE_EVENT_FLAG_NONE); // flags 886 TRACE_EVENT_FLAG_NONE); // flags
867 } 887 }
868 } 888 }
869 889
870 } // namespace trace_event_internal 890 } // namespace trace_event_internal
871 891
OLDNEW
« no previous file with comments | « no previous file | base/debug/trace_event_internal.h » ('j') | base/debug/trace_event_internal.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698