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

Side by Side Diff: base/win/event_trace_provider.h

Issue 23934003: Have all trace points emit to ETW. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 11 months 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/debug/trace_event_win.cc ('k') | no next file » | 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) 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 25 matching lines...) Expand all
36 36
37 // Clang and the C++ standard don't allow unqualified lookup into dependent 37 // Clang and the C++ standard don't allow unqualified lookup into dependent
38 // bases, hence these using decls to explicitly pull the names out. 38 // bases, hence these using decls to explicitly pull the names out.
39 using EtwMofEventBase<N>::header; 39 using EtwMofEventBase<N>::header;
40 using EtwMofEventBase<N>::fields; 40 using EtwMofEventBase<N>::fields;
41 41
42 EtwMofEvent() { 42 EtwMofEvent() {
43 memset(static_cast<Super*>(this), 0, sizeof(Super)); 43 memset(static_cast<Super*>(this), 0, sizeof(Super));
44 } 44 }
45 45
46 EtwMofEvent(const EtwEventClass& event_class, EtwEventLevel level) {
47 memset(static_cast<Super*>(this), 0, sizeof(Super));
48 header.Size = sizeof(Super);
49 header.Guid = event_class;
50 header.Class.Level = level;
51 header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR;
52 }
53
46 EtwMofEvent(const EtwEventClass& event_class, EtwEventType type, 54 EtwMofEvent(const EtwEventClass& event_class, EtwEventType type,
47 EtwEventLevel level) { 55 EtwEventLevel level) {
48 memset(static_cast<Super*>(this), 0, sizeof(Super)); 56 memset(static_cast<Super*>(this), 0, sizeof(Super));
49 header.Size = sizeof(Super); 57 header.Size = sizeof(Super);
50 header.Guid = event_class; 58 header.Guid = event_class;
51 header.Class.Type = type; 59 header.Class.Type = type;
52 header.Class.Level = level; 60 header.Class.Level = level;
53 header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR; 61 header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR;
54 } 62 }
55 63
56 EtwMofEvent(const EtwEventClass& event_class, EtwEventType type, 64 EtwMofEvent(const EtwEventClass& event_class, EtwEventType type,
57 EtwEventVersion version, EtwEventLevel level) { 65 EtwEventVersion version, EtwEventLevel level) {
58 memset(static_cast<Super*>(this), 0, sizeof(Super)); 66 memset(static_cast<Super*>(this), 0, sizeof(Super));
59 header.Size = sizeof(Super); 67 header.Size = sizeof(Super);
60 header.Guid = event_class; 68 header.Guid = event_class;
61 header.Class.Type = type; 69 header.Class.Type = type;
62 header.Class.Version = version; 70 header.Class.Version = version;
63 header.Class.Level = level; 71 header.Class.Level = level;
64 header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR; 72 header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR;
65 } 73 }
66 74
75 void SetType(EtwEventType type) {
76 header.Class.Type = type;
77 }
78
67 void SetField(int field, size_t size, const void *data) { 79 void SetField(int field, size_t size, const void *data) {
68 // DCHECK(field < N); 80 // DCHECK(field < N);
69 if ((field < N) && (size <= kuint32max)) { 81 if ((field < N) && (size <= kuint32max)) {
70 fields[field].DataPtr = reinterpret_cast<ULONG64>(data); 82 fields[field].DataPtr = reinterpret_cast<ULONG64>(data);
71 fields[field].Length = static_cast<ULONG>(size); 83 fields[field].Length = static_cast<ULONG>(size);
72 } 84 }
73 } 85 }
74 86
75 EVENT_TRACE_HEADER* get() { return& header; } 87 EVENT_TRACE_HEADER* get() { return& header; }
76 88
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // RegisterTraceGuids. Non-const, because that's how the API needs it. 183 // RegisterTraceGuids. Non-const, because that's how the API needs it.
172 static TRACE_GUID_REGISTRATION obligatory_guid_registration_; 184 static TRACE_GUID_REGISTRATION obligatory_guid_registration_;
173 185
174 DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider); 186 DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider);
175 }; 187 };
176 188
177 } // namespace win 189 } // namespace win
178 } // namespace base 190 } // namespace base
179 191
180 #endif // BASE_WIN_EVENT_TRACE_PROVIDER_H_ 192 #endif // BASE_WIN_EVENT_TRACE_PROVIDER_H_
OLDNEW
« no previous file with comments | « base/debug/trace_event_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698