OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This header file defines the set of trace_event macros without specifying | 5 // This header file defines the set of trace_event macros without specifying |
6 // how the events actually get collected and stored. If you need to expose trace | 6 // how the events actually get collected and stored. If you need to expose trace |
7 // events to some other universe, you can copy-and-paste this file as well as | 7 // events to some other universe, you can copy-and-paste this file as well as |
8 // trace_event.h, modifying the macros contained there as necessary for the | 8 // trace_event.h, modifying the macros contained there as necessary for the |
9 // target platform. The end result is that multiple libraries can funnel events | 9 // target platform. The end result is that multiple libraries can funnel events |
10 // through to a shared trace event collector. | 10 // through to a shared trace event collector. |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 trace_event_internal::TraceID::DontMangle(id) | 218 trace_event_internal::TraceID::DontMangle(id) |
219 | 219 |
220 // Records a pair of begin and end events called "name" for the current | 220 // Records a pair of begin and end events called "name" for the current |
221 // scope, with 0, 1 or 2 associated arguments. If the category is not | 221 // scope, with 0, 1 or 2 associated arguments. If the category is not |
222 // enabled, then this does nothing. | 222 // enabled, then this does nothing. |
223 // - category and name strings must have application lifetime (statics or | 223 // - category and name strings must have application lifetime (statics or |
224 // literals). They may not include " chars. | 224 // literals). They may not include " chars. |
225 #define TRACE_EVENT0(category_group, name) \ | 225 #define TRACE_EVENT0(category_group, name) \ |
226 INTERNAL_TRACE_MEMORY(category_group, name) \ | 226 INTERNAL_TRACE_MEMORY(category_group, name) \ |
227 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name) | 227 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name) |
228 #define TRACE_EVENT_WITH_FLOW0(category_group, name, bind_id, flow_direction) \ | |
229 INTERNAL_TRACE_MEMORY(category_group, name) \ | |
230 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \ | |
231 flow_direction) | |
beaudoin
2015/07/27 18:34:13
s/flow_direction/flow_flags ? Since it includes pr
| |
228 #define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ | 232 #define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ |
229 INTERNAL_TRACE_MEMORY(category_group, name) \ | 233 INTERNAL_TRACE_MEMORY(category_group, name) \ |
230 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val) | 234 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val) |
235 #define TRACE_EVENT_WITH_FLOW1(category_group, name, bind_id, flow_direction, \ | |
236 arg1_name, arg1_val) \ | |
237 INTERNAL_TRACE_MEMORY(category_group, name) \ | |
238 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW( \ | |
239 category_group, name, bind_id, flow_direction, arg1_name, arg1_val) | |
231 #define TRACE_EVENT2( \ | 240 #define TRACE_EVENT2( \ |
232 category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) \ | 241 category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) \ |
233 INTERNAL_TRACE_MEMORY(category_group, name) \ | 242 INTERNAL_TRACE_MEMORY(category_group, name) \ |
234 INTERNAL_TRACE_EVENT_ADD_SCOPED( \ | 243 INTERNAL_TRACE_EVENT_ADD_SCOPED( \ |
235 category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) | 244 category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) |
245 #define TRACE_EVENT_WITH_FLOW2(category_group, name, bind_id, flow_direction, \ | |
246 arg1_name, arg1_val, arg2_name, arg2_val) \ | |
247 INTERNAL_TRACE_MEMORY(category_group, name) \ | |
248 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \ | |
249 flow_direction, arg1_name, \ | |
250 arg1_val, arg2_name, arg2_val) | |
236 | 251 |
237 // Records events like TRACE_EVENT2 but uses |memory_tag| for memory tracing. | 252 // Records events like TRACE_EVENT2 but uses |memory_tag| for memory tracing. |
238 // Use this where |name| is too generic to accurately aggregate allocations. | 253 // Use this where |name| is too generic to accurately aggregate allocations. |
239 #define TRACE_EVENT_WITH_MEMORY_TAG2( \ | 254 #define TRACE_EVENT_WITH_MEMORY_TAG2( \ |
240 category, name, memory_tag, arg1_name, arg1_val, arg2_name, arg2_val) \ | 255 category, name, memory_tag, arg1_name, arg1_val, arg2_name, arg2_val) \ |
241 INTERNAL_TRACE_MEMORY(category, memory_tag) \ | 256 INTERNAL_TRACE_MEMORY(category, memory_tag) \ |
242 INTERNAL_TRACE_EVENT_ADD_SCOPED( \ | 257 INTERNAL_TRACE_EVENT_ADD_SCOPED( \ |
243 category, name, arg1_name, arg1_val, arg2_name, arg2_val) | 258 category, name, arg1_name, arg1_val, arg2_name, arg2_val) |
244 | 259 |
260 #define TRACE_EVENT_WITH_MEMORY_TAG_WITH_FLOW2(category, name, memory_tag, \ | |
261 bind_id, flow_direction, \ | |
262 arg1_name, arg1_val, arg2_name, \ | |
263 arg2_val) \ | |
264 INTERNAL_TRACE_MEMORY(category, memory_tag) \ | |
265 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category, name, bind_id, \ | |
266 flow_direction, arg1_name, \ | |
267 arg1_val, arg2_name, arg2_val) | |
268 | |
245 // UNSHIPPED_TRACE_EVENT* are like TRACE_EVENT* except that they are not | 269 // UNSHIPPED_TRACE_EVENT* are like TRACE_EVENT* except that they are not |
246 // included in official builds. | 270 // included in official builds. |
247 | 271 |
248 #if OFFICIAL_BUILD | 272 #if OFFICIAL_BUILD |
249 #undef TRACING_IS_OFFICIAL_BUILD | 273 #undef TRACING_IS_OFFICIAL_BUILD |
250 #define TRACING_IS_OFFICIAL_BUILD 1 | 274 #define TRACING_IS_OFFICIAL_BUILD 1 |
251 #elif !defined(TRACING_IS_OFFICIAL_BUILD) | 275 #elif !defined(TRACING_IS_OFFICIAL_BUILD) |
252 #define TRACING_IS_OFFICIAL_BUILD 0 | 276 #define TRACING_IS_OFFICIAL_BUILD 0 |
253 #endif | 277 #endif |
254 | 278 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
528 value1_name, static_cast<int>(value1_val), \ | 552 value1_name, static_cast<int>(value1_val), \ |
529 value2_name, static_cast<int>(value2_val)) | 553 value2_name, static_cast<int>(value2_val)) |
530 #define TRACE_COPY_COUNTER_ID2(category_group, name, id, value1_name, \ | 554 #define TRACE_COPY_COUNTER_ID2(category_group, name, id, value1_name, \ |
531 value1_val, value2_name, value2_val) \ | 555 value1_val, value2_name, value2_val) \ |
532 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \ | 556 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \ |
533 category_group, name, id, TRACE_EVENT_FLAG_COPY, \ | 557 category_group, name, id, TRACE_EVENT_FLAG_COPY, \ |
534 value1_name, static_cast<int>(value1_val), \ | 558 value1_name, static_cast<int>(value1_val), \ |
535 value2_name, static_cast<int>(value2_val)) | 559 value2_name, static_cast<int>(value2_val)) |
536 | 560 |
537 // TRACE_EVENT_SAMPLE_* events are injected by the sampling profiler. | 561 // TRACE_EVENT_SAMPLE_* events are injected by the sampling profiler. |
538 #define TRACE_EVENT_SAMPLE_WITH_TID_AND_TIMESTAMP0(category_group, name, \ | 562 #define TRACE_EVENT_SAMPLE_WITH_TID_AND_TIMESTAMP0(category_group, name, \ |
539 thread_id, timestamp) \ | 563 thread_id, timestamp) \ |
540 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ | 564 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
541 TRACE_EVENT_PHASE_SAMPLE, category_group, name, 0, thread_id, timestamp, \ | 565 TRACE_EVENT_PHASE_SAMPLE, category_group, name, 0, thread_id, timestamp, \ |
542 TRACE_EVENT_FLAG_NONE) | 566 TRACE_EVENT_FLAG_NONE) |
543 | 567 |
544 #define TRACE_EVENT_SAMPLE_WITH_TID_AND_TIMESTAMP1( \ | 568 #define TRACE_EVENT_SAMPLE_WITH_TID_AND_TIMESTAMP1( \ |
545 category_group, name, thread_id, timestamp, arg1_name, arg1_val) \ | 569 category_group, name, thread_id, timestamp, arg1_name, arg1_val) \ |
546 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ | 570 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
547 TRACE_EVENT_PHASE_SAMPLE, category_group, name, 0, thread_id, timestamp, \ | 571 TRACE_EVENT_PHASE_SAMPLE, category_group, name, 0, thread_id, timestamp, \ |
548 TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) | 572 TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) |
549 | 573 |
550 #define TRACE_EVENT_SAMPLE_WITH_TID_AND_TIMESTAMP2(category_group, name, \ | 574 #define TRACE_EVENT_SAMPLE_WITH_TID_AND_TIMESTAMP2(category_group, name, \ |
551 thread_id, timestamp, \ | 575 thread_id, timestamp, \ |
552 arg1_name, arg1_val, \ | 576 arg1_name, arg1_val, \ |
553 arg2_name, arg2_val) \ | 577 arg2_name, arg2_val) \ |
554 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ | 578 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
555 TRACE_EVENT_PHASE_SAMPLE, category_group, name, 0, thread_id, timestamp, \ | 579 TRACE_EVENT_PHASE_SAMPLE, category_group, name, 0, thread_id, timestamp, \ |
556 TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) | 580 TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) |
557 | 581 |
558 // ASYNC_STEP_* APIs should be only used by legacy code. New code should | 582 // ASYNC_STEP_* APIs should be only used by legacy code. New code should |
559 // consider using NESTABLE_ASYNC_* APIs to describe substeps within an async | 583 // consider using NESTABLE_ASYNC_* APIs to describe substeps within an async |
560 // event. | 584 // event. |
561 // Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2 | 585 // Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2 |
562 // associated arguments. If the category is not enabled, then this | 586 // associated arguments. If the category is not enabled, then this |
563 // does nothing. | 587 // does nothing. |
564 // - category and name strings must have application lifetime (statics or | 588 // - category and name strings must have application lifetime (statics or |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1061 #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \ | 1085 #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \ |
1062 static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \ | 1086 static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \ |
1063 const unsigned char* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \ | 1087 const unsigned char* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \ |
1064 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES(category_group, \ | 1088 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES(category_group, \ |
1065 INTERNAL_TRACE_EVENT_UID(atomic), \ | 1089 INTERNAL_TRACE_EVENT_UID(atomic), \ |
1066 INTERNAL_TRACE_EVENT_UID(category_group_enabled)); | 1090 INTERNAL_TRACE_EVENT_UID(category_group_enabled)); |
1067 | 1091 |
1068 // Implementation detail: internal macro to create static category and add | 1092 // Implementation detail: internal macro to create static category and add |
1069 // event if the category is enabled. | 1093 // event if the category is enabled. |
1070 #define INTERNAL_TRACE_EVENT_ADD(phase, category_group, name, flags, ...) \ | 1094 #define INTERNAL_TRACE_EVENT_ADD(phase, category_group, name, flags, ...) \ |
1071 do { \ | 1095 do { \ |
1072 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 1096 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
1073 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 1097 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
1074 trace_event_internal::AddTraceEvent( \ | 1098 trace_event_internal::AddTraceEvent( \ |
1075 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ | 1099 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
1076 trace_event_internal::kNoId, flags, ##__VA_ARGS__); \ | 1100 trace_event_internal::kNoId, flags, \ |
1077 } \ | 1101 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
1078 } while (0) | 1102 } \ |
1103 } while (0) | |
1079 | 1104 |
1080 // Implementation detail: internal macro to create static category and add begin | 1105 // Implementation detail: internal macro to create static category and add begin |
1081 // event if the category is enabled. Also adds the end event when the scope | 1106 // event if the category is enabled. Also adds the end event when the scope |
1082 // ends. | 1107 // ends. |
1083 #define INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, ...) \ | 1108 #define INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, ...) \ |
1084 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 1109 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
1085 trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ | 1110 trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ |
1086 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 1111 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
1087 base::trace_event::TraceEventHandle h = \ | 1112 base::trace_event::TraceEventHandle h = \ |
1088 trace_event_internal::AddTraceEvent( \ | 1113 trace_event_internal::AddTraceEvent( \ |
1089 TRACE_EVENT_PHASE_COMPLETE, \ | 1114 TRACE_EVENT_PHASE_COMPLETE, \ |
1090 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ | 1115 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
1091 trace_event_internal::kNoId, TRACE_EVENT_FLAG_NONE, \ | 1116 trace_event_internal::kNoId, TRACE_EVENT_FLAG_NONE, \ |
1092 ##__VA_ARGS__); \ | 1117 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
1093 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \ | 1118 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \ |
1094 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ | 1119 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ |
1095 } | 1120 } |
1121 | |
1122 #define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW( \ | |
1123 category_group, name, bind_id, flow_direction, ...) \ | |
beaudoin
2015/07/27 18:34:13
s/flow_direction/flow_flags ? Since it includes pr
| |
1124 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | |
1125 trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ | |
1126 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | |
1127 unsigned int trace_event_flags = flow_direction; \ | |
1128 trace_event_internal::TraceID trace_event_bind_id(bind_id, \ | |
1129 &trace_event_flags); \ | |
1130 base::trace_event::TraceEventHandle h = \ | |
1131 trace_event_internal::AddTraceEvent( \ | |
1132 TRACE_EVENT_PHASE_COMPLETE, \ | |
1133 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ | |
1134 trace_event_internal::kNoId, trace_event_flags, \ | |
1135 trace_event_bind_id.data(), ##__VA_ARGS__); \ | |
1136 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \ | |
1137 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ | |
1138 } | |
1096 | 1139 |
1097 // Implementation detail: internal macro to create static category and add | 1140 // Implementation detail: internal macro to create static category and add |
1098 // event if the category is enabled. | 1141 // event if the category is enabled. |
1099 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category_group, name, id, \ | 1142 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category_group, name, id, \ |
1100 flags, ...) \ | 1143 flags, ...) \ |
1101 do { \ | 1144 do { \ |
1102 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 1145 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
1103 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 1146 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
1104 unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ | 1147 unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ |
1105 trace_event_internal::TraceID trace_event_trace_id( \ | 1148 trace_event_internal::TraceID trace_event_trace_id(id, \ |
1106 id, &trace_event_flags); \ | 1149 &trace_event_flags); \ |
1107 trace_event_internal::AddTraceEvent( \ | 1150 trace_event_internal::AddTraceEvent( \ |
1108 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ | 1151 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
1109 name, trace_event_trace_id.data(), trace_event_flags, \ | 1152 trace_event_trace_id.data(), trace_event_flags, \ |
1110 ##__VA_ARGS__); \ | 1153 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
1111 } \ | 1154 } \ |
1112 } while (0) | 1155 } while (0) |
1113 | 1156 |
1114 // Implementation detail: internal macro to create static category and add | 1157 // Implementation detail: internal macro to create static category and add |
1115 // event if the category is enabled. | 1158 // event if the category is enabled. |
1116 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP(phase, \ | 1159 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
1117 category_group, name, id, thread_id, timestamp, flags, ...) \ | 1160 phase, category_group, name, id, thread_id, timestamp, flags, ...) \ |
1118 do { \ | 1161 do { \ |
1119 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 1162 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
1120 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 1163 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
1121 unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ | 1164 unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ |
1122 trace_event_internal::TraceID trace_event_trace_id( \ | 1165 trace_event_internal::TraceID trace_event_trace_id(id, \ |
1123 id, &trace_event_flags); \ | 1166 &trace_event_flags); \ |
1124 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ | 1167 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ |
1125 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ | 1168 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
1126 name, trace_event_trace_id.data(), trace_event_internal::kNoId, \ | 1169 trace_event_trace_id.data(), thread_id, \ |
1127 thread_id, base::TraceTicks::FromInternalValue(timestamp), \ | 1170 trace_event_internal::kNoId, \ |
1128 trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ | 1171 base::TraceTicks::FromInternalValue(timestamp), \ |
1129 ##__VA_ARGS__); \ | 1172 trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ |
1130 } \ | 1173 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
1131 } while (0) | 1174 } \ |
1175 } while (0) | |
1132 | 1176 |
1133 // Notes regarding the following definitions: | 1177 // Notes regarding the following definitions: |
1134 // New values can be added and propagated to third party libraries, but existing | 1178 // New values can be added and propagated to third party libraries, but existing |
1135 // definitions must never be changed, because third party libraries may use old | 1179 // definitions must never be changed, because third party libraries may use old |
1136 // definitions. | 1180 // definitions. |
1137 | 1181 |
1138 // Phase indicates the nature of an event entry. E.g. part of a begin/end pair. | 1182 // Phase indicates the nature of an event entry. E.g. part of a begin/end pair. |
1139 #define TRACE_EVENT_PHASE_BEGIN ('B') | 1183 #define TRACE_EVENT_PHASE_BEGIN ('B') |
1140 #define TRACE_EVENT_PHASE_END ('E') | 1184 #define TRACE_EVENT_PHASE_END ('E') |
1141 #define TRACE_EVENT_PHASE_COMPLETE ('X') | 1185 #define TRACE_EVENT_PHASE_COMPLETE ('X') |
(...skipping 19 matching lines...) Expand all Loading... | |
1161 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. | 1205 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. |
1162 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned int>(0)) | 1206 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned int>(0)) |
1163 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned int>(1 << 0)) | 1207 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned int>(1 << 0)) |
1164 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned int>(1 << 1)) | 1208 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned int>(1 << 1)) |
1165 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2)) | 1209 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2)) |
1166 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3)) | 1210 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3)) |
1167 #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4)) | 1211 #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4)) |
1168 #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5)) | 1212 #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5)) |
1169 #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6)) | 1213 #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6)) |
1170 #define TRACE_EVENT_FLAG_BIND_TO_ENCLOSING (static_cast<unsigned int>(1 << 7)) | 1214 #define TRACE_EVENT_FLAG_BIND_TO_ENCLOSING (static_cast<unsigned int>(1 << 7)) |
1171 #define TRACE_EVENT_FLAG_HAS_CONTEXT_ID (static_cast<unsigned int>(1 << 10)) | 1215 #define TRACE_EVENT_FLAG_FLOW_IN (static_cast<unsigned int>(1 << 8)) |
1216 #define TRACE_EVENT_FLAG_FLOW_OUT (static_cast<unsigned int>(1 << 9)) | |
1217 #define TRACE_EVENT_FLAG_HAS_CONTEXT_ID (static_cast<unsigned int>(1 << 11)) | |
1218 #define TRACE_EVENT_FLAG_FLOW_OPTIONAL (static_cast<unsigned int>(1 << 12)) | |
beaudoin
2015/07/27 18:34:13
Why not group the _FLOW_ flags together? Why chang
beaudoin
2015/07/29 18:55:43
Same question here: why change to 12?
| |
1172 | 1219 |
1173 #define TRACE_EVENT_FLAG_SCOPE_MASK (static_cast<unsigned int>( \ | 1220 #define TRACE_EVENT_FLAG_SCOPE_MASK (static_cast<unsigned int>( \ |
1174 TRACE_EVENT_FLAG_SCOPE_OFFSET | TRACE_EVENT_FLAG_SCOPE_EXTRA)) | 1221 TRACE_EVENT_FLAG_SCOPE_OFFSET | TRACE_EVENT_FLAG_SCOPE_EXTRA)) |
1175 | 1222 |
1176 // Type values for identifying types in the TraceValue union. | 1223 // Type values for identifying types in the TraceValue union. |
1177 #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1)) | 1224 #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1)) |
1178 #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2)) | 1225 #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2)) |
1179 #define TRACE_VALUE_TYPE_INT (static_cast<unsigned char>(3)) | 1226 #define TRACE_VALUE_TYPE_INT (static_cast<unsigned char>(3)) |
1180 #define TRACE_VALUE_TYPE_DOUBLE (static_cast<unsigned char>(4)) | 1227 #define TRACE_VALUE_TYPE_DOUBLE (static_cast<unsigned char>(4)) |
1181 #define TRACE_VALUE_TYPE_POINTER (static_cast<unsigned char>(5)) | 1228 #define TRACE_VALUE_TYPE_POINTER (static_cast<unsigned char>(5)) |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1406 static inline base::trace_event::TraceEventHandle | 1453 static inline base::trace_event::TraceEventHandle |
1407 AddTraceEventWithThreadIdAndTimestamp( | 1454 AddTraceEventWithThreadIdAndTimestamp( |
1408 char phase, | 1455 char phase, |
1409 const unsigned char* category_group_enabled, | 1456 const unsigned char* category_group_enabled, |
1410 const char* name, | 1457 const char* name, |
1411 unsigned long long id, | 1458 unsigned long long id, |
1412 unsigned long long context_id, | 1459 unsigned long long context_id, |
1413 int thread_id, | 1460 int thread_id, |
1414 const base::TraceTicks& timestamp, | 1461 const base::TraceTicks& timestamp, |
1415 unsigned int flags, | 1462 unsigned int flags, |
1463 unsigned long long bind_id, | |
1416 const char* arg1_name, | 1464 const char* arg1_name, |
1417 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& | 1465 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& |
1418 arg1_val) { | 1466 arg1_val) { |
1419 const int num_args = 1; | 1467 const int num_args = 1; |
1420 unsigned char arg_types[1] = { TRACE_VALUE_TYPE_CONVERTABLE }; | 1468 unsigned char arg_types[1] = { TRACE_VALUE_TYPE_CONVERTABLE }; |
1421 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1469 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
1422 phase, category_group_enabled, name, id, context_id, thread_id, | 1470 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
1423 timestamp, num_args, &arg1_name, arg_types, NULL, &arg1_val, flags); | 1471 timestamp, num_args, &arg1_name, arg_types, NULL, &arg1_val, flags); |
1424 } | 1472 } |
1425 | 1473 |
1426 template<class ARG1_TYPE> | 1474 template <class ARG1_TYPE> |
1427 static inline base::trace_event::TraceEventHandle | 1475 static inline base::trace_event::TraceEventHandle |
1428 AddTraceEventWithThreadIdAndTimestamp( | 1476 AddTraceEventWithThreadIdAndTimestamp( |
1429 char phase, | 1477 char phase, |
1430 const unsigned char* category_group_enabled, | 1478 const unsigned char* category_group_enabled, |
1431 const char* name, | 1479 const char* name, |
1432 unsigned long long id, | 1480 unsigned long long id, |
1433 unsigned long long context_id, | 1481 unsigned long long context_id, |
1434 int thread_id, | 1482 int thread_id, |
1435 const base::TraceTicks& timestamp, | 1483 const base::TraceTicks& timestamp, |
1436 unsigned int flags, | 1484 unsigned int flags, |
1485 unsigned long long bind_id, | |
1437 const char* arg1_name, | 1486 const char* arg1_name, |
1438 const ARG1_TYPE& arg1_val, | 1487 const ARG1_TYPE& arg1_val, |
1439 const char* arg2_name, | 1488 const char* arg2_name, |
1440 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& | 1489 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& |
1441 arg2_val) { | 1490 arg2_val) { |
1442 const int num_args = 2; | 1491 const int num_args = 2; |
1443 const char* arg_names[2] = { arg1_name, arg2_name }; | 1492 const char* arg_names[2] = { arg1_name, arg2_name }; |
1444 | 1493 |
1445 unsigned char arg_types[2]; | 1494 unsigned char arg_types[2]; |
1446 unsigned long long arg_values[2]; | 1495 unsigned long long arg_values[2]; |
1447 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); | 1496 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); |
1448 arg_types[1] = TRACE_VALUE_TYPE_CONVERTABLE; | 1497 arg_types[1] = TRACE_VALUE_TYPE_CONVERTABLE; |
1449 | 1498 |
1450 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 1499 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
1451 convertable_values[2]; | 1500 convertable_values[2]; |
1452 convertable_values[1] = arg2_val; | 1501 convertable_values[1] = arg2_val; |
1453 | 1502 |
1454 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1503 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
1455 phase, category_group_enabled, name, id, context_id, thread_id, | 1504 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
1456 timestamp, num_args, arg_names, arg_types, arg_values, | 1505 timestamp, num_args, arg_names, arg_types, arg_values, convertable_values, |
1457 convertable_values, flags); | 1506 flags); |
1458 } | 1507 } |
1459 | 1508 |
1460 template<class ARG2_TYPE> | 1509 template <class ARG2_TYPE> |
1461 static inline base::trace_event::TraceEventHandle | 1510 static inline base::trace_event::TraceEventHandle |
1462 AddTraceEventWithThreadIdAndTimestamp( | 1511 AddTraceEventWithThreadIdAndTimestamp( |
1463 char phase, | 1512 char phase, |
1464 const unsigned char* category_group_enabled, | 1513 const unsigned char* category_group_enabled, |
1465 const char* name, | 1514 const char* name, |
1466 unsigned long long id, | 1515 unsigned long long id, |
1467 unsigned long long context_id, | 1516 unsigned long long context_id, |
1468 int thread_id, | 1517 int thread_id, |
1469 const base::TraceTicks& timestamp, | 1518 const base::TraceTicks& timestamp, |
1470 unsigned int flags, | 1519 unsigned int flags, |
1520 unsigned long long bind_id, | |
1471 const char* arg1_name, | 1521 const char* arg1_name, |
1472 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val, | 1522 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val, |
1473 const char* arg2_name, | 1523 const char* arg2_name, |
1474 const ARG2_TYPE& arg2_val) { | 1524 const ARG2_TYPE& arg2_val) { |
1475 const int num_args = 2; | 1525 const int num_args = 2; |
1476 const char* arg_names[2] = { arg1_name, arg2_name }; | 1526 const char* arg_names[2] = { arg1_name, arg2_name }; |
1477 | 1527 |
1478 unsigned char arg_types[2]; | 1528 unsigned char arg_types[2]; |
1479 unsigned long long arg_values[2]; | 1529 unsigned long long arg_values[2]; |
1480 arg_types[0] = TRACE_VALUE_TYPE_CONVERTABLE; | 1530 arg_types[0] = TRACE_VALUE_TYPE_CONVERTABLE; |
1481 arg_values[0] = 0; | 1531 arg_values[0] = 0; |
1482 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); | 1532 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); |
1483 | 1533 |
1484 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 1534 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
1485 convertable_values[2]; | 1535 convertable_values[2]; |
1486 convertable_values[0] = arg1_val; | 1536 convertable_values[0] = arg1_val; |
1487 | 1537 |
1488 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1538 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
1489 phase, category_group_enabled, name, id, context_id, thread_id, | 1539 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
1490 timestamp, num_args, arg_names, arg_types, arg_values, | 1540 timestamp, num_args, arg_names, arg_types, arg_values, convertable_values, |
1491 convertable_values, flags); | 1541 flags); |
1492 } | 1542 } |
1493 | 1543 |
1494 static inline base::trace_event::TraceEventHandle | 1544 static inline base::trace_event::TraceEventHandle |
1495 AddTraceEventWithThreadIdAndTimestamp( | 1545 AddTraceEventWithThreadIdAndTimestamp( |
1496 char phase, | 1546 char phase, |
1497 const unsigned char* category_group_enabled, | 1547 const unsigned char* category_group_enabled, |
1498 const char* name, | 1548 const char* name, |
1499 unsigned long long id, | 1549 unsigned long long id, |
1500 unsigned long long context_id, | 1550 unsigned long long context_id, |
1501 int thread_id, | 1551 int thread_id, |
1502 const base::TraceTicks& timestamp, | 1552 const base::TraceTicks& timestamp, |
1503 unsigned int flags, | 1553 unsigned int flags, |
1554 unsigned long long bind_id, | |
1504 const char* arg1_name, | 1555 const char* arg1_name, |
1505 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val, | 1556 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val, |
1506 const char* arg2_name, | 1557 const char* arg2_name, |
1507 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& | 1558 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& |
1508 arg2_val) { | 1559 arg2_val) { |
1509 const int num_args = 2; | 1560 const int num_args = 2; |
1510 const char* arg_names[2] = { arg1_name, arg2_name }; | 1561 const char* arg_names[2] = { arg1_name, arg2_name }; |
1511 unsigned char arg_types[2] = | 1562 unsigned char arg_types[2] = |
1512 { TRACE_VALUE_TYPE_CONVERTABLE, TRACE_VALUE_TYPE_CONVERTABLE }; | 1563 { TRACE_VALUE_TYPE_CONVERTABLE, TRACE_VALUE_TYPE_CONVERTABLE }; |
1513 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 1564 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
1514 convertable_values[2] = {arg1_val, arg2_val}; | 1565 convertable_values[2] = {arg1_val, arg2_val}; |
1515 | 1566 |
1516 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1567 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
1517 phase, category_group_enabled, name, id, context_id, thread_id, | 1568 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
1518 timestamp, num_args, arg_names, arg_types, NULL, convertable_values, | 1569 timestamp, num_args, arg_names, arg_types, NULL, convertable_values, |
1519 flags); | 1570 flags); |
1520 } | 1571 } |
1521 | 1572 |
1522 static inline base::trace_event::TraceEventHandle | 1573 static inline base::trace_event::TraceEventHandle |
1523 AddTraceEventWithThreadIdAndTimestamp( | 1574 AddTraceEventWithThreadIdAndTimestamp( |
1524 char phase, | 1575 char phase, |
1525 const unsigned char* category_group_enabled, | 1576 const unsigned char* category_group_enabled, |
1526 const char* name, | 1577 const char* name, |
1527 unsigned long long id, | 1578 unsigned long long id, |
1528 unsigned long long context_id, | 1579 unsigned long long context_id, |
1529 int thread_id, | 1580 int thread_id, |
1530 const base::TraceTicks& timestamp, | 1581 const base::TraceTicks& timestamp, |
1531 unsigned int flags) { | 1582 unsigned int flags, |
1583 unsigned long long bind_id) { | |
1532 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1584 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
1533 phase, category_group_enabled, name, id, context_id, thread_id, | 1585 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
1534 timestamp, kZeroNumArgs, NULL, NULL, NULL, NULL, flags); | 1586 timestamp, kZeroNumArgs, NULL, NULL, NULL, NULL, flags); |
1535 } | 1587 } |
1536 | 1588 |
1537 static inline base::trace_event::TraceEventHandle AddTraceEvent( | 1589 static inline base::trace_event::TraceEventHandle AddTraceEvent( |
1538 char phase, | 1590 char phase, |
1539 const unsigned char* category_group_enabled, | 1591 const unsigned char* category_group_enabled, |
1540 const char* name, | 1592 const char* name, |
1541 unsigned long long id, | 1593 unsigned long long id, |
1542 unsigned int flags) { | 1594 unsigned int flags, |
1595 unsigned long long bind_id) { | |
1543 const int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1596 const int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
1544 const base::TraceTicks now = base::TraceTicks::Now(); | 1597 const base::TraceTicks now = base::TraceTicks::Now(); |
1545 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1598 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, |
1546 name, id, kNoId, thread_id, now, | 1599 name, id, kNoId, thread_id, now, |
1547 flags); | 1600 flags, bind_id); |
1548 } | 1601 } |
1549 | 1602 |
1550 template<class ARG1_TYPE> | 1603 template <class ARG1_TYPE> |
1551 static inline base::trace_event::TraceEventHandle | 1604 static inline base::trace_event::TraceEventHandle |
1552 AddTraceEventWithThreadIdAndTimestamp( | 1605 AddTraceEventWithThreadIdAndTimestamp( |
1553 char phase, | 1606 char phase, |
1554 const unsigned char* category_group_enabled, | 1607 const unsigned char* category_group_enabled, |
1555 const char* name, | 1608 const char* name, |
1556 unsigned long long id, | 1609 unsigned long long id, |
1557 unsigned long long context_id, | 1610 unsigned long long context_id, |
1558 int thread_id, | 1611 int thread_id, |
1559 const base::TraceTicks& timestamp, | 1612 const base::TraceTicks& timestamp, |
1560 unsigned int flags, | 1613 unsigned int flags, |
1614 unsigned long long bind_id, | |
1561 const char* arg1_name, | 1615 const char* arg1_name, |
1562 const ARG1_TYPE& arg1_val) { | 1616 const ARG1_TYPE& arg1_val) { |
1563 const int num_args = 1; | 1617 const int num_args = 1; |
1564 unsigned char arg_types[1]; | 1618 unsigned char arg_types[1]; |
1565 unsigned long long arg_values[1]; | 1619 unsigned long long arg_values[1]; |
1566 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); | 1620 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); |
1567 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1621 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
1568 phase, category_group_enabled, name, id, context_id, thread_id, | 1622 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
1569 timestamp, num_args, &arg1_name, arg_types, arg_values, NULL, flags); | 1623 timestamp, num_args, &arg1_name, arg_types, arg_values, NULL, flags); |
1570 } | 1624 } |
1571 | 1625 |
1572 template<class ARG1_TYPE> | 1626 template <class ARG1_TYPE> |
1573 static inline base::trace_event::TraceEventHandle AddTraceEvent( | 1627 static inline base::trace_event::TraceEventHandle AddTraceEvent( |
1574 char phase, | 1628 char phase, |
1575 const unsigned char* category_group_enabled, | 1629 const unsigned char* category_group_enabled, |
1576 const char* name, | 1630 const char* name, |
1577 unsigned long long id, | 1631 unsigned long long id, |
1578 unsigned int flags, | 1632 unsigned int flags, |
1633 unsigned long long bind_id, | |
1579 const char* arg1_name, | 1634 const char* arg1_name, |
1580 const ARG1_TYPE& arg1_val) { | 1635 const ARG1_TYPE& arg1_val) { |
1581 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1636 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
1582 base::TraceTicks now = base::TraceTicks::Now(); | 1637 base::TraceTicks now = base::TraceTicks::Now(); |
1583 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1638 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, |
1584 name, id, kNoId, thread_id, now, | 1639 name, id, kNoId, thread_id, now, |
1585 flags, arg1_name, arg1_val); | 1640 bind_id, flags, |
1641 arg1_name, arg1_val); | |
1586 } | 1642 } |
1587 | 1643 |
1588 template<class ARG1_TYPE, class ARG2_TYPE> | 1644 template <class ARG1_TYPE, class ARG2_TYPE> |
1589 static inline base::trace_event::TraceEventHandle | 1645 static inline base::trace_event::TraceEventHandle |
1590 AddTraceEventWithThreadIdAndTimestamp( | 1646 AddTraceEventWithThreadIdAndTimestamp( |
1591 char phase, | 1647 char phase, |
1592 const unsigned char* category_group_enabled, | 1648 const unsigned char* category_group_enabled, |
1593 const char* name, | 1649 const char* name, |
1594 unsigned long long id, | 1650 unsigned long long id, |
1595 unsigned long long context_id, | 1651 unsigned long long context_id, |
1596 int thread_id, | 1652 int thread_id, |
1597 const base::TraceTicks& timestamp, | 1653 const base::TraceTicks& timestamp, |
1598 unsigned int flags, | 1654 unsigned int flags, |
1655 unsigned long long bind_id, | |
1599 const char* arg1_name, | 1656 const char* arg1_name, |
1600 const ARG1_TYPE& arg1_val, | 1657 const ARG1_TYPE& arg1_val, |
1601 const char* arg2_name, | 1658 const char* arg2_name, |
1602 const ARG2_TYPE& arg2_val) { | 1659 const ARG2_TYPE& arg2_val) { |
1603 const int num_args = 2; | 1660 const int num_args = 2; |
1604 const char* arg_names[2] = { arg1_name, arg2_name }; | 1661 const char* arg_names[2] = { arg1_name, arg2_name }; |
1605 unsigned char arg_types[2]; | 1662 unsigned char arg_types[2]; |
1606 unsigned long long arg_values[2]; | 1663 unsigned long long arg_values[2]; |
1607 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); | 1664 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); |
1608 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); | 1665 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); |
1609 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1666 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
1610 phase, category_group_enabled, name, id, context_id, thread_id, | 1667 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
1611 timestamp, num_args, arg_names, arg_types, arg_values, NULL, flags); | 1668 timestamp, num_args, arg_names, arg_types, arg_values, NULL, flags); |
1612 } | 1669 } |
1613 | 1670 |
1614 template<class ARG1_TYPE, class ARG2_TYPE> | 1671 template <class ARG1_TYPE, class ARG2_TYPE> |
1615 static inline base::trace_event::TraceEventHandle AddTraceEvent( | 1672 static inline base::trace_event::TraceEventHandle AddTraceEvent( |
1616 char phase, | 1673 char phase, |
1617 const unsigned char* category_group_enabled, | 1674 const unsigned char* category_group_enabled, |
1618 const char* name, | 1675 const char* name, |
1619 unsigned long long id, | 1676 unsigned long long id, |
1620 unsigned int flags, | 1677 unsigned int flags, |
1678 unsigned long long bind_id, | |
1621 const char* arg1_name, | 1679 const char* arg1_name, |
1622 const ARG1_TYPE& arg1_val, | 1680 const ARG1_TYPE& arg1_val, |
1623 const char* arg2_name, | 1681 const char* arg2_name, |
1624 const ARG2_TYPE& arg2_val) { | 1682 const ARG2_TYPE& arg2_val) { |
1625 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1683 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
1626 base::TraceTicks now = base::TraceTicks::Now(); | 1684 base::TraceTicks now = base::TraceTicks::Now(); |
1627 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1685 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, |
1628 name, id, kNoId, thread_id, now, | 1686 name, id, kNoId, thread_id, now, |
1629 flags, arg1_name, arg1_val, | 1687 flags, bind_id, |
1688 arg1_name, arg1_val, | |
1630 arg2_name, arg2_val); | 1689 arg2_name, arg2_val); |
1631 } | 1690 } |
1632 | 1691 |
1633 // Used by TRACE_EVENTx macros. Do not use directly. | 1692 // Used by TRACE_EVENTx macros. Do not use directly. |
1634 class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer { | 1693 class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer { |
1635 public: | 1694 public: |
1636 // Note: members of data_ intentionally left uninitialized. See Initialize. | 1695 // Note: members of data_ intentionally left uninitialized. See Initialize. |
1637 ScopedTracer() : p_data_(NULL) {} | 1696 ScopedTracer() : p_data_(NULL) {} |
1638 | 1697 |
1639 ~ScopedTracer() { | 1698 ~ScopedTracer() { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1746 const char* name_; | 1805 const char* name_; |
1747 IDType id_; | 1806 IDType id_; |
1748 | 1807 |
1749 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1808 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
1750 }; | 1809 }; |
1751 | 1810 |
1752 } // namespace trace_event | 1811 } // namespace trace_event |
1753 } // namespace base | 1812 } // namespace base |
1754 | 1813 |
1755 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 1814 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
OLD | NEW |