Chromium Code Reviews| 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_event_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 INTERNAL_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 INTERNAL_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 INTERNAL_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 // UNSHIPPED_TRACE_EVENT* are like TRACE_EVENT* except that they are not | 235 // UNSHIPPED_TRACE_EVENT* are like TRACE_EVENT* except that they are not |
| 232 // included in official builds. | 236 // included in official builds. |
| 233 | 237 |
| 234 #if OFFICIAL_BUILD | 238 #if OFFICIAL_BUILD |
| 235 #undef TRACING_IS_OFFICIAL_BUILD | 239 #undef TRACING_IS_OFFICIAL_BUILD |
| 236 #define TRACING_IS_OFFICIAL_BUILD 1 | 240 #define TRACING_IS_OFFICIAL_BUILD 1 |
| 237 #elif !defined(TRACING_IS_OFFICIAL_BUILD) | 241 #elif !defined(TRACING_IS_OFFICIAL_BUILD) |
| 238 #define TRACING_IS_OFFICIAL_BUILD 0 | 242 #define TRACING_IS_OFFICIAL_BUILD 0 |
|
jar (doing other things)
2013/07/13 00:51:08
I wish I could find a standard style.... but I cou
James Cook
2013/07/15 16:58:27
Could we resolve the issue about official build ma
jar (doing other things)
2013/07/16 22:54:48
Please switch to one of these alternatives in all
| |
| 239 #endif | 243 #endif |
| 240 | 244 |
| 241 #if TRACING_IS_OFFICIAL_BUILD | 245 #if TRACING_IS_OFFICIAL_BUILD |
| 242 #define UNSHIPPED_TRACE_EVENT0(category_group, name) (void)0 | 246 #define UNSHIPPED_TRACE_EVENT0(category_group, name) (void)0 |
| 243 #define UNSHIPPED_TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ | 247 #define UNSHIPPED_TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ |
| 244 (void)0 | 248 (void)0 |
| 245 #define UNSHIPPED_TRACE_EVENT2(category_group, name, arg1_name, arg1_val, \ | 249 #define UNSHIPPED_TRACE_EVENT2(category_group, name, arg1_name, arg1_val, \ |
| 246 arg2_name, arg2_val) (void)0 | 250 arg2_name, arg2_val) (void)0 |
| 247 #define UNSHIPPED_TRACE_EVENT_INSTANT0(category_group, name, scope) (void)0 | 251 #define UNSHIPPED_TRACE_EVENT_INSTANT0(category_group, name, scope) (void)0 |
| 248 #define UNSHIPPED_TRACE_EVENT_INSTANT1(category_group, name, scope, \ | 252 #define UNSHIPPED_TRACE_EVENT_INSTANT1(category_group, name, scope, \ |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1540 const char* name_; | 1544 const char* name_; |
| 1541 IDType id_; | 1545 IDType id_; |
| 1542 | 1546 |
| 1543 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1547 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
| 1544 }; | 1548 }; |
| 1545 | 1549 |
| 1546 } // namespace debug | 1550 } // namespace debug |
| 1547 } // namespace base | 1551 } // namespace base |
| 1548 | 1552 |
| 1549 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ | 1553 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ |
| OLD | NEW |