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

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

Issue 2452063003: tracing: split out the CategoryRegistry from the TraceLog (Closed)
Patch Set: add tests, rebase Created 4 years, 1 month 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/trace_event/trace_category_unittest.cc ('k') | base/trace_event/trace_log.h » ('j') | 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.
11 11
12 #include <stddef.h> 12 #include <stddef.h>
13 #include <stdint.h> 13 #include <stdint.h>
14 14
15 #include <string> 15 #include <string>
16 16
17 #include "base/atomicops.h" 17 #include "base/atomicops.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "base/trace_event/common/trace_event_common.h" 20 #include "base/trace_event/common/trace_event_common.h"
21 #include "base/trace_event/heap_profiler.h" 21 #include "base/trace_event/heap_profiler.h"
22 #include "base/trace_event/trace_category.h"
22 #include "base/trace_event/trace_event_system_stats_monitor.h" 23 #include "base/trace_event/trace_event_system_stats_monitor.h"
23 #include "base/trace_event/trace_log.h" 24 #include "base/trace_event/trace_log.h"
24 #include "build/build_config.h" 25 #include "build/build_config.h"
25 26
26 // By default, const char* argument values are assumed to have long-lived scope 27 // By default, const char* argument values are assumed to have long-lived scope
27 // and will not be copied. Use this macro to force a const char* to be copied. 28 // and will not be copied. Use this macro to force a const char* to be copied.
28 #define TRACE_STR_COPY(str) \ 29 #define TRACE_STR_COPY(str) \
29 trace_event_internal::TraceStringWithCopy(str) 30 trace_event_internal::TraceStringWithCopy(str)
30 31
31 // DEPRECATED: do not use: Consider using TRACE_ID_{GLOBAL, LOCAL} macros, 32 // DEPRECATED: do not use: Consider using TRACE_ID_{GLOBAL, LOCAL} macros,
(...skipping 15 matching lines...) Expand all
47 trace_event_internal::TraceID::WithScope(scope, id) 48 trace_event_internal::TraceID::WithScope(scope, id)
48 49
49 #define TRACE_ID_GLOBAL(id) trace_event_internal::TraceID::GlobalId(id) 50 #define TRACE_ID_GLOBAL(id) trace_event_internal::TraceID::GlobalId(id)
50 #define TRACE_ID_LOCAL(id) trace_event_internal::TraceID::LocalId(id) 51 #define TRACE_ID_LOCAL(id) trace_event_internal::TraceID::LocalId(id)
51 52
52 #define TRACE_EVENT_API_CURRENT_THREAD_ID \ 53 #define TRACE_EVENT_API_CURRENT_THREAD_ID \
53 static_cast<int>(base::PlatformThread::CurrentId()) 54 static_cast<int>(base::PlatformThread::CurrentId())
54 55
55 #define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE() \ 56 #define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE() \
56 UNLIKELY(*INTERNAL_TRACE_EVENT_UID(category_group_enabled) & \ 57 UNLIKELY(*INTERNAL_TRACE_EVENT_UID(category_group_enabled) & \
57 (base::trace_event::TraceLog::ENABLED_FOR_RECORDING | \ 58 (base::trace_event::TraceCategory::ENABLED_FOR_RECORDING | \
58 base::trace_event::TraceLog::ENABLED_FOR_ETW_EXPORT | \ 59 base::trace_event::TraceCategory::ENABLED_FOR_ETW_EXPORT | \
59 base::trace_event::TraceLog::ENABLED_FOR_FILTERING)) 60 base::trace_event::TraceCategory::ENABLED_FOR_FILTERING))
60 61
61 #define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_FILTERING_MODE( \ 62 #define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_FILTERING_MODE( \
62 category_group_enabled) \ 63 category_group_enabled) \
63 UNLIKELY(category_group_enabled& \ 64 UNLIKELY(category_group_enabled& \
64 base::trace_event::TraceLog::ENABLED_FOR_FILTERING) 65 base::trace_event::TraceCategory::ENABLED_FOR_FILTERING)
65 66
66 //////////////////////////////////////////////////////////////////////////////// 67 ////////////////////////////////////////////////////////////////////////////////
67 // Implementation specific tracing API definitions. 68 // Implementation specific tracing API definitions.
68 69
69 // 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
70 // 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
71 // 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
72 // 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,
73 // 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
74 // between the load of the tracing state and the call to 75 // between the load of the tracing state and the call to
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 const char* name_; 1081 const char* name_;
1081 IDType id_; 1082 IDType id_;
1082 1083
1083 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); 1084 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject);
1084 }; 1085 };
1085 1086
1086 } // namespace trace_event 1087 } // namespace trace_event
1087 } // namespace base 1088 } // namespace base
1088 1089
1089 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ 1090 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_
OLDNEW
« no previous file with comments | « base/trace_event/trace_category_unittest.cc ('k') | base/trace_event/trace_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698