Chromium Code Reviews| Index: Source/platform/TraceEvent.h |
| diff --git a/Source/platform/TraceEvent.h b/Source/platform/TraceEvent.h |
| index 6bddc14b77ff51bdfbaee86e23300e302dd6a688..e7c5afb7f37578acd88f1a1a65557a18516558ed 100644 |
| --- a/Source/platform/TraceEvent.h |
| +++ b/Source/platform/TraceEvent.h |
| @@ -451,6 +451,101 @@ |
| category, name, id, TRACE_EVENT_FLAG_COPY, \ |
| 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. |
| +// - category and name strings must have application lifetime (statics or |
|
alexclarke
2014/09/01 11:24:20
|category|? and |name|?
picksi1
2014/09/01 13:33:47
You are correct, but as this code is cut-and-paste
|
| +// literals). They may not include " chars. |
|
alexclarke
2014/09/01 11:24:20
inverted commas?
picksi1
2014/09/01 13:33:47
As above
|
| +// - |id| is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW |
| +// 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. |
| +// FLOW events are different from ASYNC events in how they are drawn by the |
| +// tracing UI. A FLOW defines asynchronous data flow, such as posting a task |
| +// (FLOW_BEGIN) and later executing that task (FLOW_END). Expect FLOWs to be |
| +// drawn as lines or arrows from FLOW_BEGIN scopes to FLOW_END scopes. Similar |
| +// to ASYNC, a FLOW can consist of multiple phases. The first phase is defined |
| +// by the FLOW_BEGIN calls. Additional phases can be defined using the FLOW_STEP |
| +// macros. When the operation completes, call FLOW_END. An async operation can |
| +// span threads and processes, but all events in that operation must use the |
| +// same |name| and |id|. Each event can have its own args. |
| +#define TRACE_EVENT_FLOW_BEGIN0(category_group, name, id) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_NONE) |
| +#define TRACE_EVENT_FLOW_BEGIN1(category_group, name, id, arg1_name, arg1_val) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) |
| +#define TRACE_EVENT_FLOW_BEGIN2(category_group, name, id, arg1_name, arg1_val, \ |
| + arg2_name, arg2_val) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_NONE, \ |
| + arg1_name, arg1_val, arg2_name, arg2_val) |
| +#define TRACE_EVENT_COPY_FLOW_BEGIN0(category_group, name, id) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_COPY) |
| +#define TRACE_EVENT_COPY_FLOW_BEGIN1(category_group, name, id, arg1_name, \ |
| + arg1_val) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_COPY, \ |
| + arg1_name, arg1_val) |
| +#define TRACE_EVENT_COPY_FLOW_BEGIN2(category_group, name, id, arg1_name, \ |
| + arg1_val, arg2_name, arg2_val) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_COPY, \ |
| + arg1_name, arg1_val, arg2_name, arg2_val) |
| + |
| +// Records a single FLOW_STEP event for |step| immediately. If the category |
| +// is not enabled, then this does nothing. The |name| and |id| must match the |
| +// FLOW_BEGIN event above. The |step| param identifies this step within the |
| +// async event. This should be called at the beginning of the next phase of an |
| +// asynchronous operation. |
| +#define TRACE_EVENT_FLOW_STEP0(category_group, name, id, step) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_NONE, "step", step) |
| +#define TRACE_EVENT_FLOW_STEP1(category_group, name, id, step, \ |
| + arg1_name, arg1_val) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_NONE, "step", step, \ |
| + arg1_name, arg1_val) |
| +#define TRACE_EVENT_COPY_FLOW_STEP0(category_group, name, id, step) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_COPY, "step", step) |
| +#define TRACE_EVENT_COPY_FLOW_STEP1(category_group, name, id, step, \ |
| + arg1_name, arg1_val) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_STEP, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_COPY, "step", step, \ |
| + arg1_name, arg1_val) |
| + |
| +// Records a single FLOW_END event for "name" immediately. If the category |
| +// is not enabled, then this does nothing. |
| +#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 TRACE_EVENT_FLOW_END1(category_group, name, id, arg1_name, arg1_val) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) |
| +#define TRACE_EVENT_FLOW_END2(category_group, name, id, arg1_name, arg1_val, \ |
| + arg2_name, arg2_val) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_NONE, \ |
| + arg1_name, arg1_val, arg2_name, arg2_val) |
| +#define TRACE_EVENT_COPY_FLOW_END0(category_group, name, id) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_COPY) |
| +#define TRACE_EVENT_COPY_FLOW_END1(category_group, name, id, arg1_name, \ |
| + arg1_val) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_COPY, \ |
| + arg1_name, arg1_val) |
| +#define TRACE_EVENT_COPY_FLOW_END2(category_group, name, id, arg1_name, \ |
| + arg1_val, arg2_name, arg2_val) \ |
| + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ |
| + category_group, name, id, TRACE_EVENT_FLAG_COPY, \ |
| + arg1_name, arg1_val, arg2_name, arg2_val) |
| + |
| + |
| // Creates a scope of a sampling state with the given category and name (both must |
| // be constant strings). These states are intended for a sampling profiler. |
| // Implementation note: we store category and name together because we don't |
| @@ -648,6 +743,9 @@ |
| #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_FLOW_BEGIN ('s') |
| +#define TRACE_EVENT_PHASE_FLOW_STEP ('t') |
| +#define TRACE_EVENT_PHASE_FLOW_END ('f') |
| // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. |
| #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned char>(0)) |