Index: base/debug/trace_event.h |
diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h |
index f78bb3c998e03dcebadd663599c215afb6013c87..b22dd9a07a6e49ad0564b5b51964f021f787a89e 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_RAW_EVENT_BEGIN_AT0(category, thread_name, name, at) \ |
+ INTERNAL_TRACE_RAW_EVENT_ADD_AT(TRACE_EVENT_PHASE_BEGIN, \ |
+ category, thread_name, name, at, TRACE_EVENT_FLAG_NONE) |
+ |
// 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,17 @@ |
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_RAW_EVENT_END_AT0(category, thread_name, name, at) \ |
+ INTERNAL_TRACE_RAW_EVENT_ADD_AT(TRACE_EVENT_PHASE_END, \ |
+ category, thread_name, name, at, TRACE_EVENT_FLAG_NONE) |
+ |
+// Adds trace BEGIN and END events for the provided |start| and |end| times. |
+#define TRACE_RAW_EVENT_BETWEEN0(category, thread_name, name, start, end) \ |
dsinclair
2012/11/06 16:25:46
This was added purely for convenience. At the poin
|
+ TRACE_RAW_EVENT_BEGIN_AT0(category, thread_name, name, start); \ |
+ TRACE_RAW_EVENT_END_AT0(category, thread_name, name, end) |
+ |
// Time threshold event: |
// Only record the event if the duration is greater than the specified |
// threshold_us (time in microseconds). |
@@ -605,6 +622,25 @@ |
#define TRACE_EVENT_API_IS_ATRACE_ENABLED() false |
#endif |
+// Add a trace event to the platform tracing system. Returns thresholdBeginId |
dsinclair
2012/11/06 16:25:46
If this isn't part of the API then I'm not going t
|
+// for use in a corresponding end TRACE_EVENT_API_ADD_TRACE_RAW_EVENT call. |
+// int TRACE_EVENT_API_ADD_TRACE_RAW_EVENT( |
+// char phase, |
+// const unsigned char* category_enabled, |
+// const char* thread_name, |
+// 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_RAW_EVENT \ |
+ base::debug::TraceLog::GetInstance()->AddTraceRawEvent |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// Implementation detail: trace event macros create temporary variables |
@@ -651,6 +687,19 @@ |
} \ |
} while (0) |
+// Implementation detail: internal macro to create static category and add |
+// event if the category is enabled. |
+#define INTERNAL_TRACE_RAW_EVENT_ADD_AT(phase, category, thread_name, name, \ |
+ at, flags, ...) \ |
+ do { \ |
+ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \ |
+ if (*INTERNAL_TRACE_EVENT_UID(catstatic)) { \ |
+ trace_event_internal::AddTraceRawEvent( \ |
+ phase, INTERNAL_TRACE_EVENT_UID(catstatic), thread_name, name, \ |
+ at, trace_event_internal::kNoEventId, 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. |
@@ -943,6 +992,18 @@ static inline int AddTraceEvent(char phase, |
kNoThreshholdBeginId, kNoThresholdValue, flags); |
} |
+static inline int AddTraceRawEvent(char phase, |
+ const unsigned char* category_enabled, |
+ const char* thread_name, |
+ const char* name, |
+ int64 timestamp, |
+ unsigned long long id, |
+ unsigned char flags) { |
+ return TRACE_EVENT_API_ADD_TRACE_RAW_EVENT( |
+ phase, category_enabled, thread_name, name, timestamp, id, kZeroNumArgs, |
+ NULL, NULL, NULL, kNoThreshholdBeginId, kNoThresholdValue, flags); |
+} |
+ |
// Used by TRACE_EVENTx macro. Do not use directly. |
class BASE_EXPORT TraceEndOnScopeClose { |
public: |