OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 file contains the Windows-specific declarations for trace_event.h. | 5 // This file contains the Windows-specific declarations for trace_event.h. |
6 #ifndef BASE_DEBUG_TRACE_EVENT_WIN_H_ | 6 #ifndef BASE_DEBUG_TRACE_EVENT_WIN_H_ |
7 #define BASE_DEBUG_TRACE_EVENT_WIN_H_ | 7 #define BASE_DEBUG_TRACE_EVENT_WIN_H_ |
8 #pragma once | 8 #pragma once |
9 | 9 |
10 #include <string> | 10 #include <string> |
| 11 |
| 12 #include "base/base_api.h" |
11 #include "base/win/event_trace_provider.h" | 13 #include "base/win/event_trace_provider.h" |
12 | 14 |
13 #define TRACE_EVENT_BEGIN(name, id, extra) \ | 15 #define TRACE_EVENT_BEGIN(name, id, extra) \ |
14 base::debug::TraceLog::Trace( \ | 16 base::debug::TraceLog::Trace( \ |
15 name, \ | 17 name, \ |
16 base::debug::TraceLog::EVENT_BEGIN, \ | 18 base::debug::TraceLog::EVENT_BEGIN, \ |
17 reinterpret_cast<const void*>(id), \ | 19 reinterpret_cast<const void*>(id), \ |
18 extra); | 20 extra); |
19 | 21 |
20 #define TRACE_EVENT_END(name, id, extra) \ | 22 #define TRACE_EVENT_END(name, id, extra) \ |
(...skipping 12 matching lines...) Expand all Loading... |
33 | 35 |
34 // Fwd. | 36 // Fwd. |
35 template <typename Type> | 37 template <typename Type> |
36 struct StaticMemorySingletonTraits; | 38 struct StaticMemorySingletonTraits; |
37 | 39 |
38 namespace base { | 40 namespace base { |
39 namespace debug { | 41 namespace debug { |
40 | 42 |
41 // This EtwTraceProvider subclass implements ETW logging | 43 // This EtwTraceProvider subclass implements ETW logging |
42 // for the macros above on Windows. | 44 // for the macros above on Windows. |
43 class TraceLog : public base::win::EtwTraceProvider { | 45 class BASE_API TraceLog : public base::win::EtwTraceProvider { |
44 public: | 46 public: |
45 enum EventType { | 47 enum EventType { |
46 EVENT_BEGIN, | 48 EVENT_BEGIN, |
47 EVENT_END, | 49 EVENT_END, |
48 EVENT_INSTANT | 50 EVENT_INSTANT |
49 }; | 51 }; |
50 | 52 |
51 // Start logging trace events. | 53 // Start logging trace events. |
52 // This is a noop in this implementation. | 54 // This is a noop in this implementation. |
53 static bool StartTracing(); | 55 static bool StartTracing(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 112 |
111 private: | 113 private: |
112 // Ensure only the provider can construct us. | 114 // Ensure only the provider can construct us. |
113 friend struct StaticMemorySingletonTraits<TraceLog>; | 115 friend struct StaticMemorySingletonTraits<TraceLog>; |
114 TraceLog(); | 116 TraceLog(); |
115 | 117 |
116 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 118 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
117 }; | 119 }; |
118 | 120 |
119 // The ETW trace provider GUID. | 121 // The ETW trace provider GUID. |
120 extern const GUID kChromeTraceProviderName; | 122 BASE_API extern const GUID kChromeTraceProviderName; |
121 | 123 |
122 // The ETW event class GUID for 32 bit events. | 124 // The ETW event class GUID for 32 bit events. |
123 extern const GUID kTraceEventClass32; | 125 BASE_API extern const GUID kTraceEventClass32; |
124 | 126 |
125 // The ETW event class GUID for 64 bit events. | 127 // The ETW event class GUID for 64 bit events. |
126 extern const GUID kTraceEventClass64; | 128 BASE_API extern const GUID kTraceEventClass64; |
127 | 129 |
128 // The ETW event types, IDs 0x00-0x09 are reserved, so start at 0x10. | 130 // The ETW event types, IDs 0x00-0x09 are reserved, so start at 0x10. |
129 const base::win::EtwEventType kTraceEventTypeBegin = 0x10; | 131 const base::win::EtwEventType kTraceEventTypeBegin = 0x10; |
130 const base::win::EtwEventType kTraceEventTypeEnd = 0x11; | 132 const base::win::EtwEventType kTraceEventTypeEnd = 0x11; |
131 const base::win::EtwEventType kTraceEventTypeInstant = 0x12; | 133 const base::win::EtwEventType kTraceEventTypeInstant = 0x12; |
132 | 134 |
133 // If this flag is set in enable flags | 135 // If this flag is set in enable flags |
134 enum TraceEventFlags { | 136 enum TraceEventFlags { |
135 CAPTURE_STACK_TRACE = 0x0001, | 137 CAPTURE_STACK_TRACE = 0x0001, |
136 }; | 138 }; |
137 | 139 |
138 // The event format consists of: | 140 // The event format consists of: |
139 // The "name" string as a zero-terminated ASCII string. | 141 // The "name" string as a zero-terminated ASCII string. |
140 // The id pointer in the machine bitness. | 142 // The id pointer in the machine bitness. |
141 // The "extra" string as a zero-terminated ASCII string. | 143 // The "extra" string as a zero-terminated ASCII string. |
142 // Optionally the stack trace, consisting of a DWORD "depth", followed | 144 // Optionally the stack trace, consisting of a DWORD "depth", followed |
143 // by an array of void* (machine bitness) of length "depth". | 145 // by an array of void* (machine bitness) of length "depth". |
144 | 146 |
145 // Forward decl. | 147 // Forward decl. |
146 struct TraceLogSingletonTraits; | 148 struct TraceLogSingletonTraits; |
147 | 149 |
148 } // nemspace debug | 150 } // nemspace debug |
149 } // namespace base | 151 } // namespace base |
150 | 152 |
151 #endif // BASE_DEBUG_TRACE_EVENT_WIN_H_ | 153 #endif // BASE_DEBUG_TRACE_EVENT_WIN_H_ |
OLD | NEW |