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_macros_common.h instead of here. | 10 // implementation-specific should go in trace_macros_common.h instead of here. |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 id, &trace_event_flags); \ | 295 id, &trace_event_flags); \ |
296 trace_event_internal::AddTraceEvent( \ | 296 trace_event_internal::AddTraceEvent( \ |
297 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ | 297 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ |
298 name, trace_event_trace_id.data(), trace_event_flags, \ | 298 name, trace_event_trace_id.data(), trace_event_flags, \ |
299 trace_event_internal::kNoId, ##__VA_ARGS__); \ | 299 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
300 } \ | 300 } \ |
301 } while (0) | 301 } while (0) |
302 | 302 |
303 // Implementation detail: internal macro to create static category and add | 303 // Implementation detail: internal macro to create static category and add |
304 // event if the category is enabled. | 304 // event if the category is enabled. |
| 305 #define INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP(phase, category_group, name, \ |
| 306 timestamp, flags, ...) \ |
| 307 do { \ |
| 308 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
| 309 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
| 310 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ |
| 311 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
| 312 trace_event_internal::kNoId, trace_event_internal::kNoId, \ |
| 313 TRACE_EVENT_API_CURRENT_THREAD_ID, \ |
| 314 base::TimeTicks::FromInternalValue(timestamp), \ |
| 315 flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ |
| 316 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
| 317 } \ |
| 318 } while (0) |
| 319 |
| 320 // Implementation detail: internal macro to create static category and add |
| 321 // event if the category is enabled. |
305 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP(phase, \ | 322 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP(phase, \ |
306 category_group, name, id, thread_id, timestamp, flags, ...) \ | 323 category_group, name, id, thread_id, timestamp, flags, ...) \ |
307 do { \ | 324 do { \ |
308 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 325 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
309 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 326 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
310 unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ | 327 unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ |
311 trace_event_internal::TraceID trace_event_trace_id( \ | 328 trace_event_internal::TraceID trace_event_trace_id( \ |
312 id, &trace_event_flags); \ | 329 id, &trace_event_flags); \ |
313 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ | 330 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ |
314 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ | 331 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 const char* name_; | 926 const char* name_; |
910 IDType id_; | 927 IDType id_; |
911 | 928 |
912 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 929 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
913 }; | 930 }; |
914 | 931 |
915 } // namespace trace_event | 932 } // namespace trace_event |
916 } // namespace base | 933 } // namespace base |
917 | 934 |
918 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 935 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
OLD | NEW |