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

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

Issue 6747014: Base: Last set of files to use BASE_API (for base.dll) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 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
OLDNEW
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 controller class. 5 // Declaration of a Windows event trace controller class.
6 // The controller takes care of creating and manipulating event trace 6 // The controller takes care of creating and manipulating event trace
7 // sessions. 7 // sessions.
8 // 8 //
9 // Event tracing for Windows is a system-provided service that provides 9 // Event tracing for Windows is a system-provided service that provides
10 // logging control and high-performance transport for generic, binary trace 10 // logging control and high-performance transport for generic, binary trace
11 // events. Event trace providers register with the system by their name, 11 // events. Event trace providers register with the system by their name,
12 // which is a GUID, and can from that point forward receive callbacks that 12 // which is a GUID, and can from that point forward receive callbacks that
13 // start or end tracing and that change their trace level and enable mask. 13 // start or end tracing and that change their trace level and enable mask.
14 // 14 //
15 // A trace controller can create an event tracing session, which either 15 // A trace controller can create an event tracing session, which either
16 // sends events to a binary file, or to a realtime consumer, or both. 16 // sends events to a binary file, or to a realtime consumer, or both.
17 // 17 //
18 // A trace consumer consumes events from zero or one realtime session, 18 // A trace consumer consumes events from zero or one realtime session,
19 // as well as potentially from multiple binary trace files. 19 // as well as potentially from multiple binary trace files.
20 #ifndef BASE_WIN_EVENT_TRACE_CONTROLLER_H_ 20 #ifndef BASE_WIN_EVENT_TRACE_CONTROLLER_H_
21 #define BASE_WIN_EVENT_TRACE_CONTROLLER_H_ 21 #define BASE_WIN_EVENT_TRACE_CONTROLLER_H_
22 #pragma once 22 #pragma once
23 23
24 #include <windows.h> 24 #include <windows.h>
25 #include <wmistr.h> 25 #include <wmistr.h>
26 #include <evntrace.h> 26 #include <evntrace.h>
27 #include <string> 27 #include <string>
28
29 #include "base/base_api.h"
28 #include "base/basictypes.h" 30 #include "base/basictypes.h"
29 31
30 namespace base { 32 namespace base {
31 namespace win { 33 namespace win {
32 34
33 // Utility class to make it easier to work with EVENT_TRACE_PROPERTIES. 35 // Utility class to make it easier to work with EVENT_TRACE_PROPERTIES.
34 // The EVENT_TRACE_PROPERTIES structure contains information about an 36 // The EVENT_TRACE_PROPERTIES structure contains information about an
35 // event tracing session. 37 // event tracing session.
36 class EtwTraceProperties { 38 class BASE_API EtwTraceProperties {
37 public: 39 public:
38 EtwTraceProperties(); 40 EtwTraceProperties();
39 41
40 EVENT_TRACE_PROPERTIES* get() { 42 EVENT_TRACE_PROPERTIES* get() {
41 return &properties_; 43 return &properties_;
42 } 44 }
43 45
44 const EVENT_TRACE_PROPERTIES* get() const { 46 const EVENT_TRACE_PROPERTIES* get() const {
45 return reinterpret_cast<const EVENT_TRACE_PROPERTIES*>(&properties_); 47 return reinterpret_cast<const EVENT_TRACE_PROPERTIES*>(&properties_);
46 } 48 }
(...skipping 29 matching lines...) Expand all
76 // The actual size of the buffer is forced by this member. 78 // The actual size of the buffer is forced by this member.
77 char buffer_[kBufSize]; 79 char buffer_[kBufSize];
78 }; 80 };
79 81
80 DISALLOW_COPY_AND_ASSIGN(EtwTraceProperties); 82 DISALLOW_COPY_AND_ASSIGN(EtwTraceProperties);
81 }; 83 };
82 84
83 // This class implements an ETW controller, which knows how to start and 85 // This class implements an ETW controller, which knows how to start and
84 // stop event tracing sessions, as well as controlling ETW provider 86 // stop event tracing sessions, as well as controlling ETW provider
85 // log levels and enable bit masks under the session. 87 // log levels and enable bit masks under the session.
86 class EtwTraceController { 88 class BASE_API EtwTraceController {
87 public: 89 public:
88 EtwTraceController(); 90 EtwTraceController();
89 ~EtwTraceController(); 91 ~EtwTraceController();
90 92
91 // Start a session with given name and properties. 93 // Start a session with given name and properties.
92 HRESULT Start(const wchar_t* session_name, EtwTraceProperties* prop); 94 HRESULT Start(const wchar_t* session_name, EtwTraceProperties* prop);
93 95
94 // Starts a session tracing to a file with some default properties. 96 // Starts a session tracing to a file with some default properties.
95 HRESULT StartFileSession(const wchar_t* session_name, 97 HRESULT StartFileSession(const wchar_t* session_name,
96 const wchar_t* logfile_path, 98 const wchar_t* logfile_path,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 std::wstring session_name_; 143 std::wstring session_name_;
142 TRACEHANDLE session_; 144 TRACEHANDLE session_;
143 145
144 DISALLOW_COPY_AND_ASSIGN(EtwTraceController); 146 DISALLOW_COPY_AND_ASSIGN(EtwTraceController);
145 }; 147 };
146 148
147 } // namespace win 149 } // namespace win
148 } // namespace base 150 } // namespace base
149 151
150 #endif // BASE_WIN_EVENT_TRACE_CONTROLLER_H_ 152 #endif // BASE_WIN_EVENT_TRACE_CONTROLLER_H_
OLDNEW
« base/base_api.h ('K') | « base/value_conversions.h ('k') | base/win/event_trace_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698