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

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

Issue 1072133006: Add granular file tracing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@do-initialize
Patch Set: herp Created 5 years, 7 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
« no previous file with comments | « base/files/file_win.cc ('k') | 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 // 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name) 227 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name)
228 #define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ 228 #define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \
229 INTERNAL_TRACE_MEMORY(category_group, name) \ 229 INTERNAL_TRACE_MEMORY(category_group, name) \
230 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val) 230 INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val)
231 #define TRACE_EVENT2( \ 231 #define TRACE_EVENT2( \
232 category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) \ 232 category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) \
233 INTERNAL_TRACE_MEMORY(category_group, name) \ 233 INTERNAL_TRACE_MEMORY(category_group, name) \
234 INTERNAL_TRACE_EVENT_ADD_SCOPED( \ 234 INTERNAL_TRACE_EVENT_ADD_SCOPED( \
235 category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) 235 category_group, name, arg1_name, arg1_val, arg2_name, arg2_val)
236 236
237 // Records a pair of begin and end events called "name" for the current scope
238 // with 1 or 2 associated arguments. These events are associated with id. If the
239 // category is not enabled, this does nothing.
240 // - category and name strings must have application lifetime (statics or
241 // literals). They may not include " chars.
242 #define TRACE_EVENT_ID1(category_group, name, id, arg1_name, arg1_val) \
243 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_ID( \
244 category_group, name, id, arg1_name, arg1_val)
Sami 2015/04/29 15:01:51 It's not clear what |id| refers to here. Does it n
Dan Beam 2015/04/30 04:40:13 yes
245 #define TRACE_EVENT_ID2( \
246 category_group, name, id, arg1_name, arg1_val, arg2_name, arg2_val) \
247 INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_ID( \
248 category_group, name, id, arg1_name, arg1_val, arg2_name, arg2_val)
249
237 // Records events like TRACE_EVENT2 but uses |memory_tag| for memory tracing. 250 // Records events like TRACE_EVENT2 but uses |memory_tag| for memory tracing.
238 // Use this where |name| is too generic to accurately aggregate allocations. 251 // Use this where |name| is too generic to accurately aggregate allocations.
239 #define TRACE_EVENT_WITH_MEMORY_TAG2( \ 252 #define TRACE_EVENT_WITH_MEMORY_TAG2( \
240 category, name, memory_tag, arg1_name, arg1_val, arg2_name, arg2_val) \ 253 category, name, memory_tag, arg1_name, arg1_val, arg2_name, arg2_val) \
241 INTERNAL_TRACE_MEMORY(category, memory_tag) \ 254 INTERNAL_TRACE_MEMORY(category, memory_tag) \
242 INTERNAL_TRACE_EVENT_ADD_SCOPED( \ 255 INTERNAL_TRACE_EVENT_ADD_SCOPED( \
243 category, name, arg1_name, arg1_val, arg2_name, arg2_val) 256 category, name, arg1_name, arg1_val, arg2_name, arg2_val)
244 257
245 // UNSHIPPED_TRACE_EVENT* are like TRACE_EVENT* except that they are not 258 // UNSHIPPED_TRACE_EVENT* are like TRACE_EVENT* except that they are not
246 // included in official builds. 259 // included in official builds.
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 base::trace_event::TraceEventHandle h = \ 1015 base::trace_event::TraceEventHandle h = \
1003 trace_event_internal::AddTraceEvent( \ 1016 trace_event_internal::AddTraceEvent( \
1004 TRACE_EVENT_PHASE_COMPLETE, \ 1017 TRACE_EVENT_PHASE_COMPLETE, \
1005 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ 1018 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
1006 trace_event_internal::kNoEventId, TRACE_EVENT_FLAG_NONE, \ 1019 trace_event_internal::kNoEventId, TRACE_EVENT_FLAG_NONE, \
1007 ##__VA_ARGS__); \ 1020 ##__VA_ARGS__); \
1008 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \ 1021 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \
1009 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ 1022 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \
1010 } 1023 }
1011 1024
1025 // Implementation detail: internal macro to create static category and add begin
1026 // event if the category is enabled. Also adds the end event when the scope
1027 // ends.
1028 #define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_ID(category_group, name, id, ...) \
1029 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
1030 trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \
1031 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \
1032 unsigned char trace_event_flags = TRACE_EVENT_FLAG_HAS_ID; \
1033 trace_event_internal::TraceID trace_event_trace_id( \
1034 id, &trace_event_flags); \
1035 base::trace_event::TraceEventHandle h = \
1036 trace_event_internal::AddTraceEvent( \
1037 TRACE_EVENT_PHASE_COMPLETE, \
1038 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
1039 trace_event_trace_id.data(), trace_event_flags, \
1040 ##__VA_ARGS__); \
1041 INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \
1042 INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \
1043 }
1044
1012 // Implementation detail: internal macro to create static category and add 1045 // Implementation detail: internal macro to create static category and add
1013 // event if the category is enabled. 1046 // event if the category is enabled.
1014 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category_group, name, id, \ 1047 #define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category_group, name, id, \
1015 flags, ...) \ 1048 flags, ...) \
1016 do { \ 1049 do { \
1017 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ 1050 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
1018 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ 1051 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \
1019 unsigned char trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ 1052 unsigned char trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \
1020 trace_event_internal::TraceID trace_event_trace_id( \ 1053 trace_event_internal::TraceID trace_event_trace_id( \
1021 id, &trace_event_flags); \ 1054 id, &trace_event_flags); \
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 const char* name_; 1666 const char* name_;
1634 IDType id_; 1667 IDType id_;
1635 1668
1636 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); 1669 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject);
1637 }; 1670 };
1638 1671
1639 } // namespace trace_event 1672 } // namespace trace_event
1640 } // namespace base 1673 } // namespace base
1641 1674
1642 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ 1675 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_
OLDNEW
« no previous file with comments | « base/files/file_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698