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

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

Issue 2253973003: Add an explicit way of making IDs local or global (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: versioning the id field Created 4 years, 3 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 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 #define TRACE_EVENT_CLOCK_SYNC_ISSUER(sync_id, issue_ts, issue_end_ts) \ 952 #define TRACE_EVENT_CLOCK_SYNC_ISSUER(sync_id, issue_ts, issue_end_ts) \
953 INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \ 953 INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP( \
954 TRACE_EVENT_PHASE_CLOCK_SYNC, "__metadata", "clock_sync", \ 954 TRACE_EVENT_PHASE_CLOCK_SYNC, "__metadata", "clock_sync", \
955 issue_end_ts.ToInternalValue(), TRACE_EVENT_FLAG_NONE, \ 955 issue_end_ts.ToInternalValue(), TRACE_EVENT_FLAG_NONE, \
956 "sync_id", sync_id, "issue_ts", issue_ts.ToInternalValue()) 956 "sync_id", sync_id, "issue_ts", issue_ts.ToInternalValue())
957 957
958 // Macros to track the life time and value of arbitrary client objects. 958 // Macros to track the life time and value of arbitrary client objects.
959 // See also TraceTrackableObject. 959 // See also TraceTrackableObject.
960 #define TRACE_EVENT_OBJECT_CREATED_WITH_ID(category_group, name, id) \ 960 #define TRACE_EVENT_OBJECT_CREATED_WITH_ID(category_group, name, id) \
961 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ 961 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
962 TRACE_EVENT_PHASE_CREATE_OBJECT, category_group, name, \ 962 TRACE_EVENT_PHASE_CREATE_OBJECT, category_group, name, id, \
963 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE) 963 TRACE_EVENT_FLAG_NONE)
964 964
965 #define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(category_group, name, id, \ 965 #define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(category_group, name, id, \
966 snapshot) \ 966 snapshot) \
967 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ 967 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
968 TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \ 968 TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \
969 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE, "snapshot", snapshot) 969 id, TRACE_EVENT_FLAG_NONE, "snapshot", snapshot)
970 970
971 #define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID_AND_TIMESTAMP( \ 971 #define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID_AND_TIMESTAMP( \
972 category_group, name, id, timestamp, snapshot) \ 972 category_group, name, id, timestamp, snapshot) \
973 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ 973 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
974 TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \ 974 TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \
975 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, \ 975 id, TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE, \
976 TRACE_EVENT_FLAG_NONE, "snapshot", snapshot) 976 "snapshot", snapshot)
977 977
978 #define TRACE_EVENT_OBJECT_DELETED_WITH_ID(category_group, name, id) \ 978 #define TRACE_EVENT_OBJECT_DELETED_WITH_ID(category_group, name, id) \
979 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ 979 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
980 TRACE_EVENT_PHASE_DELETE_OBJECT, category_group, name, \ 980 TRACE_EVENT_PHASE_DELETE_OBJECT, category_group, name, id, \
981 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE) 981 TRACE_EVENT_FLAG_NONE)
982 982
983 // Records entering and leaving trace event contexts. |category_group| and 983 // Records entering and leaving trace event contexts. |category_group| and
984 // |name| specify the context category and type. |context| is a 984 // |name| specify the context category and type. |context| is a
985 // snapshotted context object id. 985 // snapshotted context object id.
986 #define TRACE_EVENT_ENTER_CONTEXT(category_group, name, context) \ 986 #define TRACE_EVENT_ENTER_CONTEXT(category_group, name, context) \
987 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ 987 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
988 TRACE_EVENT_PHASE_ENTER_CONTEXT, category_group, name, \ 988 TRACE_EVENT_PHASE_ENTER_CONTEXT, category_group, name, context, \
989 TRACE_ID_DONT_MANGLE(context), TRACE_EVENT_FLAG_NONE) 989 TRACE_EVENT_FLAG_NONE)
990 #define TRACE_EVENT_LEAVE_CONTEXT(category_group, name, context) \ 990 #define TRACE_EVENT_LEAVE_CONTEXT(category_group, name, context) \
991 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ 991 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
992 TRACE_EVENT_PHASE_LEAVE_CONTEXT, category_group, name, \ 992 TRACE_EVENT_PHASE_LEAVE_CONTEXT, category_group, name, context, \
993 TRACE_ID_DONT_MANGLE(context), TRACE_EVENT_FLAG_NONE) 993 TRACE_EVENT_FLAG_NONE)
994 #define TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \ 994 #define TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \
995 INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, \ 995 INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context)
996 TRACE_ID_DONT_MANGLE(context))
997 996
998 // Macro to specify that two trace IDs are identical. For example, 997 // Macro to specify that two trace IDs are identical. For example,
999 // TRACE_BIND_IDS( 998 // TRACE_BIND_IDS(
1000 // "category", "name", 999 // "category", "name",
1001 // TRACE_ID_WITH_SCOPE("net::URLRequest", 0x1000), 1000 // TRACE_ID_WITH_SCOPE("net::URLRequest", 0x1000),
1002 // TRACE_ID_WITH_SCOPE("blink::ResourceFetcher::FetchRequest", 0x2000)) 1001 // TRACE_ID_WITH_SCOPE("blink::ResourceFetcher::FetchRequest", 0x2000))
1003 // tells the trace consumer that events with ID ("net::URLRequest", 0x1000) from 1002 // tells the trace consumer that events with ID ("net::URLRequest", 0x1000) from
1004 // the current process have the same ID as events with ID 1003 // the current process have the same ID as events with ID
1005 // ("blink::ResourceFetcher::FetchRequest", 0x2000). 1004 // ("blink::ResourceFetcher::FetchRequest", 0x2000).
1006 #define TRACE_BIND_IDS(category_group, name, id, bind_id) \ 1005 #define TRACE_BIND_IDS(category_group, name, id, bind_id) \
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 #define TRACE_EVENT_PHASE_MARK ('R') 1069 #define TRACE_EVENT_PHASE_MARK ('R')
1071 #define TRACE_EVENT_PHASE_CLOCK_SYNC ('c') 1070 #define TRACE_EVENT_PHASE_CLOCK_SYNC ('c')
1072 #define TRACE_EVENT_PHASE_ENTER_CONTEXT ('(') 1071 #define TRACE_EVENT_PHASE_ENTER_CONTEXT ('(')
1073 #define TRACE_EVENT_PHASE_LEAVE_CONTEXT (')') 1072 #define TRACE_EVENT_PHASE_LEAVE_CONTEXT (')')
1074 #define TRACE_EVENT_PHASE_BIND_IDS ('=') 1073 #define TRACE_EVENT_PHASE_BIND_IDS ('=')
1075 1074
1076 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. 1075 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT.
1077 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned int>(0)) 1076 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned int>(0))
1078 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned int>(1 << 0)) 1077 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned int>(1 << 0))
1079 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned int>(1 << 1)) 1078 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned int>(1 << 1))
1079 // TODO(crbug.com/639003): Free this bit after ID mangling is deprecated.
1080 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2)) 1080 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2))
1081 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3)) 1081 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3))
1082 #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4)) 1082 #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4))
1083 #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5)) 1083 #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5))
1084 #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6)) 1084 #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6))
1085 #define TRACE_EVENT_FLAG_BIND_TO_ENCLOSING (static_cast<unsigned int>(1 << 7)) 1085 #define TRACE_EVENT_FLAG_BIND_TO_ENCLOSING (static_cast<unsigned int>(1 << 7))
1086 #define TRACE_EVENT_FLAG_FLOW_IN (static_cast<unsigned int>(1 << 8)) 1086 #define TRACE_EVENT_FLAG_FLOW_IN (static_cast<unsigned int>(1 << 8))
1087 #define TRACE_EVENT_FLAG_FLOW_OUT (static_cast<unsigned int>(1 << 9)) 1087 #define TRACE_EVENT_FLAG_FLOW_OUT (static_cast<unsigned int>(1 << 9))
1088 #define TRACE_EVENT_FLAG_HAS_CONTEXT_ID (static_cast<unsigned int>(1 << 10)) 1088 #define TRACE_EVENT_FLAG_HAS_CONTEXT_ID (static_cast<unsigned int>(1 << 10))
1089 #define TRACE_EVENT_FLAG_HAS_PROCESS_ID (static_cast<unsigned int>(1 << 11)) 1089 #define TRACE_EVENT_FLAG_HAS_PROCESS_ID (static_cast<unsigned int>(1 << 11))
1090 #define TRACE_EVENT_FLAG_HAS_LOCAL_ID (static_cast<unsigned int>(1 << 12))
1091 #define TRACE_EVENT_FLAG_HAS_GLOBAL_ID (static_cast<unsigned int>(1 << 13))
1090 1092
1091 #define TRACE_EVENT_FLAG_SCOPE_MASK \ 1093 #define TRACE_EVENT_FLAG_SCOPE_MASK \
1092 (static_cast<unsigned int>(TRACE_EVENT_FLAG_SCOPE_OFFSET | \ 1094 (static_cast<unsigned int>(TRACE_EVENT_FLAG_SCOPE_OFFSET | \
1093 TRACE_EVENT_FLAG_SCOPE_EXTRA)) 1095 TRACE_EVENT_FLAG_SCOPE_EXTRA))
1094 1096
1095 // Type values for identifying types in the TraceValue union. 1097 // Type values for identifying types in the TraceValue union.
1096 #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1)) 1098 #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1))
1097 #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2)) 1099 #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2))
1098 #define TRACE_VALUE_TYPE_INT (static_cast<unsigned char>(3)) 1100 #define TRACE_VALUE_TYPE_INT (static_cast<unsigned char>(3))
1099 #define TRACE_VALUE_TYPE_DOUBLE (static_cast<unsigned char>(4)) 1101 #define TRACE_VALUE_TYPE_DOUBLE (static_cast<unsigned char>(4))
1100 #define TRACE_VALUE_TYPE_POINTER (static_cast<unsigned char>(5)) 1102 #define TRACE_VALUE_TYPE_POINTER (static_cast<unsigned char>(5))
1101 #define TRACE_VALUE_TYPE_STRING (static_cast<unsigned char>(6)) 1103 #define TRACE_VALUE_TYPE_STRING (static_cast<unsigned char>(6))
1102 #define TRACE_VALUE_TYPE_COPY_STRING (static_cast<unsigned char>(7)) 1104 #define TRACE_VALUE_TYPE_COPY_STRING (static_cast<unsigned char>(7))
1103 #define TRACE_VALUE_TYPE_CONVERTABLE (static_cast<unsigned char>(8)) 1105 #define TRACE_VALUE_TYPE_CONVERTABLE (static_cast<unsigned char>(8))
1104 1106
1105 // Enum reflecting the scope of an INSTANT event. Must fit within 1107 // Enum reflecting the scope of an INSTANT event. Must fit within
1106 // TRACE_EVENT_FLAG_SCOPE_MASK. 1108 // TRACE_EVENT_FLAG_SCOPE_MASK.
1107 #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3)) 1109 #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3))
1108 #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3)) 1110 #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3))
1109 #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3)) 1111 #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3))
1110 1112
1111 #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g') 1113 #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g')
1112 #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p') 1114 #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p')
1113 #define TRACE_EVENT_SCOPE_NAME_THREAD ('t') 1115 #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