Commit afd3d04f authored by Matt Falkenhagen's avatar Matt Falkenhagen Committed by Commit Bot

Documentation: Clarify Local vs Global trace event ids.

Change-Id: Id9138033bd01513043fc46b436575d4b7efe6a26
Reviewed-on: https://chromium-review.googlesource.com/c/1328361Reviewed-by: default avatarEhsan Chiniforooshan <chiniforooshan@chromium.org>
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607133}
parent 1e15d707
...@@ -31,16 +31,15 @@ ...@@ -31,16 +31,15 @@
#define TRACE_STR_COPY(str) \ #define TRACE_STR_COPY(str) \
trace_event_internal::TraceStringWithCopy(str) trace_event_internal::TraceStringWithCopy(str)
// DEPRECATED: do not use: Consider using TRACE_ID_{GLOBAL, LOCAL} macros, // DEPRECATED: do not use: Consider using the TRACE_ID_LOCAL macro instead. By
// instead. By default, uint64_t ID argument values are not mangled with the // default, uint64_t ID argument values are not mangled with the Process ID in
// Process ID in TRACE_EVENT_ASYNC macros. Use this macro to force Process ID // TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling.
// mangling.
#define TRACE_ID_MANGLE(id) \ #define TRACE_ID_MANGLE(id) \
trace_event_internal::TraceID::ForceMangle(id) trace_event_internal::TraceID::ForceMangle(id)
// DEPRECATED: do not use: Consider using TRACE_ID_{GLOBAL, LOCAL} macros, // DEPRECATED: do not use: Consider using the TRACE_ID_GLOBAL macro instead. By
// instead. By default, pointers are mangled with the Process ID in // default, pointers are mangled with the Process ID in TRACE_EVENT_ASYNC
// TRACE_EVENT_ASYNC macros. Use this macro to prevent Process ID mangling. // macros. Use this macro to prevent Process ID mangling.
#define TRACE_ID_DONT_MANGLE(id) \ #define TRACE_ID_DONT_MANGLE(id) \
trace_event_internal::TraceID::DontMangle(id) trace_event_internal::TraceID::DontMangle(id)
...@@ -61,7 +60,12 @@ ...@@ -61,7 +60,12 @@
#define TRACE_ID_WITH_SCOPE(scope, ...) \ #define TRACE_ID_WITH_SCOPE(scope, ...) \
trace_event_internal::TraceID::WithScope(scope, ##__VA_ARGS__) trace_event_internal::TraceID::WithScope(scope, ##__VA_ARGS__)
// Use this for ids that are unique across processes. This allows different
// processes to use the same id to refer to the same event.
#define TRACE_ID_GLOBAL(id) trace_event_internal::TraceID::GlobalId(id) #define TRACE_ID_GLOBAL(id) trace_event_internal::TraceID::GlobalId(id)
// Use this for ids that are unique within a single process. This allows
// different processes to use the same id to refer to different events.
#define TRACE_ID_LOCAL(id) trace_event_internal::TraceID::LocalId(id) #define TRACE_ID_LOCAL(id) trace_event_internal::TraceID::LocalId(id)
#define TRACE_EVENT_API_CURRENT_THREAD_ID \ #define TRACE_EVENT_API_CURRENT_THREAD_ID \
...@@ -477,9 +481,7 @@ const int kZeroNumArgs = 0; ...@@ -477,9 +481,7 @@ const int kZeroNumArgs = 0;
const std::nullptr_t kGlobalScope = nullptr; const std::nullptr_t kGlobalScope = nullptr;
const unsigned long long kNoId = 0; const unsigned long long kNoId = 0;
// TraceID encapsulates an ID that can either be an integer or pointer. Pointers // TraceID encapsulates an ID that can either be an integer or pointer.
// are by default mangled with the Process ID so that they are unlikely to
// collide when the same pointer is used on different processes.
class BASE_EXPORT TraceID { class BASE_EXPORT TraceID {
public: public:
// Can be combined with WithScope. // Can be combined with WithScope.
...@@ -540,7 +542,7 @@ class BASE_EXPORT TraceID { ...@@ -540,7 +542,7 @@ class BASE_EXPORT TraceID {
unsigned int id_flags_ = TRACE_EVENT_FLAG_HAS_ID; unsigned int id_flags_ = TRACE_EVENT_FLAG_HAS_ID;
}; };
// DEPRECATED: consider using LocalId or GlobalId, instead. // DEPRECATED: consider using GlobalId, instead.
class DontMangle { class DontMangle {
public: public:
explicit DontMangle(const void* raw_id) explicit DontMangle(const void* raw_id)
...@@ -566,7 +568,7 @@ class BASE_EXPORT TraceID { ...@@ -566,7 +568,7 @@ class BASE_EXPORT TraceID {
unsigned long long raw_id_; unsigned long long raw_id_;
}; };
// DEPRECATED: consider using LocalId or GlobalId, instead. // DEPRECATED: consider using LocalId, instead.
class ForceMangle { class ForceMangle {
public: public:
explicit ForceMangle(unsigned long long raw_id) : raw_id_(raw_id) {} explicit ForceMangle(unsigned long long raw_id) : raw_id_(raw_id) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment