Index: base/trace_event/trace_event.h |
diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h |
index 07018b93e0799c1e9134d694ae170961f5303919..edbbb8abf512b7e4809f0fa76f11738a35300385 100644 |
--- a/base/trace_event/trace_event.h |
+++ b/base/trace_event/trace_event.h |
@@ -228,11 +228,19 @@ |
#define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ |
INTERNAL_TRACE_MEMORY(category_group, name) \ |
INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val) |
+#define TRACE_EVENT1_WITH_FLOW(category_group, name, arg1_name, arg1_val) \ |
dsinclair
2015/07/14 13:52:10
These should be TRACE_EVENT_WITH_FLOW1
We put the
|
+ INTERNAL_TRACE_MEMORY(category_group, name) \ |
+ INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, arg1_name, arg1_val) |
#define TRACE_EVENT2( \ |
category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) \ |
INTERNAL_TRACE_MEMORY(category_group, name) \ |
INTERNAL_TRACE_EVENT_ADD_SCOPED( \ |
category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) |
+#define TRACE_EVENT2_WITH_FLOW( \ |
dsinclair
2015/07/14 13:52:10
Why no TRACE_EVENT_WITH_FLOW0?
|
+ category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) \ |
+ INTERNAL_TRACE_MEMORY(category_group, name) \ |
+ INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW( \ |
+ category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) |
// Records events like TRACE_EVENT2 but uses |memory_tag| for memory tracing. |
// Use this where |name| is too generic to accurately aggregate allocations. |
@@ -852,6 +860,9 @@ |
#define TRACE_EVENT_FLOW_END0(category_group, name, id) \ |
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ |
category_group, name, id, TRACE_EVENT_FLAG_NONE) |
+#define APPEND_TRACE_EVENT_FLOW_END0(category_group, name, id) \ |
+ appendFlowEvent(trace_event_internal::constructFlowEvent(TRACE_EVENT_PHASE_FLOW_END, \ |
+ category_group, name, id, TRACE_EVENT_FLAG_NONE)) |
#define TRACE_EVENT_FLOW_END_BIND_TO_ENCLOSING0(category_group, name, id) \ |
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ |
category_group, name, id, TRACE_EVENT_FLAG_BIND_TO_ENCLOSING) |
@@ -1076,6 +1087,22 @@ TRACE_EVENT_API_CLASS_EXPORT extern \ |
INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ |
} |
+#define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, ...) \ |
+ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
+ trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ |
+ base::trace_event::TraceEventHandle h = {0, 0, 0}; \ |
+ if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
+ h = trace_event_internal::AddTraceEvent( \ |
+ TRACE_EVENT_PHASE_COMPLETE, \ |
+ INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
+ trace_event_internal::kNoEventId, TRACE_EVENT_FLAG_NONE, \ |
+ ##__VA_ARGS__); \ |
+ INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \ |
+ INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ |
+ } \ |
+ base::trace_event::TraceEventHandleWrapper INTERNAL_TRACE_EVENT_UID(wrapper) (h); \ |
+ INTERNAL_TRACE_EVENT_UID(wrapper) |
+ |
// Implementation detail: internal macro to create static category and add |
// event if the category is enabled. |
#define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category_group, name, id, \ |
@@ -1093,6 +1120,21 @@ TRACE_EVENT_API_CLASS_EXPORT extern \ |
} \ |
} while (0) |
+#define INTERNAL_TRACE_EVENT_ADD_WITH_ID_RETURN(phase, category_group, name, id, \ |
+ flags, ...) \ |
+ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
+ if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
+ unsigned char trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ |
+ trace_event_internal::TraceID trace_event_trace_id( \ |
+ id, &trace_event_flags); \ |
+ return trace_event_internal::AddTraceEvent( \ |
+ phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ |
+ name, trace_event_trace_id.data(), trace_event_flags, \ |
+ ##__VA_ARGS__); \ |
+ } \ |
+ base::trace_event::TraceEventHandle h = {0, 0, 0}; \ |
+ return h; |
+ |
// 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_TIMESTAMP(phase, \ |
@@ -1174,6 +1216,10 @@ TRACE_EVENT_API_CLASS_EXPORT extern \ |
#define TRACE_EVENT_SCOPE_NAME_PROCESS ('p') |
#define TRACE_EVENT_SCOPE_NAME_THREAD ('t') |
+// Type values for identifying flow event direction. |
+#define FLOW_IN (static_cast<unsigned char>(0)) |
+#define FLOW_OUT (static_cast<unsigned char>(1)) |
dsinclair
2015/07/14 13:52:10
These should be TRACE_EVENT_FLAG_FLOW_IN/OUT. fmea
fmeawad
2015/07/14 17:32:57
The CL has landed.
|
+ |
namespace trace_event_internal { |
// Specify these values when the corresponding argument of AddTraceEvent is not |
@@ -1600,6 +1646,15 @@ static inline base::trace_event::TraceEventHandle AddTraceEvent( |
arg2_name, arg2_val); |
} |
+static inline base::trace_event::TraceEventHandle constructFlowEvent( |
+ char phase, |
+ const char *category_group, |
+ const char *name, |
+ unsigned long long id, |
+ unsigned char flags) { |
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_RETURN(phase, category_group, name, id, flags); |
+} |
+ |
// Used by TRACE_EVENTx macros. Do not use directly. |
class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer { |
public: |