Commit 1d6d5027 authored by Joe Downing's avatar Joe Downing Committed by Commit Bot

Hooking up buffer_size in EtwTraceController::StartRealtimeSession

I am working on some ETW stuff for Chrome Remote Desktop and I
noticed that this parameter is unused and a default value of 16KB
is always used.  This isn't a big deal as the only caller appears
to be its unit tests but it seemed like the value passed in
should do something.  The other approach would be to remove the
param but adjusting the buffer size seems like a reasonable thing
to expose (assuming the param is actually used).

Change-Id: I453ac2417d68f6c16fecd517cf1cd74c5aa15731
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2511290
Commit-Queue: Joe Downing <joedow@google.com>
Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823240}
parent f969d001
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "base/win/event_trace_controller.h" #include "base/win/event_trace_controller.h"
#include "base/check.h" #include "base/check.h"
constexpr size_t kDefaultRealtimeBufferSizeKb = 16;
namespace base { namespace base {
namespace win { namespace win {
...@@ -81,11 +83,12 @@ HRESULT EtwTraceController::StartFileSession(const wchar_t* session_name, ...@@ -81,11 +83,12 @@ HRESULT EtwTraceController::StartFileSession(const wchar_t* session_name,
HRESULT EtwTraceController::StartRealtimeSession(const wchar_t* session_name, HRESULT EtwTraceController::StartRealtimeSession(const wchar_t* session_name,
size_t buffer_size) { size_t buffer_size) {
DCHECK(NULL == session_ && session_name_.empty()); DCHECK(NULL == session_ && session_name_.empty());
EtwTraceProperties prop; EtwTraceProperties prop;
EVENT_TRACE_PROPERTIES& p = *prop.get(); EVENT_TRACE_PROPERTIES& p = *prop.get();
p.LogFileMode = EVENT_TRACE_REAL_TIME_MODE | EVENT_TRACE_USE_PAGED_MEMORY; p.LogFileMode = EVENT_TRACE_REAL_TIME_MODE | EVENT_TRACE_USE_PAGED_MEMORY;
p.FlushTimer = 1; // flush every second. p.FlushTimer = 1; // flush every second.
p.BufferSize = 16; // 16 K buffers. p.BufferSize = buffer_size ? buffer_size : kDefaultRealtimeBufferSizeKb;
p.LogFileNameOffset = 0; p.LogFileNameOffset = 0;
return Start(session_name, &prop); return Start(session_name, &prop);
} }
......
...@@ -98,7 +98,8 @@ class BASE_EXPORT EtwTraceController { ...@@ -98,7 +98,8 @@ class BASE_EXPORT EtwTraceController {
const wchar_t* logfile_path, const wchar_t* logfile_path,
bool realtime = false); bool realtime = false);
// Starts a realtime session with some default properties. // Starts a realtime session with some default properties. |buffer_size| is
// in KB. A default value for |buffer_size| is used if 0 is passed in.
HRESULT StartRealtimeSession(const wchar_t* session_name, size_t buffer_size); HRESULT StartRealtimeSession(const wchar_t* session_name, size_t buffer_size);
// Enables "provider" at "level" for this session. // Enables "provider" at "level" for this session.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment