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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 // event if the category is enabled. | 345 // event if the category is enabled. |
346 #define INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP(phase, category_group, name, \ | 346 #define INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP(phase, category_group, name, \ |
347 timestamp, flags, ...) \ | 347 timestamp, flags, ...) \ |
348 do { \ | 348 do { \ |
349 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 349 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
350 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 350 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
351 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ | 351 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ |
352 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ | 352 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
353 trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \ | 353 trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \ |
354 TRACE_EVENT_API_CURRENT_THREAD_ID, \ | 354 TRACE_EVENT_API_CURRENT_THREAD_ID, \ |
355 base::TimeTicks::FromInternalValue(timestamp), \ | 355 timestamp, flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ |
356 flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ | |
357 trace_event_internal::kNoId, ##__VA_ARGS__); \ | 356 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
358 } \ | 357 } \ |
359 } while (0) | 358 } while (0) |
360 | 359 |
361 // Implementation detail: internal macro to create static category and add | 360 // Implementation detail: internal macro to create static category and add |
362 // event if the category is enabled. | 361 // event if the category is enabled. |
363 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ | 362 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
364 phase, category_group, name, id, thread_id, timestamp, flags, ...) \ | 363 phase, category_group, name, id, thread_id, timestamp, flags, ...) \ |
365 do { \ | 364 do { \ |
366 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 365 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
367 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 366 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
368 trace_event_internal::TraceID trace_event_trace_id((id)); \ | 367 trace_event_internal::TraceID trace_event_trace_id((id)); \ |
369 unsigned int trace_event_flags = flags | \ | 368 unsigned int trace_event_flags = flags | \ |
370 trace_event_trace_id.id_flags(); \ | 369 trace_event_trace_id.id_flags(); \ |
371 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ | 370 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ |
372 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ | 371 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ |
373 trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ | 372 trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ |
374 thread_id, base::TimeTicks::FromInternalValue(timestamp), \ | 373 thread_id, timestamp, \ |
375 trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ | 374 trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ |
376 trace_event_internal::kNoId, ##__VA_ARGS__); \ | 375 trace_event_internal::kNoId, ##__VA_ARGS__); \ |
377 } \ | 376 } \ |
378 } while (0) | 377 } while (0) |
379 | 378 |
380 // This macro ignores whether the bind_id is local, global, or mangled. | 379 // This macro ignores whether the bind_id is local, global, or mangled. |
381 #define INTERNAL_TRACE_EVENT_ADD_BIND_IDS(category_group, name, id, bind_id, \ | 380 #define INTERNAL_TRACE_EVENT_ADD_BIND_IDS(category_group, name, id, bind_id, \ |
382 ...) \ | 381 ...) \ |
383 do { \ | 382 do { \ |
384 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 383 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 const char* name_; | 1159 const char* name_; |
1161 IDType id_; | 1160 IDType id_; |
1162 | 1161 |
1163 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1162 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
1164 }; | 1163 }; |
1165 | 1164 |
1166 } // namespace trace_event | 1165 } // namespace trace_event |
1167 } // namespace base | 1166 } // namespace base |
1168 | 1167 |
1169 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 1168 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
OLD | NEW |