OLD | NEW |
1 // Copyright (c) 2009 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 // Declaration of a Windows event trace provider class, to allow using | 5 // Declaration of a Windows event trace provider class, to allow using |
6 // Windows Event Tracing for logging transport and control. | 6 // Windows Event Tracing for logging transport and control. |
7 #ifndef BASE_WIN_EVENT_TRACE_PROVIDER_H_ | 7 #ifndef BASE_WIN_EVENT_TRACE_PROVIDER_H_ |
8 #define BASE_WIN_EVENT_TRACE_PROVIDER_H_ | 8 #define BASE_WIN_EVENT_TRACE_PROVIDER_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
11 #include <windows.h> | 11 #include <windows.h> |
12 #include <wmistr.h> | 12 #include <wmistr.h> |
13 #include <evntrace.h> | 13 #include <evntrace.h> |
| 14 |
| 15 #include "base/base_api.h" |
14 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
15 | 17 |
16 namespace base { | 18 namespace base { |
17 namespace win { | 19 namespace win { |
18 | 20 |
19 typedef GUID EtwEventClass; | 21 typedef GUID EtwEventClass; |
20 typedef UCHAR EtwEventType; | 22 typedef UCHAR EtwEventType; |
21 typedef UCHAR EtwEventLevel; | 23 typedef UCHAR EtwEventLevel; |
22 typedef USHORT EtwEventVersion; | 24 typedef USHORT EtwEventVersion; |
23 typedef ULONG EtwEventFlags; | 25 typedef ULONG EtwEventFlags; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 }; | 75 }; |
74 | 76 |
75 // Trace provider with Event Tracing for Windows. The trace provider | 77 // Trace provider with Event Tracing for Windows. The trace provider |
76 // registers with ETW by its name which is a GUID. ETW calls back to | 78 // registers with ETW by its name which is a GUID. ETW calls back to |
77 // the object whenever the trace level or enable flags for this provider | 79 // the object whenever the trace level or enable flags for this provider |
78 // name changes. | 80 // name changes. |
79 // Users of this class can test whether logging is currently enabled at | 81 // Users of this class can test whether logging is currently enabled at |
80 // a particular trace level, and whether particular enable flags are set, | 82 // a particular trace level, and whether particular enable flags are set, |
81 // before other resources are consumed to generate and issue the log | 83 // before other resources are consumed to generate and issue the log |
82 // messages themselves. | 84 // messages themselves. |
83 class EtwTraceProvider { | 85 class BASE_API EtwTraceProvider { |
84 public: | 86 public: |
85 // Creates an event trace provider identified by provider_name, which | 87 // Creates an event trace provider identified by provider_name, which |
86 // will be the name registered with Event Tracing for Windows (ETW). | 88 // will be the name registered with Event Tracing for Windows (ETW). |
87 explicit EtwTraceProvider(const GUID& provider_name); | 89 explicit EtwTraceProvider(const GUID& provider_name); |
88 | 90 |
89 // Creates an unnamed event trace provider, the provider must be given | 91 // Creates an unnamed event trace provider, the provider must be given |
90 // a name before registration. | 92 // a name before registration. |
91 EtwTraceProvider(); | 93 EtwTraceProvider(); |
92 virtual ~EtwTraceProvider(); | 94 virtual ~EtwTraceProvider(); |
93 | 95 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // RegisterTraceGuids. Non-const, because that's how the API needs it. | 167 // RegisterTraceGuids. Non-const, because that's how the API needs it. |
166 static TRACE_GUID_REGISTRATION obligatory_guid_registration_; | 168 static TRACE_GUID_REGISTRATION obligatory_guid_registration_; |
167 | 169 |
168 DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider); | 170 DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider); |
169 }; | 171 }; |
170 | 172 |
171 } // namespace win | 173 } // namespace win |
172 } // namespace base | 174 } // namespace base |
173 | 175 |
174 #endif // BASE_WIN_EVENT_TRACE_PROVIDER_H_ | 176 #endif // BASE_WIN_EVENT_TRACE_PROVIDER_H_ |
OLD | NEW |