OLD | NEW |
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 // Implementation of a Windows event trace controller class. | 5 // Implementation of a Windows event trace controller class. |
6 #include "base/win/event_trace_controller.h" | 6 #include "base/win/event_trace_controller.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace base { | 9 namespace base { |
10 namespace win { | 10 namespace win { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 prop = &ignore; | 57 prop = &ignore; |
58 | 58 |
59 HRESULT hr = Start(session_name, prop, &session_); | 59 HRESULT hr = Start(session_name, prop, &session_); |
60 if (SUCCEEDED(hr)) | 60 if (SUCCEEDED(hr)) |
61 session_name_ = session_name; | 61 session_name_ = session_name; |
62 | 62 |
63 return hr; | 63 return hr; |
64 } | 64 } |
65 | 65 |
66 HRESULT EtwTraceController::StartFileSession(const wchar_t* session_name, | 66 HRESULT EtwTraceController::StartFileSession(const wchar_t* session_name, |
67 const wchar_t* logfile_path, bool realtime) { | 67 const wchar_t* logfile_path, bool realtime) { |
68 DCHECK(NULL == session_ && session_name_.empty()); | 68 DCHECK(NULL == session_ && session_name_.empty()); |
69 | 69 |
70 EtwTraceProperties prop; | 70 EtwTraceProperties prop; |
71 prop.SetLoggerFileName(logfile_path); | 71 prop.SetLoggerFileName(logfile_path); |
72 EVENT_TRACE_PROPERTIES& p = *prop.get(); | 72 EVENT_TRACE_PROPERTIES& p = *prop.get(); |
73 p.Wnode.ClientContext = 1; // QPC timer accuracy. | 73 p.Wnode.ClientContext = 1; // QPC timer accuracy. |
74 p.LogFileMode = EVENT_TRACE_FILE_MODE_SEQUENTIAL; // Sequential log. | 74 p.LogFileMode = EVENT_TRACE_FILE_MODE_SEQUENTIAL; // Sequential log. |
75 if (realtime) | 75 if (realtime) |
76 p.LogFileMode |= EVENT_TRACE_REAL_TIME_MODE; | 76 p.LogFileMode |= EVENT_TRACE_REAL_TIME_MODE; |
77 | 77 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 HRESULT EtwTraceController::Flush(const wchar_t* session_name, | 164 HRESULT EtwTraceController::Flush(const wchar_t* session_name, |
165 EtwTraceProperties* properties) { | 165 EtwTraceProperties* properties) { |
166 DCHECK(properties != NULL); | 166 DCHECK(properties != NULL); |
167 ULONG err = ::ControlTrace(NULL, session_name, properties->get(), | 167 ULONG err = ::ControlTrace(NULL, session_name, properties->get(), |
168 EVENT_TRACE_CONTROL_FLUSH); | 168 EVENT_TRACE_CONTROL_FLUSH); |
169 return HRESULT_FROM_WIN32(err); | 169 return HRESULT_FROM_WIN32(err); |
170 } | 170 } |
171 | 171 |
172 } // namespace win | 172 } // namespace win |
173 } // namespace base | 173 } // namespace base |
OLD | NEW |