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

Unified Diff: base/debug/trace_event.h

Issue 10913242: Trace PostTasks from post to run (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/message_loop.cc » ('j') | base/message_loop.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event.h
diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h
index 804b468116243bf17674fd64002f4ababf1c1ea0..d74f861a455737d67373ab2c8a1a22aeefaa1684 100644
--- a/base/debug/trace_event.h
+++ b/base/debug/trace_event.h
@@ -162,6 +162,11 @@
#define TRACE_STR_COPY(str) \
trace_event_internal::TraceStringWithCopy(str)
+// By default, uint64 ID argument values are not mangled with the Process ID in
+// TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling.
+#define TRACE_ID_MANGLE(id) \
+ trace_event_internal::TraceID::ForceMangle(id)
+
// Records a pair of begin and end events called "name" for the current
// scope, with 0, 1 or 2 associated arguments. If the category is not
// enabled, then this does nothing.
@@ -638,11 +643,38 @@ const unsigned long long kNoEventId = 0;
// same pointer is used on different processes.
class TraceID {
public:
+ class ForceMangle {
+ public:
+ explicit ForceMangle(unsigned long long id) : data_(id) {}
+ explicit ForceMangle(unsigned long id) : data_(id) {}
+ explicit ForceMangle(unsigned int id) : data_(id) {}
+ explicit ForceMangle(unsigned short id) : data_(id) {}
+ explicit ForceMangle(unsigned char id) : data_(id) {}
+ explicit ForceMangle(long long id) :
+ data_(static_cast<unsigned long long>(id)) {}
+ explicit ForceMangle(long id) :
+ data_(static_cast<unsigned long long>(id)) {}
+ explicit ForceMangle(int id) :
+ data_(static_cast<unsigned long long>(id)) {}
+ explicit ForceMangle(short id) :
+ data_(static_cast<unsigned long long>(id)) {}
+ explicit ForceMangle(signed char id) :
+ data_(static_cast<unsigned long long>(id)) {}
+
+ unsigned long long data() const { return data_; }
+
+ private:
+ unsigned long long data_;
+ };
+
explicit TraceID(const void* id, unsigned char* flags) :
data_(static_cast<unsigned long long>(
reinterpret_cast<unsigned long>(id))) {
*flags |= TRACE_EVENT_FLAG_MANGLE_ID;
}
+ explicit TraceID(ForceMangle id, unsigned char* flags) : data_(id.data()) {
+ *flags |= TRACE_EVENT_FLAG_MANGLE_ID;
+ }
explicit TraceID(unsigned long long id, unsigned char* flags) :
data_(id) { (void)flags; }
explicit TraceID(unsigned long id, unsigned char* flags) :
« no previous file with comments | « no previous file | base/message_loop.cc » ('j') | base/message_loop.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698