Chromium Code Reviews| Index: base/trace_event/trace_event.h |
| diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h |
| index 07fd84157ed8c6cfb676e4c13b7ec1a87f4d44b2..f4eaac6ac3ff9378fc2ce1c49b02e2c5db1d01c8 100644 |
| --- a/base/trace_event/trace_event.h |
| +++ b/base/trace_event/trace_event.h |
| @@ -183,6 +183,16 @@ |
| #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \ |
| base::trace_event::TraceLog::GetInstance()->UpdateTraceEventDuration |
| +// Set the duration field of a COMPLETE trace event. |
| +// void TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION_EXPLICIT( |
| +// const unsigned char* category_group_enabled, |
| +// const char* name, |
| +// base::trace_event::TraceEventHandle id, |
| +// const TimeTicks& now, |
| +// const ThreadTicks* thread_now) |
| +#define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION_EXPLICIT \ |
| + base::trace_event::TraceLog::GetInstance()->UpdateTraceEventDurationExplicit |
| + |
| // Adds a metadata event to the trace log. The |AppendValueAsTraceFormat| method |
| // on the convertable value will be called at flush time. |
| // TRACE_EVENT_API_ADD_METADATA_EVENT( |
| @@ -339,6 +349,32 @@ |
| } \ |
| } while (0) |
| +// Implementation detail: internal macro to create static category and add |
| +// event if the category is enabled. |
| +#define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMPS( \ |
| + category_group, name, id, thread_id, begin_timestamp, end_timestamp, \ |
| + thread_end_timestamp, flags, ...) \ |
| + do { \ |
| + INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
| + if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \ |
| + trace_event_internal::TraceID trace_event_trace_id((id)); \ |
| + unsigned int trace_event_flags = \ |
| + flags | trace_event_trace_id.id_flags(); \ |
| + const unsigned char* uid_category_group_enabled = \ |
| + INTERNAL_TRACE_EVENT_UID(category_group_enabled); \ |
| + auto handle = \ |
| + trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ |
| + TRACE_EVENT_PHASE_COMPLETE, uid_category_group_enabled, name, \ |
| + trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ |
| + thread_id, begin_timestamp, \ |
| + trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ |
| + trace_event_internal::kNoId, ##__VA_ARGS__); \ |
| + TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION_EXPLICIT( \ |
|
Primiano Tucci (use gerrit)
2017/07/10 13:09:15
(mostly note to future-myself and git archaeologis
|
| + uid_category_group_enabled, name, handle, end_timestamp, \ |
| + thread_end_timestamp); \ |
| + } \ |
| + } while (0) |
| + |
| // The linked ID will not be mangled. |
| #define INTERNAL_TRACE_EVENT_ADD_LINK_IDS(category_group, name, id1, id2) \ |
| do { \ |