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 // 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 | 9 |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 EtwEventVersion version, EtwEventLevel level) { | 60 EtwEventVersion version, EtwEventLevel level) { |
61 memset(static_cast<Super*>(this), 0, sizeof(Super)); | 61 memset(static_cast<Super*>(this), 0, sizeof(Super)); |
62 header.Size = sizeof(Super); | 62 header.Size = sizeof(Super); |
63 header.Guid = event_class; | 63 header.Guid = event_class; |
64 header.Class.Type = type; | 64 header.Class.Type = type; |
65 header.Class.Version = version; | 65 header.Class.Version = version; |
66 header.Class.Level = level; | 66 header.Class.Level = level; |
67 header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR; | 67 header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR; |
68 } | 68 } |
69 | 69 |
70 void SetField(int field, size_t size, const void *data) { | 70 void SetField(size_t field, size_t size, const void* data) { |
71 // DCHECK(field < N); | 71 // DCHECK(field < N); |
72 if ((field < N) && (size <= std::numeric_limits<uint32_t>::max())) { | 72 if ((field < N) && (size <= std::numeric_limits<uint32_t>::max())) { |
73 fields[field].DataPtr = reinterpret_cast<ULONG64>(data); | 73 fields[field].DataPtr = reinterpret_cast<ULONG64>(data); |
74 fields[field].Length = static_cast<ULONG>(size); | 74 fields[field].Length = static_cast<ULONG>(size); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 EVENT_TRACE_HEADER* get() { return& header; } | 78 EVENT_TRACE_HEADER* get() { return& header; } |
79 | 79 |
80 private: | 80 private: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // RegisterTraceGuids. Non-const, because that's how the API needs it. | 174 // RegisterTraceGuids. Non-const, because that's how the API needs it. |
175 static TRACE_GUID_REGISTRATION obligatory_guid_registration_; | 175 static TRACE_GUID_REGISTRATION obligatory_guid_registration_; |
176 | 176 |
177 DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider); | 177 DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider); |
178 }; | 178 }; |
179 | 179 |
180 } // namespace win | 180 } // namespace win |
181 } // namespace base | 181 } // namespace base |
182 | 182 |
183 #endif // BASE_WIN_EVENT_TRACE_PROVIDER_H_ | 183 #endif // BASE_WIN_EVENT_TRACE_PROVIDER_H_ |
OLD | NEW |