Index: base/debug/trace_event.h |
diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h |
index 07863ad997b3d56fd46f8033a0775f08b56b279a..dfe4e0d674aeb7eff124656da8421f2981ba548a 100644 |
--- a/base/debug/trace_event.h |
+++ b/base/debug/trace_event.h |
@@ -265,6 +265,12 @@ |
category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \ |
arg2_name, arg2_val) |
+// Similar to TRACE_EVENT_BEGINx but allowing a custom |thread_name| and |
+// a custom |at| timestamp to be provided. |
+#define TRACE_EVENT_COPY_BEGIN_EXPLICIT0(category, name, id, at) \ |
nduca
2012/12/04 05:09:38
at->ts?
we're not using a custom |thread_name| an
dsinclair
2012/12/04 15:02:38
Done
|
+ INTERNAL_TRACE_EVENT_ADD_EXPLICIT(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ |
+ category, name, at, id, TRACE_EVENT_FLAG_COPY) |
+ |
// Records a single END event for "name" immediately. If the category |
// is not enabled, then this does nothing. |
// - category and name strings must have application lifetime (statics or |
@@ -292,6 +298,12 @@ |
category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \ |
arg2_name, arg2_val) |
+// Similar to TRACE_EVENT_ENDx but allowing a custom |thread_name| and |
+// a custom |at| timestamp to be provided. |
+#define TRACE_EVENT_COPY_END_EXPLICIT0(category, name, id, at) \ |
+ INTERNAL_TRACE_EVENT_ADD_EXPLICIT(TRACE_EVENT_PHASE_ASYNC_END, \ |
+ category, name, at, id, TRACE_EVENT_FLAG_COPY) |
+ |
// Time threshold event: |
// Only record the event if the duration is greater than the specified |
// threshold_us (time in microseconds). |
@@ -597,6 +609,24 @@ |
#define TRACE_EVENT_API_ADD_TRACE_EVENT \ |
base::debug::TraceLog::GetInstance()->AddTraceEvent |
+// Add a trace event to the platform tracing system. Returns thresholdBeginId |
+// for use in a corresponding end TRACE_EVENT_API_ADD_TRACE_EVENT_EXPLICIT call. |
+// int TRACE_EVENT_API_ADD_TRACE_EVENT_EXPLICIT( |
+// char phase, |
+// const unsigned char* category_enabled, |
+// const char* name, |
+// int64 timestamp, |
+// unsigned long long id, |
+// int num_args, |
+// const char** arg_names, |
+// const unsigned char* arg_types, |
+// const unsigned long long* arg_values, |
+// int threshold_begin_id, |
+// long long threshold, |
+// unsigned char flags) |
+#define TRACE_EVENT_API_ADD_TRACE_EVENT_EXPLICIT \ |
nduca
2012/12/04 05:09:38
what requires this one?
dsinclair
2012/12/04 15:02:38
It's used on line 992 in AddTraceEventExplicit().
|
+ base::debug::TraceLog::GetInstance()->AddTraceEventExplicit |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// Implementation detail: trace event macros create temporary variables |
@@ -638,6 +668,23 @@ |
} \ |
} while (0) |
+// Implementation detail: internal macro to create static category and add |
+// event if the category is enabled. |
+#define INTERNAL_TRACE_EVENT_ADD_EXPLICIT(phase, category, name, \ |
+ at, id, flags, ...) \ |
+ do { \ |
+ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \ |
+ if (*INTERNAL_TRACE_EVENT_UID(catstatic)) { \ |
+ unsigned char trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ |
+ trace_event_internal::TraceID trace_event_trace_id( \ |
+ id, &trace_event_flags); \ |
+ trace_event_internal::AddTraceEventExplicit( \ |
+ phase, INTERNAL_TRACE_EVENT_UID(catstatic), \ |
+ name, at, trace_event_trace_id.data(), \ |
+ trace_event_flags, ##__VA_ARGS__); \ |
+ } \ |
+ } while (0) |
+ |
// Implementation detail: internal macro to create static category and add begin |
// event if the category is enabled. Also adds the end event when the scope |
// ends. |
@@ -930,6 +977,17 @@ static inline int AddTraceEvent(char phase, |
kNoThreshholdBeginId, kNoThresholdValue, flags); |
} |
+static inline int AddTraceEventExplicit(char phase, |
+ const unsigned char* category_enabled, |
+ const char* name, |
+ int64 timestamp, |
+ unsigned long long id, |
+ unsigned char flags) { |
+ return TRACE_EVENT_API_ADD_TRACE_EVENT_EXPLICIT( |
+ phase, category_enabled, name, timestamp, id, kZeroNumArgs, |
+ NULL, NULL, NULL, kNoThreshholdBeginId, kNoThresholdValue, flags); |
+} |
+ |
// Used by TRACE_EVENTx macro. Do not use directly. |
class BASE_EXPORT TraceEndOnScopeClose { |
public: |