| 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) |
| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \ | 1067 #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \ |
| 1044 static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \ | 1068 static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \ |
| 1045 const unsigned char* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \ | 1069 const unsigned char* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \ |
| 1046 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES(category_group, \ | 1070 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES(category_group, \ |
| 1047 INTERNAL_TRACE_EVENT_UID(atomic), \ | 1071 INTERNAL_TRACE_EVENT_UID(atomic), \ |
| 1048 INTERNAL_TRACE_EVENT_UID(category_group_enabled)); | 1072 INTERNAL_TRACE_EVENT_UID(category_group_enabled)); |
| 1049 | 1073 |
| 1050 // Implementation detail: internal macro to create static category and add | 1074 // Implementation detail: internal macro to create static category and add |
| 1051 // event if the category is enabled. | 1075 // event if the category is enabled. |
| 1052 #define INTERNAL_TRACE_EVENT_ADD(phase, category_group, name, flags, ...) \ | 1076 #define INTERNAL_TRACE_EVENT_ADD(phase, category_group, name, flags, ...) \ |
| 1053 do { \ | 1077 do { \ |
| 1054 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 1078 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
| 1055 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 1079 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
| 1056 trace_event_internal::AddTraceEvent( \ | 1080 trace_event_internal::AddTraceEvent( \ |
| 1057 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ | 1081 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
| 1058 trace_event_internal::kNoEventId, flags, ##__VA_ARGS__); \ | 1082 trace_event_internal::kNoId, flags, \ |
| 1059 } \ | 1083 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
| 1060 } while (0) | 1084 } \ |
| 1085 } while (0) |
| 1061 | 1086 |
| 1062 // Implementation detail: internal macro to create static category and add begin | 1087 // Implementation detail: internal macro to create static category and add begin |
| 1063 // event if the category is enabled. Also adds the end event when the scope | 1088 // event if the category is enabled. Also adds the end event when the scope |
| 1064 // ends. | 1089 // ends. |
| 1065 #define INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, ...) \ | 1090 #define INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, ...) \ |
| 1066 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 1091 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
| 1067 trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ | 1092 trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ |
| 1068 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 1093 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
| 1069 base::trace_event::TraceEventHandle h = \ | 1094 base::trace_event::TraceEventHandle h = \ |
| 1070 trace_event_internal::AddTraceEvent( \ | 1095 trace_event_internal::AddTraceEvent( \ |
| 1071 TRACE_EVENT_PHASE_COMPLETE, \ | 1096 TRACE_EVENT_PHASE_COMPLETE, \ |
| 1072 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ | 1097 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
| 1073 trace_event_internal::kNoEventId, TRACE_EVENT_FLAG_NONE, \ | 1098 trace_event_internal::kNoId, TRACE_EVENT_FLAG_NONE, \ |
| 1074 ##__VA_ARGS__); \ | 1099 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
| 1075 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \ | 1100 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \ |
| 1076 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ | 1101 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ |
| 1077 } | 1102 } |
| 1103 |
| 1104 #define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW( \ |
| 1105 category_group, name, bind_id, flow_direction, ...) \ |
| 1106 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
| 1107 trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ |
| 1108 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
| 1109 unsigned int trace_event_flags = flow_direction; \ |
| 1110 trace_event_internal::TraceID trace_event_bind_id(bind_id, \ |
| 1111 &trace_event_flags); \ |
| 1112 base::trace_event::TraceEventHandle h = \ |
| 1113 trace_event_internal::AddTraceEvent( \ |
| 1114 TRACE_EVENT_PHASE_COMPLETE, \ |
| 1115 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
| 1116 trace_event_internal::kNoId, trace_event_flags, \ |
| 1117 trace_event_bind_id.data(), ##__VA_ARGS__); \ |
| 1118 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \ |
| 1119 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ |
| 1120 } |
| 1078 | 1121 |
| 1079 // Implementation detail: internal macro to create static category and add | 1122 // Implementation detail: internal macro to create static category and add |
| 1080 // event if the category is enabled. | 1123 // event if the category is enabled. |
| 1081 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category_group, name, id, \ | 1124 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category_group, name, id, \ |
| 1082 flags, ...) \ | 1125 flags, ...) \ |
| 1083 do { \ | 1126 do { \ |
| 1084 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 1127 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
| 1085 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 1128 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
| 1086 unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ | 1129 unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ |
| 1087 trace_event_internal::TraceID trace_event_trace_id( \ | 1130 trace_event_internal::TraceID trace_event_trace_id(id, \ |
| 1088 id, &trace_event_flags); \ | 1131 &trace_event_flags); \ |
| 1089 trace_event_internal::AddTraceEvent( \ | 1132 trace_event_internal::AddTraceEvent( \ |
| 1090 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ | 1133 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
| 1091 name, trace_event_trace_id.data(), trace_event_flags, \ | 1134 trace_event_trace_id.data(), trace_event_flags, \ |
| 1092 ##__VA_ARGS__); \ | 1135 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
| 1093 } \ | 1136 } \ |
| 1094 } while (0) | 1137 } while (0) |
| 1095 | 1138 |
| 1096 // Implementation detail: internal macro to create static category and add | 1139 // Implementation detail: internal macro to create static category and add |
| 1097 // event if the category is enabled. | 1140 // event if the category is enabled. |
| 1098 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP(phase, \ | 1141 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
| 1099 category_group, name, id, thread_id, timestamp, flags, ...) \ | 1142 phase, category_group, name, id, thread_id, timestamp, flags, ...) \ |
| 1100 do { \ | 1143 do { \ |
| 1101 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 1144 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
| 1102 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 1145 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
| 1103 unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ | 1146 unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ |
| 1104 trace_event_internal::TraceID trace_event_trace_id( \ | 1147 trace_event_internal::TraceID trace_event_trace_id(id, \ |
| 1105 id, &trace_event_flags); \ | 1148 &trace_event_flags); \ |
| 1106 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ | 1149 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ |
| 1107 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ | 1150 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
| 1108 name, trace_event_trace_id.data(), \ | 1151 trace_event_trace_id.data(), thread_id, \ |
| 1109 thread_id, base::TraceTicks::FromInternalValue(timestamp), \ | 1152 base::TraceTicks::FromInternalValue(timestamp), \ |
| 1110 trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ | 1153 trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ |
| 1111 ##__VA_ARGS__); \ | 1154 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
| 1112 } \ | 1155 } \ |
| 1113 } while (0) | 1156 } while (0) |
| 1114 | 1157 |
| 1115 // Notes regarding the following definitions: | 1158 // Notes regarding the following definitions: |
| 1116 // New values can be added and propagated to third party libraries, but existing | 1159 // New values can be added and propagated to third party libraries, but existing |
| 1117 // definitions must never be changed, because third party libraries may use old | 1160 // definitions must never be changed, because third party libraries may use old |
| 1118 // definitions. | 1161 // definitions. |
| 1119 | 1162 |
| 1120 // Phase indicates the nature of an event entry. E.g. part of a begin/end pair. | 1163 // Phase indicates the nature of an event entry. E.g. part of a begin/end pair. |
| 1121 #define TRACE_EVENT_PHASE_BEGIN ('B') | 1164 #define TRACE_EVENT_PHASE_BEGIN ('B') |
| 1122 #define TRACE_EVENT_PHASE_END ('E') | 1165 #define TRACE_EVENT_PHASE_END ('E') |
| 1123 #define TRACE_EVENT_PHASE_COMPLETE ('X') | 1166 #define TRACE_EVENT_PHASE_COMPLETE ('X') |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1143 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. | 1186 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. |
| 1144 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned int>(0)) | 1187 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned int>(0)) |
| 1145 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned int>(1 << 0)) | 1188 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned int>(1 << 0)) |
| 1146 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned int>(1 << 1)) | 1189 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned int>(1 << 1)) |
| 1147 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2)) | 1190 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2)) |
| 1148 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3)) | 1191 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3)) |
| 1149 #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4)) | 1192 #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4)) |
| 1150 #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5)) | 1193 #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5)) |
| 1151 #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6)) | 1194 #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6)) |
| 1152 #define TRACE_EVENT_FLAG_BIND_TO_ENCLOSING (static_cast<unsigned int>(1 << 7)) | 1195 #define TRACE_EVENT_FLAG_BIND_TO_ENCLOSING (static_cast<unsigned int>(1 << 7)) |
| 1196 #define TRACE_EVENT_FLAG_FLOW_IN (static_cast<unsigned int>(1 << 8)) |
| 1197 #define TRACE_EVENT_FLAG_FLOW_OUT (static_cast<unsigned int>(1 << 9)) |
| 1153 | 1198 |
| 1154 #define TRACE_EVENT_FLAG_SCOPE_MASK (static_cast<unsigned int>( \ | 1199 #define TRACE_EVENT_FLAG_SCOPE_MASK (static_cast<unsigned int>( \ |
| 1155 TRACE_EVENT_FLAG_SCOPE_OFFSET | TRACE_EVENT_FLAG_SCOPE_EXTRA)) | 1200 TRACE_EVENT_FLAG_SCOPE_OFFSET | TRACE_EVENT_FLAG_SCOPE_EXTRA)) |
| 1156 | 1201 |
| 1157 // Type values for identifying types in the TraceValue union. | 1202 // Type values for identifying types in the TraceValue union. |
| 1158 #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1)) | 1203 #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1)) |
| 1159 #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2)) | 1204 #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2)) |
| 1160 #define TRACE_VALUE_TYPE_INT (static_cast<unsigned char>(3)) | 1205 #define TRACE_VALUE_TYPE_INT (static_cast<unsigned char>(3)) |
| 1161 #define TRACE_VALUE_TYPE_DOUBLE (static_cast<unsigned char>(4)) | 1206 #define TRACE_VALUE_TYPE_DOUBLE (static_cast<unsigned char>(4)) |
| 1162 #define TRACE_VALUE_TYPE_POINTER (static_cast<unsigned char>(5)) | 1207 #define TRACE_VALUE_TYPE_POINTER (static_cast<unsigned char>(5)) |
| 1163 #define TRACE_VALUE_TYPE_STRING (static_cast<unsigned char>(6)) | 1208 #define TRACE_VALUE_TYPE_STRING (static_cast<unsigned char>(6)) |
| 1164 #define TRACE_VALUE_TYPE_COPY_STRING (static_cast<unsigned char>(7)) | 1209 #define TRACE_VALUE_TYPE_COPY_STRING (static_cast<unsigned char>(7)) |
| 1165 #define TRACE_VALUE_TYPE_CONVERTABLE (static_cast<unsigned char>(8)) | 1210 #define TRACE_VALUE_TYPE_CONVERTABLE (static_cast<unsigned char>(8)) |
| 1166 | 1211 |
| 1167 // Enum reflecting the scope of an INSTANT event. Must fit within | 1212 // Enum reflecting the scope of an INSTANT event. Must fit within |
| 1168 // TRACE_EVENT_FLAG_SCOPE_MASK. | 1213 // TRACE_EVENT_FLAG_SCOPE_MASK. |
| 1169 #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3)) | 1214 #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3)) |
| 1170 #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3)) | 1215 #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3)) |
| 1171 #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3)) | 1216 #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3)) |
| 1172 | 1217 |
| 1173 #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g') | 1218 #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g') |
| 1174 #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p') | 1219 #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p') |
| 1175 #define TRACE_EVENT_SCOPE_NAME_THREAD ('t') | 1220 #define TRACE_EVENT_SCOPE_NAME_THREAD ('t') |
| 1176 | 1221 |
| 1177 namespace trace_event_internal { | 1222 namespace trace_event_internal { |
| 1178 | 1223 |
| 1179 // Specify these values when the corresponding argument of AddTraceEvent is not | 1224 // Specify these values when the corresponding argument of AddTraceEvent is not |
| 1180 // used. | 1225 // used. |
| 1181 const int kZeroNumArgs = 0; | 1226 const int kZeroNumArgs = 0; |
| 1182 const unsigned long long kNoEventId = 0; | 1227 const unsigned long long kNoId = 0; |
| 1183 | 1228 |
| 1184 // TraceID encapsulates an ID that can either be an integer or pointer. Pointers | 1229 // TraceID encapsulates an ID that can either be an integer or pointer. Pointers |
| 1185 // are by default mangled with the Process ID so that they are unlikely to | 1230 // are by default mangled with the Process ID so that they are unlikely to |
| 1186 // collide when the same pointer is used on different processes. | 1231 // collide when the same pointer is used on different processes. |
| 1187 class TraceID { | 1232 class TraceID { |
| 1188 public: | 1233 public: |
| 1189 class DontMangle { | 1234 class DontMangle { |
| 1190 public: | 1235 public: |
| 1191 explicit DontMangle(const void* id) | 1236 explicit DontMangle(const void* id) |
| 1192 : data_(static_cast<unsigned long long>( | 1237 : data_(static_cast<unsigned long long>( |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 | 1431 |
| 1387 static inline base::trace_event::TraceEventHandle | 1432 static inline base::trace_event::TraceEventHandle |
| 1388 AddTraceEventWithThreadIdAndTimestamp( | 1433 AddTraceEventWithThreadIdAndTimestamp( |
| 1389 char phase, | 1434 char phase, |
| 1390 const unsigned char* category_group_enabled, | 1435 const unsigned char* category_group_enabled, |
| 1391 const char* name, | 1436 const char* name, |
| 1392 unsigned long long id, | 1437 unsigned long long id, |
| 1393 int thread_id, | 1438 int thread_id, |
| 1394 const base::TraceTicks& timestamp, | 1439 const base::TraceTicks& timestamp, |
| 1395 unsigned int flags, | 1440 unsigned int flags, |
| 1441 unsigned long long bind_id, |
| 1396 const char* arg1_name, | 1442 const char* arg1_name, |
| 1397 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& | 1443 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& |
| 1398 arg1_val) { | 1444 arg1_val) { |
| 1399 const int num_args = 1; | 1445 const int num_args = 1; |
| 1400 unsigned char arg_types[1] = { TRACE_VALUE_TYPE_CONVERTABLE }; | 1446 unsigned char arg_types[1] = { TRACE_VALUE_TYPE_CONVERTABLE }; |
| 1401 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1447 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1402 phase, category_group_enabled, name, id, thread_id, timestamp, | 1448 phase, category_group_enabled, name, id, thread_id, bind_id, timestamp, nu
m_args, |
| 1403 num_args, &arg1_name, arg_types, NULL, &arg1_val, flags); | 1449 &arg1_name, arg_types, NULL, &arg1_val, flags); |
| 1404 } | 1450 } |
| 1405 | 1451 |
| 1406 template<class ARG1_TYPE> | 1452 template <class ARG1_TYPE> |
| 1407 static inline base::trace_event::TraceEventHandle | 1453 static inline base::trace_event::TraceEventHandle |
| 1408 AddTraceEventWithThreadIdAndTimestamp( | 1454 AddTraceEventWithThreadIdAndTimestamp( |
| 1409 char phase, | 1455 char phase, |
| 1410 const unsigned char* category_group_enabled, | 1456 const unsigned char* category_group_enabled, |
| 1411 const char* name, | 1457 const char* name, |
| 1412 unsigned long long id, | 1458 unsigned long long 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 ARG1_TYPE& arg1_val, | 1464 const ARG1_TYPE& arg1_val, |
| 1418 const char* arg2_name, | 1465 const char* arg2_name, |
| 1419 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& | 1466 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& |
| 1420 arg2_val) { | 1467 arg2_val) { |
| 1421 const int num_args = 2; | 1468 const int num_args = 2; |
| 1422 const char* arg_names[2] = { arg1_name, arg2_name }; | 1469 const char* arg_names[2] = { arg1_name, arg2_name }; |
| 1423 | 1470 |
| 1424 unsigned char arg_types[2]; | 1471 unsigned char arg_types[2]; |
| 1425 unsigned long long arg_values[2]; | 1472 unsigned long long arg_values[2]; |
| 1426 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); | 1473 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); |
| 1427 arg_types[1] = TRACE_VALUE_TYPE_CONVERTABLE; | 1474 arg_types[1] = TRACE_VALUE_TYPE_CONVERTABLE; |
| 1428 | 1475 |
| 1429 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 1476 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 1430 convertable_values[2]; | 1477 convertable_values[2]; |
| 1431 convertable_values[1] = arg2_val; | 1478 convertable_values[1] = arg2_val; |
| 1432 | 1479 |
| 1433 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1480 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1434 phase, category_group_enabled, name, id, thread_id, timestamp, | 1481 phase, category_group_enabled, name, id, thread_id, bind_id, timestamp, nu
m_args, |
| 1435 num_args, arg_names, arg_types, arg_values, convertable_values, flags); | 1482 arg_names, arg_types, arg_values, convertable_values, flags); |
| 1436 } | 1483 } |
| 1437 | 1484 |
| 1438 template<class ARG2_TYPE> | 1485 template <class ARG2_TYPE> |
| 1439 static inline base::trace_event::TraceEventHandle | 1486 static inline base::trace_event::TraceEventHandle |
| 1440 AddTraceEventWithThreadIdAndTimestamp( | 1487 AddTraceEventWithThreadIdAndTimestamp( |
| 1441 char phase, | 1488 char phase, |
| 1442 const unsigned char* category_group_enabled, | 1489 const unsigned char* category_group_enabled, |
| 1443 const char* name, | 1490 const char* name, |
| 1444 unsigned long long id, | 1491 unsigned long long id, |
| 1445 int thread_id, | 1492 int thread_id, |
| 1446 const base::TraceTicks& timestamp, | 1493 const base::TraceTicks& timestamp, |
| 1447 unsigned int flags, | 1494 unsigned int flags, |
| 1495 unsigned long long bind_id, |
| 1448 const char* arg1_name, | 1496 const char* arg1_name, |
| 1449 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val, | 1497 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val, |
| 1450 const char* arg2_name, | 1498 const char* arg2_name, |
| 1451 const ARG2_TYPE& arg2_val) { | 1499 const ARG2_TYPE& arg2_val) { |
| 1452 const int num_args = 2; | 1500 const int num_args = 2; |
| 1453 const char* arg_names[2] = { arg1_name, arg2_name }; | 1501 const char* arg_names[2] = { arg1_name, arg2_name }; |
| 1454 | 1502 |
| 1455 unsigned char arg_types[2]; | 1503 unsigned char arg_types[2]; |
| 1456 unsigned long long arg_values[2]; | 1504 unsigned long long arg_values[2]; |
| 1457 arg_types[0] = TRACE_VALUE_TYPE_CONVERTABLE; | 1505 arg_types[0] = TRACE_VALUE_TYPE_CONVERTABLE; |
| 1458 arg_values[0] = 0; | 1506 arg_values[0] = 0; |
| 1459 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); | 1507 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); |
| 1460 | 1508 |
| 1461 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 1509 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 1462 convertable_values[2]; | 1510 convertable_values[2]; |
| 1463 convertable_values[0] = arg1_val; | 1511 convertable_values[0] = arg1_val; |
| 1464 | 1512 |
| 1465 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1513 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1466 phase, category_group_enabled, name, id, thread_id, timestamp, | 1514 phase, category_group_enabled, name, id, thread_id, bind_id, timestamp, nu
m_args, |
| 1467 num_args, arg_names, arg_types, arg_values, convertable_values, flags); | 1515 arg_names, arg_types, arg_values, convertable_values, flags); |
| 1468 } | 1516 } |
| 1469 | 1517 |
| 1470 static inline base::trace_event::TraceEventHandle | 1518 static inline base::trace_event::TraceEventHandle |
| 1471 AddTraceEventWithThreadIdAndTimestamp( | 1519 AddTraceEventWithThreadIdAndTimestamp( |
| 1472 char phase, | 1520 char phase, |
| 1473 const unsigned char* category_group_enabled, | 1521 const unsigned char* category_group_enabled, |
| 1474 const char* name, | 1522 const char* name, |
| 1475 unsigned long long id, | 1523 unsigned long long id, |
| 1476 int thread_id, | 1524 int thread_id, |
| 1477 const base::TraceTicks& timestamp, | 1525 const base::TraceTicks& timestamp, |
| 1478 unsigned int flags, | 1526 unsigned int flags, |
| 1527 unsigned long long bind_id, |
| 1479 const char* arg1_name, | 1528 const char* arg1_name, |
| 1480 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val, | 1529 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val, |
| 1481 const char* arg2_name, | 1530 const char* arg2_name, |
| 1482 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& | 1531 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& |
| 1483 arg2_val) { | 1532 arg2_val) { |
| 1484 const int num_args = 2; | 1533 const int num_args = 2; |
| 1485 const char* arg_names[2] = { arg1_name, arg2_name }; | 1534 const char* arg_names[2] = { arg1_name, arg2_name }; |
| 1486 unsigned char arg_types[2] = | 1535 unsigned char arg_types[2] = |
| 1487 { TRACE_VALUE_TYPE_CONVERTABLE, TRACE_VALUE_TYPE_CONVERTABLE }; | 1536 { TRACE_VALUE_TYPE_CONVERTABLE, TRACE_VALUE_TYPE_CONVERTABLE }; |
| 1488 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 1537 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 1489 convertable_values[2] = {arg1_val, arg2_val}; | 1538 convertable_values[2] = {arg1_val, arg2_val}; |
| 1490 | 1539 |
| 1491 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1540 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1492 phase, category_group_enabled, name, id, thread_id, timestamp, | 1541 phase, category_group_enabled, name, id, thread_id, bind_id, timestamp, nu
m_args, |
| 1493 num_args, arg_names, arg_types, NULL, convertable_values, flags); | 1542 arg_names, arg_types, NULL, convertable_values, flags); |
| 1494 } | 1543 } |
| 1495 | 1544 |
| 1496 static inline base::trace_event::TraceEventHandle | 1545 static inline base::trace_event::TraceEventHandle |
| 1497 AddTraceEventWithThreadIdAndTimestamp( | 1546 AddTraceEventWithThreadIdAndTimestamp( |
| 1498 char phase, | 1547 char phase, |
| 1499 const unsigned char* category_group_enabled, | 1548 const unsigned char* category_group_enabled, |
| 1500 const char* name, | 1549 const char* name, |
| 1501 unsigned long long id, | 1550 unsigned long long id, |
| 1502 int thread_id, | 1551 int thread_id, |
| 1503 const base::TraceTicks& timestamp, | 1552 const base::TraceTicks& timestamp, |
| 1504 unsigned int flags) { | 1553 unsigned int flags, |
| 1554 unsigned long long bind_id) { |
| 1505 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1555 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1506 phase, category_group_enabled, name, id, thread_id, timestamp, | 1556 phase, category_group_enabled, name, id, thread_id, bind_id, timestamp, |
| 1507 kZeroNumArgs, NULL, NULL, NULL, NULL, flags); | 1557 kZeroNumArgs, NULL, NULL, NULL, NULL, flags); |
| 1508 } | 1558 } |
| 1509 | 1559 |
| 1510 static inline base::trace_event::TraceEventHandle AddTraceEvent( | 1560 static inline base::trace_event::TraceEventHandle AddTraceEvent( |
| 1511 char phase, | 1561 char phase, |
| 1512 const unsigned char* category_group_enabled, | 1562 const unsigned char* category_group_enabled, |
| 1513 const char* name, | 1563 const char* name, |
| 1514 unsigned long long id, | 1564 unsigned long long id, |
| 1515 unsigned int flags) { | 1565 unsigned int flags, |
| 1566 unsigned long long bind_id) { |
| 1516 const int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1567 const int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
| 1517 const base::TraceTicks now = base::TraceTicks::Now(); | 1568 const base::TraceTicks now = base::TraceTicks::Now(); |
| 1518 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1569 return AddTraceEventWithThreadIdAndTimestamp( |
| 1519 name, id, thread_id, now, flags); | 1570 phase, category_group_enabled, name, id, thread_id, now, flags, bind_id); |
| 1520 } | 1571 } |
| 1521 | 1572 |
| 1522 template<class ARG1_TYPE> | 1573 template <class ARG1_TYPE> |
| 1523 static inline base::trace_event::TraceEventHandle | 1574 static inline base::trace_event::TraceEventHandle |
| 1524 AddTraceEventWithThreadIdAndTimestamp( | 1575 AddTraceEventWithThreadIdAndTimestamp( |
| 1525 char phase, | 1576 char phase, |
| 1526 const unsigned char* category_group_enabled, | 1577 const unsigned char* category_group_enabled, |
| 1527 const char* name, | 1578 const char* name, |
| 1528 unsigned long long id, | 1579 unsigned long long 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 const char* arg1_name, | 1584 const char* arg1_name, |
| 1533 const ARG1_TYPE& arg1_val) { | 1585 const ARG1_TYPE& arg1_val) { |
| 1534 const int num_args = 1; | 1586 const int num_args = 1; |
| 1535 unsigned char arg_types[1]; | 1587 unsigned char arg_types[1]; |
| 1536 unsigned long long arg_values[1]; | 1588 unsigned long long arg_values[1]; |
| 1537 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); | 1589 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); |
| 1538 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1590 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1539 phase, category_group_enabled, name, id, thread_id, timestamp, | 1591 phase, category_group_enabled, name, id, thread_id, bind_id, timestamp, nu
m_args, |
| 1540 num_args, &arg1_name, arg_types, arg_values, NULL, flags); | 1592 &arg1_name, arg_types, arg_values, NULL, flags); |
| 1541 } | 1593 } |
| 1542 | 1594 |
| 1543 template<class ARG1_TYPE> | 1595 template <class ARG1_TYPE> |
| 1544 static inline base::trace_event::TraceEventHandle AddTraceEvent( | 1596 static inline base::trace_event::TraceEventHandle AddTraceEvent( |
| 1545 char phase, | 1597 char phase, |
| 1546 const unsigned char* category_group_enabled, | 1598 const unsigned char* category_group_enabled, |
| 1547 const char* name, | 1599 const char* name, |
| 1548 unsigned long long id, | 1600 unsigned long long id, |
| 1549 unsigned int flags, | 1601 unsigned int flags, |
| 1602 unsigned long long bind_id, |
| 1550 const char* arg1_name, | 1603 const char* arg1_name, |
| 1551 const ARG1_TYPE& arg1_val) { | 1604 const ARG1_TYPE& arg1_val) { |
| 1552 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1605 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
| 1553 base::TraceTicks now = base::TraceTicks::Now(); | 1606 base::TraceTicks now = base::TraceTicks::Now(); |
| 1554 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1607 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, |
| 1555 name, id, thread_id, now, flags, | 1608 name, id, thread_id, now, flags, |
| 1556 arg1_name, arg1_val); | 1609 bind_id, arg1_name, arg1_val); |
| 1557 } | 1610 } |
| 1558 | 1611 |
| 1559 template<class ARG1_TYPE, class ARG2_TYPE> | 1612 template <class ARG1_TYPE, class ARG2_TYPE> |
| 1560 static inline base::trace_event::TraceEventHandle | 1613 static inline base::trace_event::TraceEventHandle |
| 1561 AddTraceEventWithThreadIdAndTimestamp( | 1614 AddTraceEventWithThreadIdAndTimestamp( |
| 1562 char phase, | 1615 char phase, |
| 1563 const unsigned char* category_group_enabled, | 1616 const unsigned char* category_group_enabled, |
| 1564 const char* name, | 1617 const char* name, |
| 1565 unsigned long long id, | 1618 unsigned long long id, |
| 1566 int thread_id, | 1619 int thread_id, |
| 1567 const base::TraceTicks& timestamp, | 1620 const base::TraceTicks& timestamp, |
| 1568 unsigned int flags, | 1621 unsigned int flags, |
| 1622 unsigned long long bind_id, |
| 1569 const char* arg1_name, | 1623 const char* arg1_name, |
| 1570 const ARG1_TYPE& arg1_val, | 1624 const ARG1_TYPE& arg1_val, |
| 1571 const char* arg2_name, | 1625 const char* arg2_name, |
| 1572 const ARG2_TYPE& arg2_val) { | 1626 const ARG2_TYPE& arg2_val) { |
| 1573 const int num_args = 2; | 1627 const int num_args = 2; |
| 1574 const char* arg_names[2] = { arg1_name, arg2_name }; | 1628 const char* arg_names[2] = { arg1_name, arg2_name }; |
| 1575 unsigned char arg_types[2]; | 1629 unsigned char arg_types[2]; |
| 1576 unsigned long long arg_values[2]; | 1630 unsigned long long arg_values[2]; |
| 1577 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); | 1631 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); |
| 1578 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); | 1632 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); |
| 1579 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 1633 return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 1580 phase, category_group_enabled, name, id, thread_id, timestamp, | 1634 phase, category_group_enabled, name, id, thread_id, bind_id, timestamp, nu
m_args, |
| 1581 num_args, arg_names, arg_types, arg_values, NULL, flags); | 1635 arg_names, arg_types, arg_values, NULL, flags); |
| 1582 } | 1636 } |
| 1583 | 1637 |
| 1584 template<class ARG1_TYPE, class ARG2_TYPE> | 1638 template <class ARG1_TYPE, class ARG2_TYPE> |
| 1585 static inline base::trace_event::TraceEventHandle AddTraceEvent( | 1639 static inline base::trace_event::TraceEventHandle AddTraceEvent( |
| 1586 char phase, | 1640 char phase, |
| 1587 const unsigned char* category_group_enabled, | 1641 const unsigned char* category_group_enabled, |
| 1588 const char* name, | 1642 const char* name, |
| 1589 unsigned long long id, | 1643 unsigned long long id, |
| 1590 unsigned int flags, | 1644 unsigned int flags, |
| 1645 unsigned long long bind_id, |
| 1591 const char* arg1_name, | 1646 const char* arg1_name, |
| 1592 const ARG1_TYPE& arg1_val, | 1647 const ARG1_TYPE& arg1_val, |
| 1593 const char* arg2_name, | 1648 const char* arg2_name, |
| 1594 const ARG2_TYPE& arg2_val) { | 1649 const ARG2_TYPE& arg2_val) { |
| 1595 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1650 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
| 1596 base::TraceTicks now = base::TraceTicks::Now(); | 1651 base::TraceTicks now = base::TraceTicks::Now(); |
| 1597 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1652 return AddTraceEventWithThreadIdAndTimestamp( |
| 1598 name, id, thread_id, now, flags, | 1653 phase, category_group_enabled, name, id, thread_id, now, flags, bind_id, |
| 1599 arg1_name, arg1_val, | 1654 arg1_name, arg1_val, arg2_name, arg2_val); |
| 1600 arg2_name, arg2_val); | |
| 1601 } | 1655 } |
| 1602 | 1656 |
| 1603 // Used by TRACE_EVENTx macros. Do not use directly. | 1657 // Used by TRACE_EVENTx macros. Do not use directly. |
| 1604 class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer { | 1658 class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer { |
| 1605 public: | 1659 public: |
| 1606 // Note: members of data_ intentionally left uninitialized. See Initialize. | 1660 // Note: members of data_ intentionally left uninitialized. See Initialize. |
| 1607 ScopedTracer() : p_data_(NULL) {} | 1661 ScopedTracer() : p_data_(NULL) {} |
| 1608 | 1662 |
| 1609 ~ScopedTracer() { | 1663 ~ScopedTracer() { |
| 1610 if (p_data_ && *data_.category_group_enabled) | 1664 if (p_data_ && *data_.category_group_enabled) |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1716 const char* name_; | 1770 const char* name_; |
| 1717 IDType id_; | 1771 IDType id_; |
| 1718 | 1772 |
| 1719 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1773 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
| 1720 }; | 1774 }; |
| 1721 | 1775 |
| 1722 } // namespace trace_event | 1776 } // namespace trace_event |
| 1723 } // namespace base | 1777 } // namespace base |
| 1724 | 1778 |
| 1725 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 1779 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
| OLD | NEW |