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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 #define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(category_group, name, id, snapshot)
\ | 719 #define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(category_group, name, id, snapshot)
\ |
720 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, \ | 720 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, \ |
721 category_group, name, TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE,\ | 721 category_group, name, TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE,\ |
722 "snapshot", snapshot) | 722 "snapshot", snapshot) |
723 | 723 |
724 #define TRACE_EVENT_OBJECT_DELETED_WITH_ID(category_group, name, id) \ | 724 #define TRACE_EVENT_OBJECT_DELETED_WITH_ID(category_group, name, id) \ |
725 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_DELETE_OBJECT, \ | 725 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_DELETE_OBJECT, \ |
726 category_group, name, TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE) | 726 category_group, name, TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE) |
727 | 727 |
728 #define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE() \ | 728 #define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE() \ |
729 *INTERNAL_TRACE_EVENT_UID(category_group_enabled) & \ | 729 UNLIKELY(*INTERNAL_TRACE_EVENT_UID(category_group_enabled) & \ |
730 (base::debug::TraceLog::ENABLED_FOR_RECORDING | \ | 730 (base::debug::TraceLog::ENABLED_FOR_RECORDING | \ |
731 base::debug::TraceLog::ENABLED_FOR_EVENT_CALLBACK) | 731 base::debug::TraceLog::ENABLED_FOR_EVENT_CALLBACK)) |
732 | 732 |
733 // Macro to efficiently determine if a given category group is enabled. | 733 // Macro to efficiently determine if a given category group is enabled. |
734 #define TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, ret) \ | 734 #define TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, ret) \ |
735 do { \ | 735 do { \ |
736 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ | 736 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ |
737 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ | 737 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ |
738 *ret = true; \ | 738 *ret = true; \ |
739 } else { \ | 739 } else { \ |
740 *ret = false; \ | 740 *ret = false; \ |
741 } \ | 741 } \ |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 | 847 |
848 // Implementation detail: internal macro to create static category. | 848 // Implementation detail: internal macro to create static category. |
849 // No barriers are needed, because this code is designed to operate safely | 849 // No barriers are needed, because this code is designed to operate safely |
850 // even when the unsigned char* points to garbage data (which may be the case | 850 // even when the unsigned char* points to garbage data (which may be the case |
851 // on processors without cache coherency). | 851 // on processors without cache coherency). |
852 #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( \ | 852 #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( \ |
853 category_group, atomic, category_group_enabled) \ | 853 category_group, atomic, category_group_enabled) \ |
854 category_group_enabled = \ | 854 category_group_enabled = \ |
855 reinterpret_cast<const unsigned char*>(TRACE_EVENT_API_ATOMIC_LOAD( \ | 855 reinterpret_cast<const unsigned char*>(TRACE_EVENT_API_ATOMIC_LOAD( \ |
856 atomic)); \ | 856 atomic)); \ |
857 if (!category_group_enabled) { \ | 857 if (UNLIKELY(!category_group_enabled)) { \ |
858 category_group_enabled = \ | 858 category_group_enabled = \ |
859 TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); \ | 859 TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); \ |
860 TRACE_EVENT_API_ATOMIC_STORE(atomic, \ | 860 TRACE_EVENT_API_ATOMIC_STORE(atomic, \ |
861 reinterpret_cast<TRACE_EVENT_API_ATOMIC_WORD>( \ | 861 reinterpret_cast<TRACE_EVENT_API_ATOMIC_WORD>( \ |
862 category_group_enabled)); \ | 862 category_group_enabled)); \ |
863 } | 863 } |
864 | 864 |
865 #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \ | 865 #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \ |
866 static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \ | 866 static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \ |
867 const unsigned char* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \ | 867 const unsigned char* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \ |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 const char* name_; | 1492 const char* name_; |
1493 IDType id_; | 1493 IDType id_; |
1494 | 1494 |
1495 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1495 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
1496 }; | 1496 }; |
1497 | 1497 |
1498 } // namespace debug | 1498 } // namespace debug |
1499 } // namespace base | 1499 } // namespace base |
1500 | 1500 |
1501 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ | 1501 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ |
OLD | NEW |