Index: base/debug/trace_event.h |
diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h |
index f9dc1c94d6d65b885772a4b1bf3b16005c58c2e9..ae984d612185225dbe3802c24f0a1fc338b84cd0 100644 |
--- a/base/debug/trace_event.h |
+++ b/base/debug/trace_event.h |
@@ -530,6 +530,11 @@ |
// only STEP_INTO or STEP_PAST macros; they can not mix and match. When the |
// operation completes, call ASYNC_END. |
// |
+// ASYNC_STEP_INTO and ASYNC_STEP_PAST can only represent one level of phases, |
+// between a pair of ASYNC_BEGIN and ASYNC_END. If an asynchronous operation |
+// has multiple levels of nesting phases/events, NESTABLE_ASYNC_* APIs can be |
+// used. |
+// |
// An ASYNC trace typically occurs on a single thread (if not, they will only be |
// drawn on the thread defined in the ASYNC_BEGIN event), but all events in that |
// operation must use the same |name| and |id|. Each step can have its own |
@@ -634,6 +639,47 @@ |
static_cast<int>(base::PlatformThread::CurrentId()), \ |
timestamp, TRACE_EVENT_FLAG_NONE) |
+ |
+// Records a single NESTABLE_ASYNC_BEGIN event called "name" immediately, with 2 |
+// associated arguments. If the category is not enabled, then this |
+// does nothing. |
+// - category and name strings must have application lifetime (statics or |
+// literals). They may not include " chars. |
+// - |id| is used to match the NESTABLE_ASYNC_BEGIN event with the |
+// NESTABLE_ASYNC_END event. Events are considered to match if their |
+// category_group, name and id values all match. |id| must either be a |
+// pointer or an integer value up to 64 bits. If it's a pointer, the bits |
+// will be xored with a hash of the process ID so that the same pointer on two |
+// different processes will not collide. |
+// - Unmatched NESTABLE_ASYNC_END event will be parsed as an instant event, |
+// and unmatched NESTABLE_ASYNC_BEGIN event will be parsed as an event, which |
+// starts at the time of the NESTABLE_ASYNC_BEGIN event and ends at the last |
+// NESTABLE_ASYNC_END event of that |id|. |
+// |
+// NESTABLE_ASYNC_* APIs are used to capture asynchronous operations which can |
+// have multiple levels of nested events/phases. If an asynchronous operation |
+// only has one level of sub-events, one should consider using ASYNC_STEP_*. |
+ |
+#define TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(category_group, name, id, arg1_name, \ |
+ arg1_val, arg2_name, arg2_val) \ |
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \ |
+ category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ |
+ arg2_name, arg2_val) |
+// Records a single NESTABLE_ASYNC_END event for "name" immediately. |
+// If the category is not enabled, then this does nothing. |
+#define TRACE_EVENT_NESTABLE_ASYNC_END2(category_group, name, id, arg1_name, \ |
+ arg1_val, arg2_name, arg2_val) \ |
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \ |
+ category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ |
+ arg2_name, arg2_val) |
+// Records a single NESTABLE_ASYNC_INSTANT event for "name" immediately. |
+// If the category is not enabled, then this does nothing. |
+#define TRACE_EVENT_NESTABLE_ASYNC_INSTANT2(category_group, name, id, \ |
+ arg1_name, arg1_val, arg2_name, arg2_val) \ |
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, \ |
+ category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ |
+ arg2_name, arg2_val) |
+ |
// Records a single FLOW_BEGIN event called "name" immediately, with 0, 1 or 2 |
// associated arguments. If the category is not enabled, then this |
// does nothing. |
@@ -972,6 +1018,9 @@ TRACE_EVENT_API_CLASS_EXPORT extern \ |
#define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') |
#define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') |
#define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') |
+#define TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN ('b') |
+#define TRACE_EVENT_PHASE_NESTABLE_ASYNC_END ('e') |
+#define TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT ('n') |
dsinclair
2014/09/03 15:02:47
bikeshed: should these be ASYNC_NESTABLE (and the
xunjieli
2014/09/03 15:09:15
Done. ASYNC_NESTABLE does sound better. Thanks!
|
// Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. |
#define TRACE_EVENT_FLAG_NONE (static_cast<unsigned char>(0)) |