| 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_flags) \ |
| 229 INTERNAL_TRACE_MEMORY(category_group, name) \ |
| 230 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \ |
| 231 flow_flags) |
| 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_flags, \ |
| 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_flags, 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_flags, \ |
| 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_flags, 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_flags, \ |
| 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_flags, 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_flags, ...) \ |
| 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_flags; \ |
| 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 << 12)) |
| 1172 | 1218 |
| 1173 #define TRACE_EVENT_FLAG_SCOPE_MASK (static_cast<unsigned int>( \ | 1219 #define TRACE_EVENT_FLAG_SCOPE_MASK (static_cast<unsigned int>( \ |
| 1174 TRACE_EVENT_FLAG_SCOPE_OFFSET | TRACE_EVENT_FLAG_SCOPE_EXTRA)) | 1220 TRACE_EVENT_FLAG_SCOPE_OFFSET | TRACE_EVENT_FLAG_SCOPE_EXTRA)) |
| 1175 | 1221 |
| 1176 // Type values for identifying types in the TraceValue union. | 1222 // Type values for identifying types in the TraceValue union. |
| 1177 #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1)) | 1223 #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1)) |
| 1178 #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2)) | 1224 #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2)) |
| 1179 #define TRACE_VALUE_TYPE_INT (static_cast<unsigned char>(3)) | 1225 #define TRACE_VALUE_TYPE_INT (static_cast<unsigned char>(3)) |
| 1180 #define TRACE_VALUE_TYPE_DOUBLE (static_cast<unsigned char>(4)) | 1226 #define TRACE_VALUE_TYPE_DOUBLE (static_cast<unsigned char>(4)) |
| 1181 #define TRACE_VALUE_TYPE_POINTER (static_cast<unsigned char>(5)) | 1227 #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 | 1452 static inline base::trace_event::TraceEventHandle |
| 1407 AddTraceEventWithThreadIdAndTimestamp( | 1453 AddTraceEventWithThreadIdAndTimestamp( |
| 1408 char phase, | 1454 char phase, |
| 1409 const unsigned char* category_group_enabled, | 1455 const unsigned char* category_group_enabled, |
| 1410 const char* name, | 1456 const char* name, |
| 1411 unsigned long long id, | 1457 unsigned long long id, |
| 1412 unsigned long long context_id, | 1458 unsigned long long context_id, |
| 1413 int thread_id, | 1459 int thread_id, |
| 1414 const base::TraceTicks& timestamp, | 1460 const base::TraceTicks& timestamp, |
| 1415 unsigned int flags, | 1461 unsigned int flags, |
| 1462 unsigned long long bind_id, |
| 1416 const char* arg1_name, | 1463 const char* arg1_name, |
| 1417 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& | 1464 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& |
| 1418 arg1_val) { | 1465 arg1_val) { |
| 1419 const int num_args = 1; | 1466 const int num_args = 1; |
| 1420 unsigned char arg_types[1] = { TRACE_VALUE_TYPE_CONVERTABLE }; | 1467 unsigned char arg_types[1] = { TRACE_VALUE_TYPE_CONVERTABLE }; |
| 1421 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1468 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1422 phase, category_group_enabled, name, id, context_id, thread_id, | 1469 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
| 1423 timestamp, num_args, &arg1_name, arg_types, NULL, &arg1_val, flags); | 1470 timestamp, num_args, &arg1_name, arg_types, NULL, &arg1_val, flags); |
| 1424 } | 1471 } |
| 1425 | 1472 |
| 1426 template<class ARG1_TYPE> | 1473 template <class ARG1_TYPE> |
| 1427 static inline base::trace_event::TraceEventHandle | 1474 static inline base::trace_event::TraceEventHandle |
| 1428 AddTraceEventWithThreadIdAndTimestamp( | 1475 AddTraceEventWithThreadIdAndTimestamp( |
| 1429 char phase, | 1476 char phase, |
| 1430 const unsigned char* category_group_enabled, | 1477 const unsigned char* category_group_enabled, |
| 1431 const char* name, | 1478 const char* name, |
| 1432 unsigned long long id, | 1479 unsigned long long id, |
| 1433 unsigned long long context_id, | 1480 unsigned long long context_id, |
| 1434 int thread_id, | 1481 int thread_id, |
| 1435 const base::TraceTicks& timestamp, | 1482 const base::TraceTicks& timestamp, |
| 1436 unsigned int flags, | 1483 unsigned int flags, |
| 1484 unsigned long long bind_id, |
| 1437 const char* arg1_name, | 1485 const char* arg1_name, |
| 1438 const ARG1_TYPE& arg1_val, | 1486 const ARG1_TYPE& arg1_val, |
| 1439 const char* arg2_name, | 1487 const char* arg2_name, |
| 1440 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& | 1488 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& |
| 1441 arg2_val) { | 1489 arg2_val) { |
| 1442 const int num_args = 2; | 1490 const int num_args = 2; |
| 1443 const char* arg_names[2] = { arg1_name, arg2_name }; | 1491 const char* arg_names[2] = { arg1_name, arg2_name }; |
| 1444 | 1492 |
| 1445 unsigned char arg_types[2]; | 1493 unsigned char arg_types[2]; |
| 1446 unsigned long long arg_values[2]; | 1494 unsigned long long arg_values[2]; |
| 1447 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); | 1495 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); |
| 1448 arg_types[1] = TRACE_VALUE_TYPE_CONVERTABLE; | 1496 arg_types[1] = TRACE_VALUE_TYPE_CONVERTABLE; |
| 1449 | 1497 |
| 1450 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 1498 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 1451 convertable_values[2]; | 1499 convertable_values[2]; |
| 1452 convertable_values[1] = arg2_val; | 1500 convertable_values[1] = arg2_val; |
| 1453 | 1501 |
| 1454 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1502 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1455 phase, category_group_enabled, name, id, context_id, thread_id, | 1503 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
| 1456 timestamp, num_args, arg_names, arg_types, arg_values, | 1504 timestamp, num_args, arg_names, arg_types, arg_values, convertable_values, |
| 1457 convertable_values, flags); | 1505 flags); |
| 1458 } | 1506 } |
| 1459 | 1507 |
| 1460 template<class ARG2_TYPE> | 1508 template <class ARG2_TYPE> |
| 1461 static inline base::trace_event::TraceEventHandle | 1509 static inline base::trace_event::TraceEventHandle |
| 1462 AddTraceEventWithThreadIdAndTimestamp( | 1510 AddTraceEventWithThreadIdAndTimestamp( |
| 1463 char phase, | 1511 char phase, |
| 1464 const unsigned char* category_group_enabled, | 1512 const unsigned char* category_group_enabled, |
| 1465 const char* name, | 1513 const char* name, |
| 1466 unsigned long long id, | 1514 unsigned long long id, |
| 1467 unsigned long long context_id, | 1515 unsigned long long context_id, |
| 1468 int thread_id, | 1516 int thread_id, |
| 1469 const base::TraceTicks& timestamp, | 1517 const base::TraceTicks& timestamp, |
| 1470 unsigned int flags, | 1518 unsigned int flags, |
| 1519 unsigned long long bind_id, |
| 1471 const char* arg1_name, | 1520 const char* arg1_name, |
| 1472 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val, | 1521 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val, |
| 1473 const char* arg2_name, | 1522 const char* arg2_name, |
| 1474 const ARG2_TYPE& arg2_val) { | 1523 const ARG2_TYPE& arg2_val) { |
| 1475 const int num_args = 2; | 1524 const int num_args = 2; |
| 1476 const char* arg_names[2] = { arg1_name, arg2_name }; | 1525 const char* arg_names[2] = { arg1_name, arg2_name }; |
| 1477 | 1526 |
| 1478 unsigned char arg_types[2]; | 1527 unsigned char arg_types[2]; |
| 1479 unsigned long long arg_values[2]; | 1528 unsigned long long arg_values[2]; |
| 1480 arg_types[0] = TRACE_VALUE_TYPE_CONVERTABLE; | 1529 arg_types[0] = TRACE_VALUE_TYPE_CONVERTABLE; |
| 1481 arg_values[0] = 0; | 1530 arg_values[0] = 0; |
| 1482 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); | 1531 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); |
| 1483 | 1532 |
| 1484 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 1533 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 1485 convertable_values[2]; | 1534 convertable_values[2]; |
| 1486 convertable_values[0] = arg1_val; | 1535 convertable_values[0] = arg1_val; |
| 1487 | 1536 |
| 1488 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1537 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1489 phase, category_group_enabled, name, id, context_id, thread_id, | 1538 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
| 1490 timestamp, num_args, arg_names, arg_types, arg_values, | 1539 timestamp, num_args, arg_names, arg_types, arg_values, convertable_values, |
| 1491 convertable_values, flags); | 1540 flags); |
| 1492 } | 1541 } |
| 1493 | 1542 |
| 1494 static inline base::trace_event::TraceEventHandle | 1543 static inline base::trace_event::TraceEventHandle |
| 1495 AddTraceEventWithThreadIdAndTimestamp( | 1544 AddTraceEventWithThreadIdAndTimestamp( |
| 1496 char phase, | 1545 char phase, |
| 1497 const unsigned char* category_group_enabled, | 1546 const unsigned char* category_group_enabled, |
| 1498 const char* name, | 1547 const char* name, |
| 1499 unsigned long long id, | 1548 unsigned long long id, |
| 1500 unsigned long long context_id, | 1549 unsigned long long context_id, |
| 1501 int thread_id, | 1550 int thread_id, |
| 1502 const base::TraceTicks& timestamp, | 1551 const base::TraceTicks& timestamp, |
| 1503 unsigned int flags, | 1552 unsigned int flags, |
| 1553 unsigned long long bind_id, |
| 1504 const char* arg1_name, | 1554 const char* arg1_name, |
| 1505 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val, | 1555 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val, |
| 1506 const char* arg2_name, | 1556 const char* arg2_name, |
| 1507 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& | 1557 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& |
| 1508 arg2_val) { | 1558 arg2_val) { |
| 1509 const int num_args = 2; | 1559 const int num_args = 2; |
| 1510 const char* arg_names[2] = { arg1_name, arg2_name }; | 1560 const char* arg_names[2] = { arg1_name, arg2_name }; |
| 1511 unsigned char arg_types[2] = | 1561 unsigned char arg_types[2] = |
| 1512 { TRACE_VALUE_TYPE_CONVERTABLE, TRACE_VALUE_TYPE_CONVERTABLE }; | 1562 { TRACE_VALUE_TYPE_CONVERTABLE, TRACE_VALUE_TYPE_CONVERTABLE }; |
| 1513 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 1563 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 1514 convertable_values[2] = {arg1_val, arg2_val}; | 1564 convertable_values[2] = {arg1_val, arg2_val}; |
| 1515 | 1565 |
| 1516 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1566 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1517 phase, category_group_enabled, name, id, context_id, thread_id, | 1567 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
| 1518 timestamp, num_args, arg_names, arg_types, NULL, convertable_values, | 1568 timestamp, num_args, arg_names, arg_types, NULL, convertable_values, |
| 1519 flags); | 1569 flags); |
| 1520 } | 1570 } |
| 1521 | 1571 |
| 1522 static inline base::trace_event::TraceEventHandle | 1572 static inline base::trace_event::TraceEventHandle |
| 1523 AddTraceEventWithThreadIdAndTimestamp( | 1573 AddTraceEventWithThreadIdAndTimestamp( |
| 1524 char phase, | 1574 char phase, |
| 1525 const unsigned char* category_group_enabled, | 1575 const unsigned char* category_group_enabled, |
| 1526 const char* name, | 1576 const char* name, |
| 1527 unsigned long long id, | 1577 unsigned long long id, |
| 1528 unsigned long long context_id, | 1578 unsigned long long context_id, |
| 1529 int thread_id, | 1579 int thread_id, |
| 1530 const base::TraceTicks& timestamp, | 1580 const base::TraceTicks& timestamp, |
| 1531 unsigned int flags) { | 1581 unsigned int flags, |
| 1582 unsigned long long bind_id) { |
| 1532 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1583 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1533 phase, category_group_enabled, name, id, context_id, thread_id, | 1584 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
| 1534 timestamp, kZeroNumArgs, NULL, NULL, NULL, NULL, flags); | 1585 timestamp, kZeroNumArgs, NULL, NULL, NULL, NULL, flags); |
| 1535 } | 1586 } |
| 1536 | 1587 |
| 1537 static inline base::trace_event::TraceEventHandle AddTraceEvent( | 1588 static inline base::trace_event::TraceEventHandle AddTraceEvent( |
| 1538 char phase, | 1589 char phase, |
| 1539 const unsigned char* category_group_enabled, | 1590 const unsigned char* category_group_enabled, |
| 1540 const char* name, | 1591 const char* name, |
| 1541 unsigned long long id, | 1592 unsigned long long id, |
| 1542 unsigned int flags) { | 1593 unsigned int flags, |
| 1594 unsigned long long bind_id) { |
| 1543 const int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1595 const int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
| 1544 const base::TraceTicks now = base::TraceTicks::Now(); | 1596 const base::TraceTicks now = base::TraceTicks::Now(); |
| 1545 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1597 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, |
| 1546 name, id, kNoId, thread_id, now, | 1598 name, id, kNoId, thread_id, now, |
| 1547 flags); | 1599 flags, bind_id); |
| 1548 } | 1600 } |
| 1549 | 1601 |
| 1550 template<class ARG1_TYPE> | 1602 template <class ARG1_TYPE> |
| 1551 static inline base::trace_event::TraceEventHandle | 1603 static inline base::trace_event::TraceEventHandle |
| 1552 AddTraceEventWithThreadIdAndTimestamp( | 1604 AddTraceEventWithThreadIdAndTimestamp( |
| 1553 char phase, | 1605 char phase, |
| 1554 const unsigned char* category_group_enabled, | 1606 const unsigned char* category_group_enabled, |
| 1555 const char* name, | 1607 const char* name, |
| 1556 unsigned long long id, | 1608 unsigned long long id, |
| 1557 unsigned long long context_id, | 1609 unsigned long long context_id, |
| 1558 int thread_id, | 1610 int thread_id, |
| 1559 const base::TraceTicks& timestamp, | 1611 const base::TraceTicks& timestamp, |
| 1560 unsigned int flags, | 1612 unsigned int flags, |
| 1613 unsigned long long bind_id, |
| 1561 const char* arg1_name, | 1614 const char* arg1_name, |
| 1562 const ARG1_TYPE& arg1_val) { | 1615 const ARG1_TYPE& arg1_val) { |
| 1563 const int num_args = 1; | 1616 const int num_args = 1; |
| 1564 unsigned char arg_types[1]; | 1617 unsigned char arg_types[1]; |
| 1565 unsigned long long arg_values[1]; | 1618 unsigned long long arg_values[1]; |
| 1566 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); | 1619 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); |
| 1567 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1620 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1568 phase, category_group_enabled, name, id, context_id, thread_id, | 1621 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
| 1569 timestamp, num_args, &arg1_name, arg_types, arg_values, NULL, flags); | 1622 timestamp, num_args, &arg1_name, arg_types, arg_values, NULL, flags); |
| 1570 } | 1623 } |
| 1571 | 1624 |
| 1572 template<class ARG1_TYPE> | 1625 template <class ARG1_TYPE> |
| 1573 static inline base::trace_event::TraceEventHandle AddTraceEvent( | 1626 static inline base::trace_event::TraceEventHandle AddTraceEvent( |
| 1574 char phase, | 1627 char phase, |
| 1575 const unsigned char* category_group_enabled, | 1628 const unsigned char* category_group_enabled, |
| 1576 const char* name, | 1629 const char* name, |
| 1577 unsigned long long id, | 1630 unsigned long long id, |
| 1578 unsigned int flags, | 1631 unsigned int flags, |
| 1632 unsigned long long bind_id, |
| 1579 const char* arg1_name, | 1633 const char* arg1_name, |
| 1580 const ARG1_TYPE& arg1_val) { | 1634 const ARG1_TYPE& arg1_val) { |
| 1581 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1635 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
| 1582 base::TraceTicks now = base::TraceTicks::Now(); | 1636 base::TraceTicks now = base::TraceTicks::Now(); |
| 1583 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1637 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, |
| 1584 name, id, kNoId, thread_id, now, | 1638 name, id, kNoId, thread_id, now, |
| 1585 flags, arg1_name, arg1_val); | 1639 bind_id, flags, |
| 1640 arg1_name, arg1_val); |
| 1586 } | 1641 } |
| 1587 | 1642 |
| 1588 template<class ARG1_TYPE, class ARG2_TYPE> | 1643 template <class ARG1_TYPE, class ARG2_TYPE> |
| 1589 static inline base::trace_event::TraceEventHandle | 1644 static inline base::trace_event::TraceEventHandle |
| 1590 AddTraceEventWithThreadIdAndTimestamp( | 1645 AddTraceEventWithThreadIdAndTimestamp( |
| 1591 char phase, | 1646 char phase, |
| 1592 const unsigned char* category_group_enabled, | 1647 const unsigned char* category_group_enabled, |
| 1593 const char* name, | 1648 const char* name, |
| 1594 unsigned long long id, | 1649 unsigned long long id, |
| 1595 unsigned long long context_id, | 1650 unsigned long long context_id, |
| 1596 int thread_id, | 1651 int thread_id, |
| 1597 const base::TraceTicks& timestamp, | 1652 const base::TraceTicks& timestamp, |
| 1598 unsigned int flags, | 1653 unsigned int flags, |
| 1654 unsigned long long bind_id, |
| 1599 const char* arg1_name, | 1655 const char* arg1_name, |
| 1600 const ARG1_TYPE& arg1_val, | 1656 const ARG1_TYPE& arg1_val, |
| 1601 const char* arg2_name, | 1657 const char* arg2_name, |
| 1602 const ARG2_TYPE& arg2_val) { | 1658 const ARG2_TYPE& arg2_val) { |
| 1603 const int num_args = 2; | 1659 const int num_args = 2; |
| 1604 const char* arg_names[2] = { arg1_name, arg2_name }; | 1660 const char* arg_names[2] = { arg1_name, arg2_name }; |
| 1605 unsigned char arg_types[2]; | 1661 unsigned char arg_types[2]; |
| 1606 unsigned long long arg_values[2]; | 1662 unsigned long long arg_values[2]; |
| 1607 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); | 1663 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); |
| 1608 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); | 1664 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); |
| 1609 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1665 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1610 phase, category_group_enabled, name, id, context_id, thread_id, | 1666 phase, category_group_enabled, name, id, context_id, bind_id, thread_id, |
| 1611 timestamp, num_args, arg_names, arg_types, arg_values, NULL, flags); | 1667 timestamp, num_args, arg_names, arg_types, arg_values, NULL, flags); |
| 1612 } | 1668 } |
| 1613 | 1669 |
| 1614 template<class ARG1_TYPE, class ARG2_TYPE> | 1670 template <class ARG1_TYPE, class ARG2_TYPE> |
| 1615 static inline base::trace_event::TraceEventHandle AddTraceEvent( | 1671 static inline base::trace_event::TraceEventHandle AddTraceEvent( |
| 1616 char phase, | 1672 char phase, |
| 1617 const unsigned char* category_group_enabled, | 1673 const unsigned char* category_group_enabled, |
| 1618 const char* name, | 1674 const char* name, |
| 1619 unsigned long long id, | 1675 unsigned long long id, |
| 1620 unsigned int flags, | 1676 unsigned int flags, |
| 1677 unsigned long long bind_id, |
| 1621 const char* arg1_name, | 1678 const char* arg1_name, |
| 1622 const ARG1_TYPE& arg1_val, | 1679 const ARG1_TYPE& arg1_val, |
| 1623 const char* arg2_name, | 1680 const char* arg2_name, |
| 1624 const ARG2_TYPE& arg2_val) { | 1681 const ARG2_TYPE& arg2_val) { |
| 1625 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1682 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
| 1626 base::TraceTicks now = base::TraceTicks::Now(); | 1683 base::TraceTicks now = base::TraceTicks::Now(); |
| 1627 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1684 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, |
| 1628 name, id, kNoId, thread_id, now, | 1685 name, id, kNoId, thread_id, now, |
| 1629 flags, arg1_name, arg1_val, | 1686 flags, bind_id, |
| 1687 arg1_name, arg1_val, |
| 1630 arg2_name, arg2_val); | 1688 arg2_name, arg2_val); |
| 1631 } | 1689 } |
| 1632 | 1690 |
| 1633 // Used by TRACE_EVENTx macros. Do not use directly. | 1691 // Used by TRACE_EVENTx macros. Do not use directly. |
| 1634 class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer { | 1692 class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer { |
| 1635 public: | 1693 public: |
| 1636 // Note: members of data_ intentionally left uninitialized. See Initialize. | 1694 // Note: members of data_ intentionally left uninitialized. See Initialize. |
| 1637 ScopedTracer() : p_data_(NULL) {} | 1695 ScopedTracer() : p_data_(NULL) {} |
| 1638 | 1696 |
| 1639 ~ScopedTracer() { | 1697 ~ScopedTracer() { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1746 const char* name_; | 1804 const char* name_; |
| 1747 IDType id_; | 1805 IDType id_; |
| 1748 | 1806 |
| 1749 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1807 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
| 1750 }; | 1808 }; |
| 1751 | 1809 |
| 1752 } // namespace trace_event | 1810 } // namespace trace_event |
| 1753 } // namespace base | 1811 } // namespace base |
| 1754 | 1812 |
| 1755 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 1813 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
| OLD | NEW |