| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // This will mark the trace event as disabled by default. The user will need | 196 // This will mark the trace event as disabled by default. The user will need |
| 197 // to explicitly enable the event. | 197 // to explicitly enable the event. |
| 198 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name | 198 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name |
| 199 | 199 |
| 200 // Records a pair of begin and end events called "name" for the current | 200 // Records a pair of begin and end events called "name" for the current |
| 201 // scope, with 0, 1 or 2 associated arguments. If the category is not | 201 // scope, with 0, 1 or 2 associated arguments. If the category is not |
| 202 // enabled, then this does nothing. | 202 // enabled, then this does nothing. |
| 203 // - category and name strings must have application lifetime (statics or | 203 // - category and name strings must have application lifetime (statics or |
| 204 // literals). They may not include " chars. | 204 // literals). They may not include " chars. |
| 205 #define TRACE_EVENT0(category_group, name) \ | 205 #define TRACE_EVENT0(category_group, name) \ |
| 206 INTERNAL_TRACE_MEMORY(category_group, name) \ | |
| 207 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name) | 206 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name) |
| 208 #define TRACE_EVENT_WITH_FLOW0(category_group, name, bind_id, flow_flags) \ | 207 #define TRACE_EVENT_WITH_FLOW0(category_group, name, bind_id, flow_flags) \ |
| 209 INTERNAL_TRACE_MEMORY(category_group, name) \ | |
| 210 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \ | 208 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \ |
| 211 flow_flags) | 209 flow_flags) |
| 212 #define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ | 210 #define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ |
| 213 INTERNAL_TRACE_MEMORY(category_group, name) \ | |
| 214 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val) | 211 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val) |
| 215 #define TRACE_EVENT_WITH_FLOW1(category_group, name, bind_id, flow_flags, \ | 212 #define TRACE_EVENT_WITH_FLOW1(category_group, name, bind_id, flow_flags, \ |
| 216 arg1_name, arg1_val) \ | 213 arg1_name, arg1_val) \ |
| 217 INTERNAL_TRACE_MEMORY(category_group, name) \ | |
| 218 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \ | 214 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \ |
| 219 flow_flags, arg1_name, arg1_val) | 215 flow_flags, arg1_name, arg1_val) |
| 220 #define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, \ | 216 #define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, \ |
| 221 arg2_val) \ | 217 arg2_val) \ |
| 222 INTERNAL_TRACE_MEMORY(category_group, name) \ | |
| 223 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val, \ | 218 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val, \ |
| 224 arg2_name, arg2_val) | 219 arg2_name, arg2_val) |
| 225 #define TRACE_EVENT_WITH_FLOW2(category_group, name, bind_id, flow_flags, \ | 220 #define TRACE_EVENT_WITH_FLOW2(category_group, name, bind_id, flow_flags, \ |
| 226 arg1_name, arg1_val, arg2_name, arg2_val) \ | 221 arg1_name, arg1_val, arg2_name, arg2_val) \ |
| 227 INTERNAL_TRACE_MEMORY(category_group, name) \ | |
| 228 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \ | 222 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, bind_id, \ |
| 229 flow_flags, arg1_name, arg1_val, \ | 223 flow_flags, arg1_name, arg1_val, \ |
| 230 arg2_name, arg2_val) | 224 arg2_name, arg2_val) |
| 231 | 225 |
| 232 // Records events like TRACE_EVENT2 but uses |memory_tag| for memory tracing. | |
| 233 // Use this where |name| is too generic to accurately aggregate allocations. | |
| 234 #define TRACE_EVENT_WITH_MEMORY_TAG2(category, name, memory_tag, arg1_name, \ | |
| 235 arg1_val, arg2_name, arg2_val) \ | |
| 236 INTERNAL_TRACE_MEMORY(category, memory_tag) \ | |
| 237 INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, arg1_name, arg1_val, \ | |
| 238 arg2_name, arg2_val) | |
| 239 | |
| 240 // UNSHIPPED_TRACE_EVENT* are like TRACE_EVENT* except that they are not | 226 // UNSHIPPED_TRACE_EVENT* are like TRACE_EVENT* except that they are not |
| 241 // included in official builds. | 227 // included in official builds. |
| 242 | 228 |
| 243 #if OFFICIAL_BUILD | 229 #if OFFICIAL_BUILD |
| 244 #undef TRACING_IS_OFFICIAL_BUILD | 230 #undef TRACING_IS_OFFICIAL_BUILD |
| 245 #define TRACING_IS_OFFICIAL_BUILD 1 | 231 #define TRACING_IS_OFFICIAL_BUILD 1 |
| 246 #elif !defined(TRACING_IS_OFFICIAL_BUILD) | 232 #elif !defined(TRACING_IS_OFFICIAL_BUILD) |
| 247 #define TRACING_IS_OFFICIAL_BUILD 0 | 233 #define TRACING_IS_OFFICIAL_BUILD 0 |
| 248 #endif | 234 #endif |
| 249 | 235 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 arg1_val) \ | 289 arg1_val) \ |
| 304 INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \ | 290 INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \ |
| 305 TRACE_EVENT_FLAG_COPY | scope, arg1_name, arg1_val) | 291 TRACE_EVENT_FLAG_COPY | scope, arg1_name, arg1_val) |
| 306 #define TRACE_EVENT_COPY_INSTANT2(category_group, name, scope, arg1_name, \ | 292 #define TRACE_EVENT_COPY_INSTANT2(category_group, name, scope, arg1_name, \ |
| 307 arg1_val, arg2_name, arg2_val) \ | 293 arg1_val, arg2_name, arg2_val) \ |
| 308 INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \ | 294 INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category_group, name, \ |
| 309 TRACE_EVENT_FLAG_COPY | scope, arg1_name, arg1_val, \ | 295 TRACE_EVENT_FLAG_COPY | scope, arg1_name, arg1_val, \ |
| 310 arg2_name, arg2_val) | 296 arg2_name, arg2_val) |
| 311 | 297 |
| 312 #define TRACE_EVENT_INSTANT_WITH_TIMESTAMP0(category_group, name, scope, \ | 298 #define TRACE_EVENT_INSTANT_WITH_TIMESTAMP0(category_group, name, scope, \ |
| 313 timestamp) \ | 299 timestamp) \ |
| 314 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ | 300 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
| 315 TRACE_EVENT_PHASE_INSTANT, category_group, name, 0, 0, timestamp, \ | 301 TRACE_EVENT_PHASE_INSTANT, category_group, name, 0, 0, timestamp, \ |
| 316 TRACE_EVENT_FLAG_NONE | scope) | 302 TRACE_EVENT_FLAG_NONE | scope) |
| 317 | 303 |
| 318 // Syntactic sugars for the sampling tracing in the main thread. | 304 // Syntactic sugars for the sampling tracing in the main thread. |
| 319 #define TRACE_EVENT_SCOPED_SAMPLING_STATE(category, name) \ | 305 #define TRACE_EVENT_SCOPED_SAMPLING_STATE(category, name) \ |
| 320 TRACE_EVENT_SCOPED_SAMPLING_STATE_FOR_BUCKET(0, category, name) | 306 TRACE_EVENT_SCOPED_SAMPLING_STATE_FOR_BUCKET(0, category, name) |
| 321 #define TRACE_EVENT_GET_SAMPLING_STATE() \ | 307 #define TRACE_EVENT_GET_SAMPLING_STATE() \ |
| 322 TRACE_EVENT_GET_SAMPLING_STATE_FOR_BUCKET(0) | 308 TRACE_EVENT_GET_SAMPLING_STATE_FOR_BUCKET(0) |
| 323 #define TRACE_EVENT_SET_SAMPLING_STATE(category, name) \ | 309 #define TRACE_EVENT_SET_SAMPLING_STATE(category, name) \ |
| 324 TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(0, category, name) | 310 TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(0, category, name) |
| 325 #define TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(categoryAndName) \ | 311 #define TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(categoryAndName) \ |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 | 1031 |
| 1046 // Enum reflecting the scope of an INSTANT event. Must fit within | 1032 // Enum reflecting the scope of an INSTANT event. Must fit within |
| 1047 // TRACE_EVENT_FLAG_SCOPE_MASK. | 1033 // TRACE_EVENT_FLAG_SCOPE_MASK. |
| 1048 #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3)) | 1034 #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3)) |
| 1049 #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3)) | 1035 #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3)) |
| 1050 #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3)) | 1036 #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3)) |
| 1051 | 1037 |
| 1052 #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g') | 1038 #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g') |
| 1053 #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p') | 1039 #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p') |
| 1054 #define TRACE_EVENT_SCOPE_NAME_THREAD ('t') | 1040 #define TRACE_EVENT_SCOPE_NAME_THREAD ('t') |
| OLD | NEW |