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

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

Issue 2547193002: [tracing] Do not check enabled for filtering in TRACE_EVENT_CATEGORY_GROUP_ENABLED (Closed)
Patch Set: Created 4 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_ 5 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_
6 #define BASE_TRACE_EVENT_TRACE_EVENT_H_ 6 #define BASE_TRACE_EVENT_TRACE_EVENT_H_
7 7
8 // This header file defines implementation details of how the trace macros in 8 // This header file defines implementation details of how the trace macros in
9 // trace_event_common.h collect and store trace events. Anything not 9 // trace_event_common.h collect and store trace events. Anything not
10 // implementation-specific should go in trace_event_common.h instead of here. 10 // implementation-specific should go in trace_event_common.h instead of here.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 trace_event_internal::TraceID::WithScope(scope, id) 48 trace_event_internal::TraceID::WithScope(scope, id)
49 49
50 #define TRACE_ID_GLOBAL(id) trace_event_internal::TraceID::GlobalId(id) 50 #define TRACE_ID_GLOBAL(id) trace_event_internal::TraceID::GlobalId(id)
51 #define TRACE_ID_LOCAL(id) trace_event_internal::TraceID::LocalId(id) 51 #define TRACE_ID_LOCAL(id) trace_event_internal::TraceID::LocalId(id)
52 52
53 #define TRACE_EVENT_API_CURRENT_THREAD_ID \ 53 #define TRACE_EVENT_API_CURRENT_THREAD_ID \
54 static_cast<int>(base::PlatformThread::CurrentId()) 54 static_cast<int>(base::PlatformThread::CurrentId())
55 55
56 #define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE() \ 56 #define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE() \
57 UNLIKELY(*INTERNAL_TRACE_EVENT_UID(category_group_enabled) & \ 57 UNLIKELY(*INTERNAL_TRACE_EVENT_UID(category_group_enabled) & \
58 (base::trace_event::TraceCategory::ENABLED_FOR_RECORDING | \ 58 (base::trace_event::TraceCategory::ENABLED_FOR_RECORDING | \
59 base::trace_event::TraceCategory::ENABLED_FOR_ETW_EXPORT | \ 59 base::trace_event::TraceCategory::ENABLED_FOR_ETW_EXPORT))
60
61 #define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED() \
62 UNLIKELY(*INTERNAL_TRACE_EVENT_UID(category_group_enabled) & \
63 (base::trace_event::TraceCategory::ENABLED_FOR_RECORDING | \
64 base::trace_event::TraceCategory::ENABLED_FOR_ETW_EXPORT | \
60 base::trace_event::TraceCategory::ENABLED_FOR_FILTERING)) 65 base::trace_event::TraceCategory::ENABLED_FOR_FILTERING))
61 66
62 #define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_FILTERING_MODE( \
63 category_group_enabled) \
64 UNLIKELY(category_group_enabled& \
65 base::trace_event::TraceCategory::ENABLED_FOR_FILTERING)
66
67 //////////////////////////////////////////////////////////////////////////////// 67 ////////////////////////////////////////////////////////////////////////////////
68 // Implementation specific tracing API definitions. 68 // Implementation specific tracing API definitions.
69 69
70 // Get a pointer to the enabled state of the given trace category. Only 70 // Get a pointer to the enabled state of the given trace category. Only
71 // long-lived literal strings should be given as the category group. The 71 // long-lived literal strings should be given as the category group. The
72 // returned pointer can be held permanently in a local static for example. If 72 // returned pointer can be held permanently in a local static for example. If
73 // the unsigned char is non-zero, tracing is enabled. If tracing is enabled, 73 // the unsigned char is non-zero, tracing is enabled. If tracing is enabled,
74 // TRACE_EVENT_API_ADD_TRACE_EVENT can be called. It's OK if tracing is disabled 74 // TRACE_EVENT_API_ADD_TRACE_EVENT can be called. It's OK if tracing is disabled
75 // between the load of the tracing state and the call to 75 // between the load of the tracing state and the call to
76 // TRACE_EVENT_API_ADD_TRACE_EVENT, because this flag only provides an early out 76 // TRACE_EVENT_API_ADD_TRACE_EVENT, because this flag only provides an early out
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 ->AddTraceEventWithThreadIdAndTimestamp 164 ->AddTraceEventWithThreadIdAndTimestamp
165 165
166 // Set the duration field of a COMPLETE trace event. 166 // Set the duration field of a COMPLETE trace event.
167 // void TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( 167 // void TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
168 // const unsigned char* category_group_enabled, 168 // const unsigned char* category_group_enabled,
169 // const char* name, 169 // const char* name,
170 // base::trace_event::TraceEventHandle id) 170 // base::trace_event::TraceEventHandle id)
171 #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \ 171 #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \
172 base::trace_event::TraceLog::GetInstance()->UpdateTraceEventDuration 172 base::trace_event::TraceLog::GetInstance()->UpdateTraceEventDuration
173 173
174 // Call EndEvent on the filter for a filtered event.
175 // void TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
176 // const unsigned char* category_group_enabled,
177 // const char* name,
178 // base::trace_event::TraceEventHandle id)
179 #define TRACE_EVENT_API_END_FILTERED_EVENT \
180 base::trace_event::TraceLog::GetInstance()->EndFilteredEvent
181
182 // Adds a metadata event to the trace log. The |AppendValueAsTraceFormat| method 174 // Adds a metadata event to the trace log. The |AppendValueAsTraceFormat| method
183 // on the convertable value will be called at flush time. 175 // on the convertable value will be called at flush time.
184 // TRACE_EVENT_API_ADD_METADATA_EVENT( 176 // TRACE_EVENT_API_ADD_METADATA_EVENT(
185 // const unsigned char* category_group_enabled, 177 // const unsigned char* category_group_enabled,
186 // const char* event_name, 178 // const char* event_name,
187 // const char* arg_name, 179 // const char* arg_name,
188 // std::unique_ptr<ConvertableToTraceFormat> arg_value) 180 // std::unique_ptr<ConvertableToTraceFormat> arg_value)
189 #define TRACE_EVENT_API_ADD_METADATA_EVENT \ 181 #define TRACE_EVENT_API_ADD_METADATA_EVENT \
190 trace_event_internal::AddMetadataEvent 182 trace_event_internal::AddMetadataEvent
191 183
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 221
230 #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \ 222 #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \
231 static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \ 223 static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \
232 const unsigned char* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \ 224 const unsigned char* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \
233 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES(category_group, \ 225 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES(category_group, \
234 INTERNAL_TRACE_EVENT_UID(atomic), \ 226 INTERNAL_TRACE_EVENT_UID(atomic), \
235 INTERNAL_TRACE_EVENT_UID(category_group_enabled)); 227 INTERNAL_TRACE_EVENT_UID(category_group_enabled));
236 228
237 // Implementation detail: internal macro to create static category and add 229 // Implementation detail: internal macro to create static category and add
238 // event if the category is enabled. 230 // event if the category is enabled.
239 #define INTERNAL_TRACE_EVENT_ADD(phase, category_group, name, flags, ...) \ 231 #define INTERNAL_TRACE_EVENT_ADD(phase, category_group, name, flags, ...) \
240 do { \ 232 do { \
241 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ 233 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
242 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ 234 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \
243 trace_event_internal::AddTraceEvent( \ 235 trace_event_internal::AddTraceEvent( \
244 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ 236 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
245 trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \ 237 trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \
246 flags, trace_event_internal::kNoId, ##__VA_ARGS__); \ 238 flags, trace_event_internal::kNoId, ##__VA_ARGS__); \
247 } \ 239 } \
248 } while (0) 240 } while (0)
249 241
250 // Implementation detail: internal macro to create static category and add begin 242 // Implementation detail: internal macro to create static category and add begin
251 // event if the category is enabled. Also adds the end event when the scope 243 // event if the category is enabled. Also adds the end event when the scope
252 // ends. 244 // ends.
253 #define INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, ...) \ 245 #define INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, ...) \
254 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
255 trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \
256 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \
257 base::trace_event::TraceEventHandle h = \
258 trace_event_internal::AddTraceEvent( \
259 TRACE_EVENT_PHASE_COMPLETE, \
260 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
261 trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \
262 TRACE_EVENT_FLAG_NONE, trace_event_internal::kNoId, \
263 ##__VA_ARGS__); \
264 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \
265 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \
266 }
267
268 #define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW( \
269 category_group, name, bind_id, flow_flags, ...) \
270 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ 246 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
271 trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ 247 trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \
272 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ 248 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \
273 trace_event_internal::TraceID trace_event_bind_id((bind_id)); \
274 unsigned int trace_event_flags = flow_flags | \
275 trace_event_bind_id.id_flags(); \
276 base::trace_event::TraceEventHandle h = \ 249 base::trace_event::TraceEventHandle h = \
277 trace_event_internal::AddTraceEvent( \ 250 trace_event_internal::AddTraceEvent( \
278 TRACE_EVENT_PHASE_COMPLETE, \ 251 TRACE_EVENT_PHASE_COMPLETE, \
252 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
253 trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \
254 TRACE_EVENT_FLAG_NONE, trace_event_internal::kNoId, \
255 ##__VA_ARGS__); \
256 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \
257 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \
258 }
259
260 #define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, \
261 bind_id, flow_flags, ...) \
262 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
263 trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \
264 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \
265 trace_event_internal::TraceID trace_event_bind_id((bind_id)); \
266 unsigned int trace_event_flags = \
267 flow_flags | trace_event_bind_id.id_flags(); \
268 base::trace_event::TraceEventHandle h = \
269 trace_event_internal::AddTraceEvent( \
270 TRACE_EVENT_PHASE_COMPLETE, \
279 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ 271 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
280 trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \ 272 trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \
281 trace_event_flags, trace_event_bind_id.raw_id(), ##__VA_ARGS__); \ 273 trace_event_flags, trace_event_bind_id.raw_id(), ##__VA_ARGS__); \
282 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \ 274 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \
283 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ 275 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \
284 } 276 }
285 277
286 // Implementation detail: internal macro to create static category and add 278 // Implementation detail: internal macro to create static category and add
287 // event if the category is enabled. 279 // event if the category is enabled.
288 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category_group, name, id, \ 280 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category_group, name, id, \
289 flags, ...) \ 281 flags, ...) \
290 do { \ 282 do { \
291 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ 283 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
292 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ 284 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \
293 trace_event_internal::TraceID trace_event_trace_id((id)); \ 285 trace_event_internal::TraceID trace_event_trace_id((id)); \
294 unsigned int trace_event_flags = flags | \ 286 unsigned int trace_event_flags = \
295 trace_event_trace_id.id_flags(); \ 287 flags | trace_event_trace_id.id_flags(); \
296 trace_event_internal::AddTraceEvent( \ 288 trace_event_internal::AddTraceEvent( \
297 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ 289 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
298 name, trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ 290 trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \
299 trace_event_flags, trace_event_internal::kNoId, ##__VA_ARGS__); \ 291 trace_event_flags, trace_event_internal::kNoId, ##__VA_ARGS__); \
300 } \ 292 } \
301 } while (0) 293 } while (0)
302 294
303 // Implementation detail: internal macro to create static category and add 295 // Implementation detail: internal macro to create static category and add
304 // event if the category is enabled. 296 // event if the category is enabled.
305 #define INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP(phase, category_group, name, \ 297 #define INTERNAL_TRACE_EVENT_ADD_WITH_TIMESTAMP(phase, category_group, name, \
306 timestamp, flags, ...) \ 298 timestamp, flags, ...) \
307 do { \ 299 do { \
308 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ 300 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
309 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ 301 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \
310 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ 302 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \
311 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ 303 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
312 trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \ 304 trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \
313 TRACE_EVENT_API_CURRENT_THREAD_ID, \ 305 TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, \
314 timestamp, flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ 306 flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \
315 trace_event_internal::kNoId, ##__VA_ARGS__); \ 307 trace_event_internal::kNoId, ##__VA_ARGS__); \
316 } \ 308 } \
317 } while (0) 309 } while (0)
318 310
319 // Implementation detail: internal macro to create static category and add 311 // Implementation detail: internal macro to create static category and add
320 // event if the category is enabled. 312 // event if the category is enabled.
321 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ 313 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
322 phase, category_group, name, id, thread_id, timestamp, flags, ...) \ 314 phase, category_group, name, id, thread_id, timestamp, flags, ...) \
323 do { \ 315 do { \
324 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ 316 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
325 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ 317 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \
326 trace_event_internal::TraceID trace_event_trace_id((id)); \ 318 trace_event_internal::TraceID trace_event_trace_id((id)); \
327 unsigned int trace_event_flags = flags | \ 319 unsigned int trace_event_flags = \
328 trace_event_trace_id.id_flags(); \ 320 flags | trace_event_trace_id.id_flags(); \
329 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ 321 trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \
330 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ 322 phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
331 trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ 323 trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \
332 thread_id, timestamp, \ 324 thread_id, timestamp, \
333 trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ 325 trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \
334 trace_event_internal::kNoId, ##__VA_ARGS__); \ 326 trace_event_internal::kNoId, ##__VA_ARGS__); \
335 } \ 327 } \
336 } while (0) 328 } while (0)
337 329
338 // The linked ID will not be mangled. 330 // The linked ID will not be mangled.
339 #define INTERNAL_TRACE_EVENT_ADD_LINK_IDS(category_group, name, id1, id2) \ 331 #define INTERNAL_TRACE_EVENT_ADD_LINK_IDS(category_group, name, id1, id2) \
340 do { \ 332 do { \
341 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ 333 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
342 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ 334 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \
343 trace_event_internal::TraceID source_id((id1)); \ 335 trace_event_internal::TraceID source_id((id1)); \
344 unsigned int source_flags = source_id.id_flags(); \ 336 unsigned int source_flags = source_id.id_flags(); \
345 trace_event_internal::TraceID target_id((id2)); \ 337 trace_event_internal::TraceID target_id((id2)); \
346 trace_event_internal::AddTraceEvent( \ 338 trace_event_internal::AddTraceEvent( \
347 TRACE_EVENT_PHASE_LINK_IDS, \ 339 TRACE_EVENT_PHASE_LINK_IDS, \
348 INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ 340 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
349 name, source_id.scope(), source_id.raw_id(), source_flags, \ 341 source_id.scope(), source_id.raw_id(), source_flags, \
350 trace_event_internal::kNoId, \ 342 trace_event_internal::kNoId, "linked_id", \
351 "linked_id", target_id.AsConvertableToTraceFormat()); \ 343 target_id.AsConvertableToTraceFormat()); \
352 } \ 344 } \
353 } while (0) 345 } while (0)
354 346
355 // Implementation detail: internal macro to create static category and add 347 // Implementation detail: internal macro to create static category and add
356 // metadata event if the category is enabled. 348 // metadata event if the category is enabled.
357 #define INTERNAL_TRACE_EVENT_METADATA_ADD(category_group, name, ...) \ 349 #define INTERNAL_TRACE_EVENT_METADATA_ADD(category_group, name, ...) \
358 do { \ 350 do { \
359 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ 351 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
360 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ 352 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \
361 TRACE_EVENT_API_ADD_METADATA_EVENT( \ 353 TRACE_EVENT_API_ADD_METADATA_EVENT( \
362 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ 354 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
363 ##__VA_ARGS__); \ 355 ##__VA_ARGS__); \
364 } \ 356 } \
365 } while (0) 357 } while (0)
366 358
367 // Implementation detail: internal macro to enter and leave a 359 // Implementation detail: internal macro to enter and leave a
368 // context based on the current scope. 360 // context based on the current scope.
369 #define INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \ 361 #define INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \
370 struct INTERNAL_TRACE_EVENT_UID(ScopedContext) { \ 362 struct INTERNAL_TRACE_EVENT_UID(ScopedContext) { \
371 public: \ 363 public: \
372 INTERNAL_TRACE_EVENT_UID(ScopedContext)(uint64_t cid) : cid_(cid) { \ 364 INTERNAL_TRACE_EVENT_UID(ScopedContext)(uint64_t cid) : cid_(cid) { \
373 TRACE_EVENT_ENTER_CONTEXT(category_group, name, cid_); \ 365 TRACE_EVENT_ENTER_CONTEXT(category_group, name, cid_); \
374 } \ 366 } \
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 const char* name_; 1073 const char* name_;
1082 IDType id_; 1074 IDType id_;
1083 1075
1084 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); 1076 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject);
1085 }; 1077 };
1086 1078
1087 } // namespace trace_event 1079 } // namespace trace_event
1088 } // namespace base 1080 } // namespace base
1089 1081
1090 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ 1082 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698