| OLD | NEW |
| 1 // Copyright (c) 2011 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 | 11 |
| 12 #include "base/base_api.h" | 12 #include "base/base_export.h" |
| 13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
| 14 #include "base/win/event_trace_provider.h" | 14 #include "base/win/event_trace_provider.h" |
| 15 | 15 |
| 16 // Fwd. | 16 // Fwd. |
| 17 template <typename Type> | 17 template <typename Type> |
| 18 struct StaticMemorySingletonTraits; | 18 struct StaticMemorySingletonTraits; |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 namespace debug { | 21 namespace debug { |
| 22 | 22 |
| 23 // This EtwTraceProvider subclass implements ETW logging | 23 // This EtwTraceProvider subclass implements ETW logging |
| 24 // for the macros above on Windows. | 24 // for the macros above on Windows. |
| 25 class BASE_API TraceEventETWProvider : public base::win::EtwTraceProvider { | 25 class BASE_EXPORT TraceEventETWProvider : public base::win::EtwTraceProvider { |
| 26 public: | 26 public: |
| 27 // Start logging trace events. | 27 // Start logging trace events. |
| 28 // This is a noop in this implementation. | 28 // This is a noop in this implementation. |
| 29 static bool StartTracing(); | 29 static bool StartTracing(); |
| 30 | 30 |
| 31 // Trace begin/end/instant events, this is the bottleneck implementation | 31 // Trace begin/end/instant events, this is the bottleneck implementation |
| 32 // all the others defer to. | 32 // all the others defer to. |
| 33 // Allowing the use of std::string for name or extra is a convenience, | 33 // Allowing the use of std::string for name or extra is a convenience, |
| 34 // whereas passing name or extra as a const char* avoids the construction | 34 // whereas passing name or extra as a const char* avoids the construction |
| 35 // of temporary std::string instances. | 35 // of temporary std::string instances. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 // Ensure only the provider can construct us. | 88 // Ensure only the provider can construct us. |
| 89 friend struct StaticMemorySingletonTraits<TraceEventETWProvider>; | 89 friend struct StaticMemorySingletonTraits<TraceEventETWProvider>; |
| 90 TraceEventETWProvider(); | 90 TraceEventETWProvider(); |
| 91 | 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(TraceEventETWProvider); | 92 DISALLOW_COPY_AND_ASSIGN(TraceEventETWProvider); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 // The ETW trace provider GUID. | 95 // The ETW trace provider GUID. |
| 96 BASE_API extern const GUID kChromeTraceProviderName; | 96 BASE_EXPORT extern const GUID kChromeTraceProviderName; |
| 97 | 97 |
| 98 // The ETW event class GUID for 32 bit events. | 98 // The ETW event class GUID for 32 bit events. |
| 99 BASE_API extern const GUID kTraceEventClass32; | 99 BASE_EXPORT extern const GUID kTraceEventClass32; |
| 100 | 100 |
| 101 // The ETW event class GUID for 64 bit events. | 101 // The ETW event class GUID for 64 bit events. |
| 102 BASE_API extern const GUID kTraceEventClass64; | 102 BASE_EXPORT extern const GUID kTraceEventClass64; |
| 103 | 103 |
| 104 // The ETW event types, IDs 0x00-0x09 are reserved, so start at 0x10. | 104 // The ETW event types, IDs 0x00-0x09 are reserved, so start at 0x10. |
| 105 const base::win::EtwEventType kTraceEventTypeBegin = 0x10; | 105 const base::win::EtwEventType kTraceEventTypeBegin = 0x10; |
| 106 const base::win::EtwEventType kTraceEventTypeEnd = 0x11; | 106 const base::win::EtwEventType kTraceEventTypeEnd = 0x11; |
| 107 const base::win::EtwEventType kTraceEventTypeInstant = 0x12; | 107 const base::win::EtwEventType kTraceEventTypeInstant = 0x12; |
| 108 | 108 |
| 109 // If this flag is set in enable flags | 109 // If this flag is set in enable flags |
| 110 enum TraceEventFlags { | 110 enum TraceEventFlags { |
| 111 CAPTURE_STACK_TRACE = 0x0001, | 111 CAPTURE_STACK_TRACE = 0x0001, |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 // The event format consists of: | 114 // The event format consists of: |
| 115 // The "name" string as a zero-terminated ASCII string. | 115 // The "name" string as a zero-terminated ASCII string. |
| 116 // The id pointer in the machine bitness. | 116 // The id pointer in the machine bitness. |
| 117 // The "extra" string as a zero-terminated ASCII string. | 117 // The "extra" string as a zero-terminated ASCII string. |
| 118 // Optionally the stack trace, consisting of a DWORD "depth", followed | 118 // Optionally the stack trace, consisting of a DWORD "depth", followed |
| 119 // by an array of void* (machine bitness) of length "depth". | 119 // by an array of void* (machine bitness) of length "depth". |
| 120 | 120 |
| 121 // Forward decl. | 121 // Forward decl. |
| 122 struct TraceLogSingletonTraits; | 122 struct TraceLogSingletonTraits; |
| 123 | 123 |
| 124 } // nemspace debug | 124 } // nemspace debug |
| 125 } // namespace base | 125 } // namespace base |
| 126 | 126 |
| 127 #endif // BASE_DEBUG_TRACE_EVENT_WIN_H_ | 127 #endif // BASE_DEBUG_TRACE_EVENT_WIN_H_ |
| OLD | NEW |