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

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

Issue 2162183002: Binds an ID to a Globally Unique ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@netinst_macros
Patch Set: reimplemented Created 4 years, 4 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') | base/trace_event/trace_event.h » ('J')
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 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 #define TRACE_EVENT_CLOCK_SYNC_ISSUER(sync_id, issue_ts, issue_end_ts) \ 958 #define TRACE_EVENT_CLOCK_SYNC_ISSUER(sync_id, issue_ts, issue_end_ts) \
959 INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \ 959 INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \
960 TRACE_EVENT_PHASE_CLOCK_SYNC, "__metadata", "clock_sync", \ 960 TRACE_EVENT_PHASE_CLOCK_SYNC, "__metadata", "clock_sync", \
961 issue_end_ts.ToInternalValue(), TRACE_EVENT_FLAG_NONE, \ 961 issue_end_ts.ToInternalValue(), TRACE_EVENT_FLAG_NONE, \
962 "sync_id", sync_id, "issue_ts", issue_ts.ToInternalValue()) 962 "sync_id", sync_id, "issue_ts", issue_ts.ToInternalValue())
963 963
964 // Macros to track the life time and value of arbitrary client objects. 964 // Macros to track the life time and value of arbitrary client objects.
965 // See also TraceTrackableObject. 965 // See also TraceTrackableObject.
966 #define TRACE_EVENT_OBJECT_CREATED_WITH_ID(category_group, name, id) \ 966 #define TRACE_EVENT_OBJECT_CREATED_WITH_ID(category_group, name, id) \
967 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ 967 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
968 TRACE_EVENT_PHASE_CREATE_OBJECT, category_group, name, \ 968 TRACE_EVENT_PHASE_CREATE_OBJECT, category_group, name, id, \
969 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE) 969 TRACE_EVENT_FLAG_NONE)
970 970
971 #define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(category_group, name, id, \ 971 #define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(category_group, name, id, \
972 snapshot) \ 972 snapshot) \
973 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ 973 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
974 TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \ 974 TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, id, \
975 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE, "snapshot", snapshot) 975 TRACE_EVENT_FLAG_NONE, "snapshot", snapshot)
976 976
977 #define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID_AND_TIMESTAMP( \ 977 #define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID_AND_TIMESTAMP( \
978 category_group, name, id, timestamp, snapshot) \ 978 category_group, name, id, timestamp, snapshot) \
979 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ 979 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
980 TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \ 980 TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \
981 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, \ 981 id, TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \
982 TRACE_EVENT_FLAG_NONE, "snapshot", snapshot) 982 "snapshot", snapshot)
983 983
984 #define TRACE_EVENT_OBJECT_DELETED_WITH_ID(category_group, name, id) \ 984 #define TRACE_EVENT_OBJECT_DELETED_WITH_ID(category_group, name, id) \
985 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ 985 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
986 TRACE_EVENT_PHASE_DELETE_OBJECT, category_group, name, \ 986 TRACE_EVENT_PHASE_DELETE_OBJECT, category_group, name, id, \
987 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE) 987 TRACE_EVENT_FLAG_NONE)
988 988
989 // Records entering and leaving trace event contexts. |category_group| and 989 // Records entering and leaving trace event contexts. |category_group| and
990 // |name| specify the context category and type. |context| is a 990 // |name| specify the context category and type. |context| is a
991 // snapshotted context object id. 991 // snapshotted context object id.
992 #define TRACE_EVENT_ENTER_CONTEXT(category_group, name, context) \ 992 #define TRACE_EVENT_ENTER_CONTEXT(category_group, name, context) \
993 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ 993 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
994 TRACE_EVENT_PHASE_ENTER_CONTEXT, category_group, name, \ 994 TRACE_EVENT_PHASE_ENTER_CONTEXT, category_group, name, context, \
995 TRACE_ID_DONT_MANGLE(context), TRACE_EVENT_FLAG_NONE) 995 TRACE_EVENT_FLAG_NONE)
996 #define TRACE_EVENT_LEAVE_CONTEXT(category_group, name, context) \ 996 #define TRACE_EVENT_LEAVE_CONTEXT(category_group, name, context) \
997 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ 997 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
998 TRACE_EVENT_PHASE_LEAVE_CONTEXT, category_group, name, \ 998 TRACE_EVENT_PHASE_LEAVE_CONTEXT, category_group, name, context, \
999 TRACE_ID_DONT_MANGLE(context), TRACE_EVENT_FLAG_NONE) 999 TRACE_EVENT_FLAG_NONE)
1000 #define TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \ 1000 #define TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \
1001 INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, \ 1001 INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context)
1002 TRACE_ID_DONT_MANGLE(context))
1003 1002
1004 // Macro to specify that two trace IDs are identical. For example, 1003 // Macro to specify that two trace IDs are identical. For example,
1005 // TRACE_BIND_IDS( 1004 // TRACE_LINK_IDS(
1006 // "category", "name", 1005 // "category", "name",
1007 // TRACE_ID_WITH_SCOPE("net::URLRequest", 0x1000), 1006 // TRACE_ID_WITH_SCOPE("net::URLRequest", 0x1000),
1008 // TRACE_ID_WITH_SCOPE("blink::ResourceFetcher::FetchRequest", 0x2000)) 1007 // TRACE_ID_WITH_SCOPE("blink::ResourceFetcher::FetchRequest", 0x2000))
1009 // tells the trace consumer that events with ID ("net::URLRequest", 0x1000) from 1008 // tells the trace consumer that events with ID ("net::URLRequest", 0x1000) from
1010 // the current process have the same ID as events with ID 1009 // the current process have the same ID as events with ID
1011 // ("blink::ResourceFetcher::FetchRequest", 0x2000). 1010 // ("blink::ResourceFetcher::FetchRequest", 0x2000).
1012 #define TRACE_BIND_IDS(category_group, name, id, bind_id) \ 1011 #define TRACE_LINK_IDS(category_group, name, id, linked_id) \
1013 INTERNAL_TRACE_EVENT_ADD_BIND_IDS(category_group, name, id, bind_id); 1012 INTERNAL_TRACE_EVENT_ADD_LINK_IDS(category_group, name, id, linked_id);
1014 1013
1015 // Macro to efficiently determine if a given category group is enabled. 1014 // Macro to efficiently determine if a given category group is enabled.
1016 #define TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, ret) \ 1015 #define TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, ret) \
1017 do { \ 1016 do { \
1018 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ 1017 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
1019 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ 1018 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \
1020 *ret = true; \ 1019 *ret = true; \
1021 } else { \ 1020 } else { \
1022 *ret = false; \ 1021 *ret = false; \
1023 } \ 1022 } \
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2)) 1085 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2))
1087 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3)) 1086 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3))
1088 #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4)) 1087 #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4))
1089 #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5)) 1088 #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5))
1090 #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6)) 1089 #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6))
1091 #define TRACE_EVENT_FLAG_BIND_TO_ENCLOSING (static_cast<unsigned int>(1 << 7)) 1090 #define TRACE_EVENT_FLAG_BIND_TO_ENCLOSING (static_cast<unsigned int>(1 << 7))
1092 #define TRACE_EVENT_FLAG_FLOW_IN (static_cast<unsigned int>(1 << 8)) 1091 #define TRACE_EVENT_FLAG_FLOW_IN (static_cast<unsigned int>(1 << 8))
1093 #define TRACE_EVENT_FLAG_FLOW_OUT (static_cast<unsigned int>(1 << 9)) 1092 #define TRACE_EVENT_FLAG_FLOW_OUT (static_cast<unsigned int>(1 << 9))
1094 #define TRACE_EVENT_FLAG_HAS_CONTEXT_ID (static_cast<unsigned int>(1 << 10)) 1093 #define TRACE_EVENT_FLAG_HAS_CONTEXT_ID (static_cast<unsigned int>(1 << 10))
1095 #define TRACE_EVENT_FLAG_HAS_PROCESS_ID (static_cast<unsigned int>(1 << 11)) 1094 #define TRACE_EVENT_FLAG_HAS_PROCESS_ID (static_cast<unsigned int>(1 << 11))
1095 #define TRACE_EVENT_FLAG_ID_IS_GLOBAL (static_cast<unsigned int>(1 << 12))
1096 1096
1097 #define TRACE_EVENT_FLAG_SCOPE_MASK \ 1097 #define TRACE_EVENT_FLAG_SCOPE_MASK \
1098 (static_cast<unsigned int>(TRACE_EVENT_FLAG_SCOPE_OFFSET | \ 1098 (static_cast<unsigned int>(TRACE_EVENT_FLAG_SCOPE_OFFSET | \
1099 TRACE_EVENT_FLAG_SCOPE_EXTRA)) 1099 TRACE_EVENT_FLAG_SCOPE_EXTRA))
1100 1100
1101 // Type values for identifying types in the TraceValue union. 1101 // Type values for identifying types in the TraceValue union.
1102 #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1)) 1102 #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1))
1103 #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2)) 1103 #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2))
1104 #define TRACE_VALUE_TYPE_INT (static_cast<unsigned char>(3)) 1104 #define TRACE_VALUE_TYPE_INT (static_cast<unsigned char>(3))
1105 #define TRACE_VALUE_TYPE_DOUBLE (static_cast<unsigned char>(4)) 1105 #define TRACE_VALUE_TYPE_DOUBLE (static_cast<unsigned char>(4))
1106 #define TRACE_VALUE_TYPE_POINTER (static_cast<unsigned char>(5)) 1106 #define TRACE_VALUE_TYPE_POINTER (static_cast<unsigned char>(5))
1107 #define TRACE_VALUE_TYPE_STRING (static_cast<unsigned char>(6)) 1107 #define TRACE_VALUE_TYPE_STRING (static_cast<unsigned char>(6))
1108 #define TRACE_VALUE_TYPE_COPY_STRING (static_cast<unsigned char>(7)) 1108 #define TRACE_VALUE_TYPE_COPY_STRING (static_cast<unsigned char>(7))
1109 #define TRACE_VALUE_TYPE_CONVERTABLE (static_cast<unsigned char>(8)) 1109 #define TRACE_VALUE_TYPE_CONVERTABLE (static_cast<unsigned char>(8))
1110 1110
1111 // Enum reflecting the scope of an INSTANT event. Must fit within 1111 // Enum reflecting the scope of an INSTANT event. Must fit within
1112 // TRACE_EVENT_FLAG_SCOPE_MASK. 1112 // TRACE_EVENT_FLAG_SCOPE_MASK.
1113 #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3)) 1113 #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3))
1114 #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3)) 1114 #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3))
1115 #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3)) 1115 #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3))
1116 1116
1117 #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g') 1117 #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g')
1118 #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p') 1118 #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p')
1119 #define TRACE_EVENT_SCOPE_NAME_THREAD ('t') 1119 #define TRACE_EVENT_SCOPE_NAME_THREAD ('t')
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/trace_event.h » ('j') | base/trace_event/trace_event.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698