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

Side by Side Diff: base/event_trace_provider_win.h

Issue 3800006: Fix event tracing for windows test flakyness.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « base/event_trace_controller_win_unittest.cc ('k') | base/event_trace_provider_win.cc » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_EVENT_TRACE_PROVIDER_WIN_H_ 7 #ifndef BASE_EVENT_TRACE_PROVIDER_WIN_H_
8 #define BASE_EVENT_TRACE_PROVIDER_WIN_H_ 8 #define BASE_EVENT_TRACE_PROVIDER_WIN_H_
9 #pragma once 9 #pragma once
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Do nothing if !ShouldLog(level, 0xFFFFFFFF). 119 // Do nothing if !ShouldLog(level, 0xFFFFFFFF).
120 ULONG Log(const EtwEventClass& event_class, EtwEventType type, 120 ULONG Log(const EtwEventClass& event_class, EtwEventType type,
121 EtwEventLevel level, const char *message); 121 EtwEventLevel level, const char *message);
122 ULONG Log(const EtwEventClass& event_class, EtwEventType type, 122 ULONG Log(const EtwEventClass& event_class, EtwEventType type,
123 EtwEventLevel level, const wchar_t *message); 123 EtwEventLevel level, const wchar_t *message);
124 124
125 // Log the provided event. 125 // Log the provided event.
126 ULONG Log(EVENT_TRACE_HEADER* event); 126 ULONG Log(EVENT_TRACE_HEADER* event);
127 127
128 protected: 128 protected:
129 // These are called after events have been enabled or disabled. 129 // Called after events have been enabled, override in subclasses
130 // Override them if you want to do processing at the start or 130 // to set up state or log at the start of a session.
131 // end of collection. 131 // Note: This function may be called ETW's thread and may be racy,
132 // Note: These may be called ETW's thread and they may be racy. 132 // bring your own locking if needed.
133 virtual void OnEventsEnabled() {} 133 virtual void OnEventsEnabled() {}
134
135 // Called just before events are disabled, override in subclasses
136 // to tear down state or log at the end of a session.
137 // Note: This function may be called ETW's thread and may be racy,
138 // bring your own locking if needed.
134 virtual void OnEventsDisabled() {} 139 virtual void OnEventsDisabled() {}
135 140
141 // Called just after events have been disabled, override in subclasses
142 // to tear down state at the end of a session. At this point it's
143 // to late to log anything to the session.
144 // Note: This function may be called ETW's thread and may be racy,
145 // bring your own locking if needed.
146 virtual void PostEventsDisabled() {}
147
136 private: 148 private:
137 ULONG EnableEvents(PVOID buffer); 149 ULONG EnableEvents(PVOID buffer);
138 ULONG DisableEvents(); 150 ULONG DisableEvents();
139 ULONG Callback(WMIDPREQUESTCODE request, PVOID buffer); 151 ULONG Callback(WMIDPREQUESTCODE request, PVOID buffer);
140 static ULONG WINAPI ControlCallback(WMIDPREQUESTCODE request, PVOID context, 152 static ULONG WINAPI ControlCallback(WMIDPREQUESTCODE request, PVOID context,
141 ULONG *reserved, PVOID buffer); 153 ULONG *reserved, PVOID buffer);
142 154
143 GUID provider_name_; 155 GUID provider_name_;
144 TRACEHANDLE registration_handle_; 156 TRACEHANDLE registration_handle_;
145 TRACEHANDLE session_handle_; 157 TRACEHANDLE session_handle_;
146 EtwEventFlags enable_flags_; 158 EtwEventFlags enable_flags_;
147 EtwEventLevel enable_level_; 159 EtwEventLevel enable_level_;
148 160
149 // We don't use this, but on XP we're obliged to pass one in to 161 // We don't use this, but on XP we're obliged to pass one in to
150 // RegisterTraceGuids. Non-const, because that's how the API needs it. 162 // RegisterTraceGuids. Non-const, because that's how the API needs it.
151 static TRACE_GUID_REGISTRATION obligatory_guid_registration_; 163 static TRACE_GUID_REGISTRATION obligatory_guid_registration_;
152 164
153 DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider); 165 DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider);
154 }; 166 };
155 167
156 #endif // BASE_EVENT_TRACE_PROVIDER_WIN_H_ 168 #endif // BASE_EVENT_TRACE_PROVIDER_WIN_H_
OLDNEW
« no previous file with comments | « base/event_trace_controller_win_unittest.cc ('k') | base/event_trace_provider_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698