Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: base/trace_event/common/trace_event_common.h

Issue 1499683002: tracing: Add macros for generating context trace events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/trace_event/trace_event.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ 955 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
956 TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \ 956 TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \
957 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, \ 957 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, \
958 TRACE_EVENT_FLAG_NONE, "snapshot", snapshot) 958 TRACE_EVENT_FLAG_NONE, "snapshot", snapshot)
959 959
960 #define TRACE_EVENT_OBJECT_DELETED_WITH_ID(category_group, name, id) \ 960 #define TRACE_EVENT_OBJECT_DELETED_WITH_ID(category_group, name, id) \
961 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ 961 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
962 TRACE_EVENT_PHASE_DELETE_OBJECT, category_group, name, \ 962 TRACE_EVENT_PHASE_DELETE_OBJECT, category_group, name, \
963 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE) 963 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE)
964 964
965 // Records entering and leaving trace event contexts. |category_group| and
966 // |name| specify the context category and type. |context| is a
967 // snapshotted context object id.
968 #define TRACE_EVENT_ENTER_CONTEXT(category_group, name, context) \
969 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
970 TRACE_EVENT_PHASE_ENTER_CONTEXT, category_group, name, \
971 TRACE_ID_DONT_MANGLE(context), TRACE_EVENT_FLAG_NONE)
972 #define TRACE_EVENT_LEAVE_CONTEXT(category_group, name, context) \
973 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
974 TRACE_EVENT_PHASE_LEAVE_CONTEXT, category_group, name, \
975 TRACE_ID_DONT_MANGLE(context), TRACE_EVENT_FLAG_NONE)
976 #define TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \
977 INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context)
978
965 // Macro to efficiently determine if a given category group is enabled. 979 // Macro to efficiently determine if a given category group is enabled.
966 #define TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, ret) \ 980 #define TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, ret) \
967 do { \ 981 do { \
968 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ 982 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
969 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ 983 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \
970 *ret = true; \ 984 *ret = true; \
971 } else { \ 985 } else { \
972 *ret = false; \ 986 *ret = false; \
973 } \ 987 } \
974 } while (0) 988 } while (0)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 #define TRACE_EVENT_PHASE_FLOW_END ('f') 1032 #define TRACE_EVENT_PHASE_FLOW_END ('f')
1019 #define TRACE_EVENT_PHASE_METADATA ('M') 1033 #define TRACE_EVENT_PHASE_METADATA ('M')
1020 #define TRACE_EVENT_PHASE_COUNTER ('C') 1034 #define TRACE_EVENT_PHASE_COUNTER ('C')
1021 #define TRACE_EVENT_PHASE_SAMPLE ('P') 1035 #define TRACE_EVENT_PHASE_SAMPLE ('P')
1022 #define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') 1036 #define TRACE_EVENT_PHASE_CREATE_OBJECT ('N')
1023 #define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') 1037 #define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O')
1024 #define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') 1038 #define TRACE_EVENT_PHASE_DELETE_OBJECT ('D')
1025 #define TRACE_EVENT_PHASE_MEMORY_DUMP ('v') 1039 #define TRACE_EVENT_PHASE_MEMORY_DUMP ('v')
1026 #define TRACE_EVENT_PHASE_MARK ('R') 1040 #define TRACE_EVENT_PHASE_MARK ('R')
1027 #define TRACE_EVENT_PHASE_CLOCK_SYNC ('c') 1041 #define TRACE_EVENT_PHASE_CLOCK_SYNC ('c')
1042 #define TRACE_EVENT_PHASE_ENTER_CONTEXT ('(')
1043 #define TRACE_EVENT_PHASE_LEAVE_CONTEXT (')')
1028 1044
1029 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. 1045 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT.
1030 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned int>(0)) 1046 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned int>(0))
1031 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned int>(1 << 0)) 1047 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned int>(1 << 0))
1032 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned int>(1 << 1)) 1048 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned int>(1 << 1))
1033 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2)) 1049 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2))
1034 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3)) 1050 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3))
1035 #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4)) 1051 #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4))
1036 #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5)) 1052 #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5))
1037 #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6)) 1053 #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6))
(...skipping 19 matching lines...) Expand all
1057 1073
1058 // Enum reflecting the scope of an INSTANT event. Must fit within 1074 // Enum reflecting the scope of an INSTANT event. Must fit within
1059 // TRACE_EVENT_FLAG_SCOPE_MASK. 1075 // TRACE_EVENT_FLAG_SCOPE_MASK.
1060 #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3)) 1076 #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3))
1061 #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3)) 1077 #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3))
1062 #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3)) 1078 #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3))
1063 1079
1064 #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g') 1080 #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g')
1065 #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p') 1081 #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p')
1066 #define TRACE_EVENT_SCOPE_NAME_THREAD ('t') 1082 #define TRACE_EVENT_SCOPE_NAME_THREAD ('t')
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/trace_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698