OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // trace points would carry a significant performance cost of aquiring a lock | 186 // trace points would carry a significant performance cost of aquiring a lock |
187 // and resolving the category. | 187 // and resolving the category. |
188 | 188 |
189 #ifndef BASE_DEBUG_TRACE_EVENT_H_ | 189 #ifndef BASE_DEBUG_TRACE_EVENT_H_ |
190 #define BASE_DEBUG_TRACE_EVENT_H_ | 190 #define BASE_DEBUG_TRACE_EVENT_H_ |
191 | 191 |
192 #include <string> | 192 #include <string> |
193 | 193 |
194 #include "base/atomicops.h" | 194 #include "base/atomicops.h" |
195 #include "base/debug/trace_event_impl.h" | 195 #include "base/debug/trace_event_impl.h" |
| 196 #include "base/debug/trace_memory.h" |
196 #include "build/build_config.h" | 197 #include "build/build_config.h" |
197 | 198 |
198 // By default, const char* argument values are assumed to have long-lived scope | 199 // By default, const char* argument values are assumed to have long-lived scope |
199 // and will not be copied. Use this macro to force a const char* to be copied. | 200 // and will not be copied. Use this macro to force a const char* to be copied. |
200 #define TRACE_STR_COPY(str) \ | 201 #define TRACE_STR_COPY(str) \ |
201 trace_event_internal::TraceStringWithCopy(str) | 202 trace_event_internal::TraceStringWithCopy(str) |
202 | 203 |
203 // This will mark the trace event as disabled by default. The user will need | 204 // This will mark the trace event as disabled by default. The user will need |
204 // to explicitly enable the event. | 205 // to explicitly enable the event. |
205 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name | 206 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name |
206 | 207 |
207 // By default, uint64 ID argument values are not mangled with the Process ID in | 208 // By default, uint64 ID argument values are not mangled with the Process ID in |
208 // TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling. | 209 // TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling. |
209 #define TRACE_ID_MANGLE(id) \ | 210 #define TRACE_ID_MANGLE(id) \ |
210 trace_event_internal::TraceID::ForceMangle(id) | 211 trace_event_internal::TraceID::ForceMangle(id) |
211 | 212 |
212 // By default, pointers are mangled with the Process ID in TRACE_EVENT_ASYNC | 213 // By default, pointers are mangled with the Process ID in TRACE_EVENT_ASYNC |
213 // macros. Use this macro to prevent Process ID mangling. | 214 // macros. Use this macro to prevent Process ID mangling. |
214 #define TRACE_ID_DONT_MANGLE(id) \ | 215 #define TRACE_ID_DONT_MANGLE(id) \ |
215 trace_event_internal::TraceID::DontMangle(id) | 216 trace_event_internal::TraceID::DontMangle(id) |
216 | 217 |
217 // Records a pair of begin and end events called "name" for the current | 218 // Records a pair of begin and end events called "name" for the current |
218 // scope, with 0, 1 or 2 associated arguments. If the category is not | 219 // scope, with 0, 1 or 2 associated arguments. If the category is not |
219 // enabled, then this does nothing. | 220 // enabled, then this does nothing. |
220 // - category and name strings must have application lifetime (statics or | 221 // - category and name strings must have application lifetime (statics or |
221 // literals). They may not include " chars. | 222 // literals). They may not include " chars. |
222 #define TRACE_EVENT0(category_group, name) \ | 223 #define TRACE_EVENT0(category_group, name) \ |
| 224 TRACE_MEMORY(category_group, name) \ |
223 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name) | 225 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name) |
224 #define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ | 226 #define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ |
| 227 TRACE_MEMORY(category_group, name) \ |
225 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val) | 228 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val) |
226 #define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, \ | 229 #define TRACE_EVENT2( \ |
227 arg2_val) \ | 230 category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) \ |
228 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val, \ | 231 TRACE_MEMORY(category_group, name) \ |
229 arg2_name, arg2_val) | 232 INTERNAL_TRACE_EVENT_ADD_SCOPED( \ |
| 233 category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) |
230 | 234 |
231 // Same as TRACE_EVENT except that they are not included in official builds. | 235 // Same as TRACE_EVENT except that they are not included in official builds. |
232 #ifdef OFFICIAL_BUILD | 236 #ifdef OFFICIAL_BUILD |
233 #define UNSHIPPED_TRACE_EVENT0(category_group, name) (void)0 | 237 #define UNSHIPPED_TRACE_EVENT0(category_group, name) (void)0 |
234 #define UNSHIPPED_TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ | 238 #define UNSHIPPED_TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ |
235 (void)0 | 239 (void)0 |
236 #define UNSHIPPED_TRACE_EVENT2(category_group, name, arg1_name, arg1_val, \ | 240 #define UNSHIPPED_TRACE_EVENT2(category_group, name, arg1_name, arg1_val, \ |
237 arg2_name, arg2_val) (void)0 | 241 arg2_name, arg2_val) (void)0 |
238 #define UNSHIPPED_TRACE_EVENT_INSTANT0(category_group, name, scope) (void)0 | 242 #define UNSHIPPED_TRACE_EVENT_INSTANT0(category_group, name, scope) (void)0 |
239 #define UNSHIPPED_TRACE_EVENT_INSTANT1(category_group, name, scope, \ | 243 #define UNSHIPPED_TRACE_EVENT_INSTANT1(category_group, name, scope, \ |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 const char* name_; | 1471 const char* name_; |
1468 IDType id_; | 1472 IDType id_; |
1469 | 1473 |
1470 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1474 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
1471 }; | 1475 }; |
1472 | 1476 |
1473 } // namespace debug | 1477 } // namespace debug |
1474 } // namespace base | 1478 } // namespace base |
1475 | 1479 |
1476 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ | 1480 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ |
OLD | NEW |