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

Side by Side Diff: webrtc/base/trace_event.h

Issue 2019423006: Adding more detail to MessageQueue::Dispatch logging. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /*
2 // Use of this source code is governed by a BSD-style license that can be 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 // found in the LICENSE file under third_party_mods/chromium or at: 3 *
4 // http://src.chromium.org/svn/trunk/src/LICENSE 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
5 10
6 #ifndef WEBRTC_BASE_TRACE_EVENT_H_ 11 #ifndef WEBRTC_BASE_TRACE_EVENT_H_
7 #define WEBRTC_BASE_TRACE_EVENT_H_ 12 #define WEBRTC_BASE_TRACE_EVENT_H_
8 13
9 #include <string> 14 #include <string>
10 15
11 #include "webrtc/base/event_tracer.h" 16 #include "webrtc/base/event_tracer.h"
12 17
13 #if defined(TRACE_EVENT0) 18 #if defined(TRACE_EVENT0)
14 #error "Another copy of trace_event.h has already been included." 19 #error "Another copy of trace_event.h has already been included."
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // This will mark the trace event as disabled by default. The user will need 155 // This will mark the trace event as disabled by default. The user will need
151 // to explicitly enable the event. 156 // to explicitly enable the event.
152 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name 157 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name
153 158
154 // By default, uint64 ID argument values are not mangled with the Process ID in 159 // By default, uint64 ID argument values are not mangled with the Process ID in
155 // TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling. 160 // TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling.
156 #define TRACE_ID_MANGLE(id) \ 161 #define TRACE_ID_MANGLE(id) \
157 webrtc::trace_event_internal::TraceID::ForceMangle(id) 162 webrtc::trace_event_internal::TraceID::ForceMangle(id)
158 163
159 // Records a pair of begin and end events called "name" for the current 164 // Records a pair of begin and end events called "name" for the current
160 // scope, with 0, 1 or 2 associated arguments. If the category is not 165 // scope, with 0, 1, 2, or 3 associated arguments. If the category is not
161 // enabled, then this does nothing. 166 // enabled, then this does nothing.
162 // - category and name strings must have application lifetime (statics or 167 // - category and name strings must have application lifetime (statics or
163 // literals). They may not include " chars. 168 // literals). They may not include " chars.
164 #define TRACE_EVENT0(category, name) \ 169 #define TRACE_EVENT0(category, name) \
165 INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name) 170 INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name)
166 #define TRACE_EVENT1(category, name, arg1_name, arg1_val) \ 171 #define TRACE_EVENT1(category, name, arg1_name, arg1_val) \
167 INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, arg1_name, arg1_val) 172 INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, arg1_name, arg1_val)
168 #define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \ 173 #define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
169 INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, arg1_name, arg1_val, \ 174 INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, arg1_name, arg1_val, \
170 arg2_name, arg2_val) 175 arg2_name, arg2_val)
176 #define TRACE_EVENT3(category, name, arg1_name, arg1_val, arg2_name, arg2_val, \
177 arg3_name, arg3_val) \
178 INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, arg1_name, arg1_val, \
179 arg2_name, arg2_val, arg3_name, arg3_val)
171 180
172 // Same as TRACE_EVENT except that they are not included in official builds. 181 // Same as TRACE_EVENT except that they are not included in official builds.
173 #ifdef OFFICIAL_BUILD 182 #ifdef OFFICIAL_BUILD
174 #define UNSHIPPED_TRACE_EVENT0(category, name) (void)0 183 #define UNSHIPPED_TRACE_EVENT0(category, name) (void)0
175 #define UNSHIPPED_TRACE_EVENT1(category, name, arg1_name, arg1_val) (void)0 184 #define UNSHIPPED_TRACE_EVENT1(category, name, arg1_name, arg1_val) (void)0
176 #define UNSHIPPED_TRACE_EVENT2(category, name, arg1_name, arg1_val, \ 185 #define UNSHIPPED_TRACE_EVENT2(category, name, arg1_name, arg1_val, \
177 arg2_name, arg2_val) (void)0 186 arg2_name, arg2_val) (void)0
178 #define UNSHIPPED_TRACE_EVENT_INSTANT0(category, name) (void)0 187 #define UNSHIPPED_TRACE_EVENT_INSTANT0(category, name) (void)0
179 #define UNSHIPPED_TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \ 188 #define UNSHIPPED_TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
180 (void)0 189 (void)0
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 unsigned char arg_types[2]; 868 unsigned char arg_types[2];
860 unsigned long long arg_values[2]; 869 unsigned long long arg_values[2];
861 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]); 870 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]);
862 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]); 871 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]);
863 TRACE_EVENT_API_ADD_TRACE_EVENT( 872 TRACE_EVENT_API_ADD_TRACE_EVENT(
864 phase, category_enabled, name, id, 873 phase, category_enabled, name, id,
865 num_args, arg_names, arg_types, arg_values, 874 num_args, arg_names, arg_types, arg_values,
866 flags); 875 flags);
867 } 876 }
868 877
878 template <class ARG1_TYPE, class ARG2_TYPE, class ARG3_TYPE>
879 static inline void AddTraceEvent(char phase,
880 const unsigned char* category_enabled,
881 const char* name,
882 unsigned long long id,
883 unsigned char flags,
884 const char* arg1_name,
885 const ARG1_TYPE& arg1_val,
886 const char* arg2_name,
887 const ARG2_TYPE& arg2_val,
888 const char* arg3_name,
889 const ARG3_TYPE& arg3_val) {
890 const int num_args = 3;
891 const char* arg_names[3] = {arg1_name, arg2_name, arg3_name};
892 unsigned char arg_types[3];
893 unsigned long long arg_values[3];
894 SetTraceValue(arg1_val, &arg_types[0], &arg_values[0]);
895 SetTraceValue(arg2_val, &arg_types[1], &arg_values[1]);
896 SetTraceValue(arg3_val, &arg_types[2], &arg_values[2]);
897 TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_enabled, name, id, num_args,
898 arg_names, arg_types, arg_values, flags);
899 }
900
869 // Used by TRACE_EVENTx macro. Do not use directly. 901 // Used by TRACE_EVENTx macro. Do not use directly.
870 class TraceEndOnScopeClose { 902 class TraceEndOnScopeClose {
871 public: 903 public:
872 // Note: members of data_ intentionally left uninitialized. See Initialize. 904 // Note: members of data_ intentionally left uninitialized. See Initialize.
873 TraceEndOnScopeClose() : p_data_(NULL) {} 905 TraceEndOnScopeClose() : p_data_(NULL) {}
874 ~TraceEndOnScopeClose() { 906 ~TraceEndOnScopeClose() {
875 if (p_data_) 907 if (p_data_)
876 AddEventIfEnabled(); 908 AddEventIfEnabled();
877 } 909 }
878 910
(...skipping 28 matching lines...) Expand all
907 const char* name; 939 const char* name;
908 }; 940 };
909 Data* p_data_; 941 Data* p_data_;
910 Data data_; 942 Data data_;
911 }; 943 };
912 944
913 } // namespace trace_event_internal 945 } // namespace trace_event_internal
914 } // namespace webrtc 946 } // namespace webrtc
915 947
916 #endif // WEBRTC_BASE_TRACE_EVENT_H_ 948 #endif // WEBRTC_BASE_TRACE_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698