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 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_ | 5 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_ |
6 #define BASE_TRACE_EVENT_TRACE_EVENT_H_ | 6 #define BASE_TRACE_EVENT_TRACE_EVENT_H_ |
7 | 7 |
8 // This header file defines implementation details of how the trace macros in | 8 // This header file defines implementation details of how the trace macros in |
9 // trace_event_common.h collect and store trace events. Anything not | 9 // trace_event_common.h collect and store trace events. Anything not |
10 // implementation-specific should go in trace_event_common.h instead of here. | 10 // implementation-specific should go in trace_event_common.h instead of here. |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 &trace_event_flags); \ | 342 &trace_event_flags); \ |
343 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ | 343 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ |
344 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ | 344 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
345 trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ | 345 trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ |
346 thread_id, base::TimeTicks::FromInternalValue(timestamp), \ | 346 thread_id, base::TimeTicks::FromInternalValue(timestamp), \ |
347 trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ | 347 trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ |
348 trace_event_internal::kNoId, ##__VA_ARGS__); \ | 348 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
349 } \ | 349 } \ |
350 } while (0) | 350 } while (0) |
351 | 351 |
| 352 // The trace ID and bind ID will never be mangled by this macro. |
| 353 #define INTERNAL_TRACE_EVENT_ADD_BIND_IDS(category_group, name, id, bind_id, \ |
| 354 ...) \ |
| 355 do { \ |
| 356 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
| 357 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
| 358 trace_event_internal::TraceID::DontMangle source_id(id); \ |
| 359 trace_event_internal::TraceID::DontMangle target_id(bind_id); \ |
| 360 if (target_id.scope() == trace_event_internal::kGlobalScope) { \ |
| 361 trace_event_internal::AddTraceEvent( \ |
| 362 TRACE_EVENT_PHASE_BIND_IDS, \ |
| 363 INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ |
| 364 name, source_id.scope(), source_id.raw_id(), \ |
| 365 TRACE_EVENT_FLAG_HAS_ID, target_id.raw_id(), ##__VA_ARGS__); \ |
| 366 } else { \ |
| 367 trace_event_internal::AddTraceEvent( \ |
| 368 TRACE_EVENT_PHASE_BIND_IDS, \ |
| 369 INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ |
| 370 name, source_id.scope(), source_id.raw_id(), \ |
| 371 TRACE_EVENT_FLAG_HAS_ID, target_id.raw_id(), \ |
| 372 "bind_scope", target_id.scope(), ##__VA_ARGS__); \ |
| 373 } \ |
| 374 } \ |
| 375 } while (0) |
| 376 |
352 // Implementation detail: internal macro to create static category and add | 377 // Implementation detail: internal macro to create static category and add |
353 // metadata event if the category is enabled. | 378 // metadata event if the category is enabled. |
354 #define INTERNAL_TRACE_EVENT_METADATA_ADD(category_group, name, ...) \ | 379 #define INTERNAL_TRACE_EVENT_METADATA_ADD(category_group, name, ...) \ |
355 do { \ | 380 do { \ |
356 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 381 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
357 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 382 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
358 TRACE_EVENT_API_ADD_METADATA_EVENT( \ | 383 TRACE_EVENT_API_ADD_METADATA_EVENT( \ |
359 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ | 384 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
360 ##__VA_ARGS__); \ | 385 ##__VA_ARGS__); \ |
361 } \ | 386 } \ |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 const char* name_; | 1108 const char* name_; |
1084 IDType id_; | 1109 IDType id_; |
1085 | 1110 |
1086 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1111 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
1087 }; | 1112 }; |
1088 | 1113 |
1089 } // namespace trace_event | 1114 } // namespace trace_event |
1090 } // namespace base | 1115 } // namespace base |
1091 | 1116 |
1092 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 1117 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
OLD | NEW |