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

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: Created 5 years 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 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ 944 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
945 TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \ 945 TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \
946 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, \ 946 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, \
947 TRACE_EVENT_FLAG_NONE, "snapshot", snapshot) 947 TRACE_EVENT_FLAG_NONE, "snapshot", snapshot)
948 948
949 #define TRACE_EVENT_OBJECT_DELETED_WITH_ID(category_group, name, id) \ 949 #define TRACE_EVENT_OBJECT_DELETED_WITH_ID(category_group, name, id) \
950 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ 950 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
951 TRACE_EVENT_PHASE_DELETE_OBJECT, category_group, name, \ 951 TRACE_EVENT_PHASE_DELETE_OBJECT, category_group, name, \
952 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE) 952 TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE)
953 953
954 // Entering and leaving trace event contexts. |category_group| and |name|
955 // specify the context category and type. |context| represents a snapshotted
956 // context object.
957 #define TRACE_EVENT_ENTER_CONTEXT(category_group, name, context) \
958 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
959 TRACE_EVENT_PHASE_ENTER_CONTEXT, category_group, name, \
960 TRACE_ID_DONT_MANGLE(context), TRACE_EVENT_FLAG_NONE)
961 #define TRACE_EVENT_LEAVE_CONTEXT(category_group, name, context) \
962 INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
963 TRACE_EVENT_PHASE_LEAVE_CONTEXT, category_group, name, \
964 TRACE_ID_DONT_MANGLE(context), TRACE_EVENT_FLAG_NONE)
965 #define TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \
966 INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context)
967
954 // Macro to efficiently determine if a given category group is enabled. 968 // Macro to efficiently determine if a given category group is enabled.
955 #define TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, ret) \ 969 #define TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, ret) \
956 do { \ 970 do { \
957 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ 971 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
958 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ 972 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \
959 *ret = true; \ 973 *ret = true; \
960 } else { \ 974 } else { \
961 *ret = false; \ 975 *ret = false; \
962 } \ 976 } \
963 } while (0) 977 } while (0)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 #define TRACE_EVENT_PHASE_FLOW_STEP ('t') 1020 #define TRACE_EVENT_PHASE_FLOW_STEP ('t')
1007 #define TRACE_EVENT_PHASE_FLOW_END ('f') 1021 #define TRACE_EVENT_PHASE_FLOW_END ('f')
1008 #define TRACE_EVENT_PHASE_METADATA ('M') 1022 #define TRACE_EVENT_PHASE_METADATA ('M')
1009 #define TRACE_EVENT_PHASE_COUNTER ('C') 1023 #define TRACE_EVENT_PHASE_COUNTER ('C')
1010 #define TRACE_EVENT_PHASE_SAMPLE ('P') 1024 #define TRACE_EVENT_PHASE_SAMPLE ('P')
1011 #define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') 1025 #define TRACE_EVENT_PHASE_CREATE_OBJECT ('N')
1012 #define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') 1026 #define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O')
1013 #define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') 1027 #define TRACE_EVENT_PHASE_DELETE_OBJECT ('D')
1014 #define TRACE_EVENT_PHASE_MEMORY_DUMP ('v') 1028 #define TRACE_EVENT_PHASE_MEMORY_DUMP ('v')
1015 #define TRACE_EVENT_PHASE_MARK ('R') 1029 #define TRACE_EVENT_PHASE_MARK ('R')
1030 #define TRACE_EVENT_PHASE_ENTER_CONTEXT ('(')
1031 #define TRACE_EVENT_PHASE_LEAVE_CONTEXT (')')
1016 1032
1017 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. 1033 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT.
1018 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned int>(0)) 1034 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned int>(0))
1019 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned int>(1 << 0)) 1035 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned int>(1 << 0))
1020 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned int>(1 << 1)) 1036 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned int>(1 << 1))
1021 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2)) 1037 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned int>(1 << 2))
1022 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3)) 1038 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned int>(1 << 3))
1023 #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4)) 1039 #define TRACE_EVENT_FLAG_SCOPE_EXTRA (static_cast<unsigned int>(1 << 4))
1024 #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5)) 1040 #define TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP (static_cast<unsigned int>(1 << 5))
1025 #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6)) 1041 #define TRACE_EVENT_FLAG_ASYNC_TTS (static_cast<unsigned int>(1 << 6))
(...skipping 19 matching lines...) Expand all
1045 1061
1046 // Enum reflecting the scope of an INSTANT event. Must fit within 1062 // Enum reflecting the scope of an INSTANT event. Must fit within
1047 // TRACE_EVENT_FLAG_SCOPE_MASK. 1063 // TRACE_EVENT_FLAG_SCOPE_MASK.
1048 #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3)) 1064 #define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3))
1049 #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3)) 1065 #define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3))
1050 #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3)) 1066 #define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3))
1051 1067
1052 #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g') 1068 #define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g')
1053 #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p') 1069 #define TRACE_EVENT_SCOPE_NAME_PROCESS ('p')
1054 #define TRACE_EVENT_SCOPE_NAME_THREAD ('t') 1070 #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