Commit b06896ff authored by charliea's avatar charliea Committed by Commit bot

Rename EtwSystemEventConsumerWin to EtwTracingAgent

This brings it up to speed with our present naming, where classes that
inherit from TracingAgent end with TracingAgent themselves.

Review URL: https://codereview.chromium.org/1908373003

Cr-Commit-Position: refs/heads/master@{#389895}
parent 6b1aa778
...@@ -22,8 +22,8 @@ class TraceConfig; ...@@ -22,8 +22,8 @@ class TraceConfig;
// tracing method that produces its own trace log should implement this // tracing method that produces its own trace log should implement this
// interface. All tracing agents must only be controlled by TracingController. // interface. All tracing agents must only be controlled by TracingController.
// Some existing examples include TracingControllerImpl for Chrome trace events, // Some existing examples include TracingControllerImpl for Chrome trace events,
// DebugDaemonClient for CrOs system trace, EtwSystemEventConsumer for Windows // DebugDaemonClient for CrOs system trace, EtwTracingAgent for Windows system
// system trace and PowerTracingAgent for BattOr power trace. // trace and PowerTracingAgent for BattOr power trace.
class BASE_EXPORT TracingAgent { class BASE_EXPORT TracingAgent {
public: public:
using StartAgentTracingCallback = using StartAgentTracingCallback =
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/browser/tracing/etw_system_event_consumer_win.h" #include "content/browser/tracing/etw_tracing_agent_win.h"
#include <stdint.h> #include <stdint.h>
...@@ -35,22 +35,22 @@ std::string GuidToString(const GUID& guid) { ...@@ -35,22 +35,22 @@ std::string GuidToString(const GUID& guid) {
} // namespace } // namespace
EtwSystemEventConsumer::EtwSystemEventConsumer() EtwTracingAgent::EtwTracingAgent()
: thread_("EtwConsumerThread") { : thread_("EtwConsumerThread") {
} }
EtwSystemEventConsumer::~EtwSystemEventConsumer() { EtwTracingAgent::~EtwTracingAgent() {
} }
std::string EtwSystemEventConsumer::GetTracingAgentName() { std::string EtwTracingAgent::GetTracingAgentName() {
return kETWTracingAgentName; return kETWTracingAgentName;
} }
std::string EtwSystemEventConsumer::GetTraceEventLabel() { std::string EtwTracingAgent::GetTraceEventLabel() {
return kETWTraceLabel; return kETWTraceLabel;
} }
void EtwSystemEventConsumer::StartAgentTracing( void EtwTracingAgent::StartAgentTracing(
const base::trace_event::TraceConfig& trace_config, const base::trace_event::TraceConfig& trace_config,
const StartAgentTracingCallback& callback) { const StartAgentTracingCallback& callback) {
// Activate kernel tracing. // Activate kernel tracing.
...@@ -65,7 +65,7 @@ void EtwSystemEventConsumer::StartAgentTracing( ...@@ -65,7 +65,7 @@ void EtwSystemEventConsumer::StartAgentTracing(
thread_.Start(); thread_.Start();
thread_.message_loop()->PostTask( thread_.message_loop()->PostTask(
FROM_HERE, FROM_HERE,
base::Bind(&EtwSystemEventConsumer::TraceAndConsumeOnThread, base::Bind(&EtwTracingAgent::TraceAndConsumeOnThread,
base::Unretained(this))); base::Unretained(this)));
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
...@@ -73,7 +73,7 @@ void EtwSystemEventConsumer::StartAgentTracing( ...@@ -73,7 +73,7 @@ void EtwSystemEventConsumer::StartAgentTracing(
base::Bind(callback, GetTracingAgentName(), true /* success */)); base::Bind(callback, GetTracingAgentName(), true /* success */));
} }
void EtwSystemEventConsumer::StopAgentTracing( void EtwTracingAgent::StopAgentTracing(
const StopAgentTracingCallback& callback) { const StopAgentTracingCallback& callback) {
// Deactivate kernel tracing. // Deactivate kernel tracing.
if (!StopKernelSessionTracing()) { if (!StopKernelSessionTracing()) {
...@@ -82,12 +82,12 @@ void EtwSystemEventConsumer::StopAgentTracing( ...@@ -82,12 +82,12 @@ void EtwSystemEventConsumer::StopAgentTracing(
// Stop consuming and flush events. // Stop consuming and flush events.
thread_.message_loop()->PostTask(FROM_HERE, thread_.message_loop()->PostTask(FROM_HERE,
base::Bind(&EtwSystemEventConsumer::FlushOnThread, base::Bind(&EtwTracingAgent::FlushOnThread,
base::Unretained(this), base::Unretained(this),
callback)); callback));
} }
void EtwSystemEventConsumer::OnStopSystemTracingDone( void EtwTracingAgent::OnStopSystemTracingDone(
const StopAgentTracingCallback& callback, const StopAgentTracingCallback& callback,
const scoped_refptr<base::RefCountedString>& result) { const scoped_refptr<base::RefCountedString>& result) {
...@@ -98,7 +98,7 @@ void EtwSystemEventConsumer::OnStopSystemTracingDone( ...@@ -98,7 +98,7 @@ void EtwSystemEventConsumer::OnStopSystemTracingDone(
callback.Run(GetTracingAgentName(), GetTraceEventLabel(), result); callback.Run(GetTracingAgentName(), GetTraceEventLabel(), result);
} }
bool EtwSystemEventConsumer::StartKernelSessionTracing() { bool EtwTracingAgent::StartKernelSessionTracing() {
// Enabled flags (tracing facilities). // Enabled flags (tracing facilities).
uint32_t enabled_flags = EVENT_TRACE_FLAG_IMAGE_LOAD | uint32_t enabled_flags = EVENT_TRACE_FLAG_IMAGE_LOAD |
EVENT_TRACE_FLAG_PROCESS | EVENT_TRACE_FLAG_THREAD | EVENT_TRACE_FLAG_PROCESS | EVENT_TRACE_FLAG_THREAD |
...@@ -139,23 +139,23 @@ bool EtwSystemEventConsumer::StartKernelSessionTracing() { ...@@ -139,23 +139,23 @@ bool EtwSystemEventConsumer::StartKernelSessionTracing() {
return true; return true;
} }
bool EtwSystemEventConsumer::StopKernelSessionTracing() { bool EtwTracingAgent::StopKernelSessionTracing() {
HRESULT hr = base::win::EtwTraceController::Stop( HRESULT hr = base::win::EtwTraceController::Stop(
KERNEL_LOGGER_NAME, &properties_); KERNEL_LOGGER_NAME, &properties_);
return SUCCEEDED(hr); return SUCCEEDED(hr);
} }
// static // static
EtwSystemEventConsumer* EtwSystemEventConsumer::GetInstance() { EtwTracingAgent* EtwTracingAgent::GetInstance() {
return base::Singleton<EtwSystemEventConsumer>::get(); return base::Singleton<EtwTracingAgent>::get();
} }
// static // static
void EtwSystemEventConsumer::ProcessEvent(EVENT_TRACE* event) { void EtwTracingAgent::ProcessEvent(EVENT_TRACE* event) {
EtwSystemEventConsumer::GetInstance()->AppendEventToBuffer(event); EtwTracingAgent::GetInstance()->AppendEventToBuffer(event);
} }
void EtwSystemEventConsumer::AddSyncEventToBuffer() { void EtwTracingAgent::AddSyncEventToBuffer() {
// Sync the clocks. // Sync the clocks.
base::Time walltime = base::Time::NowFromSystemTime(); base::Time walltime = base::Time::NowFromSystemTime();
base::TimeTicks now = base::TimeTicks::Now(); base::TimeTicks now = base::TimeTicks::Now();
...@@ -181,7 +181,7 @@ void EtwSystemEventConsumer::AddSyncEventToBuffer() { ...@@ -181,7 +181,7 @@ void EtwSystemEventConsumer::AddSyncEventToBuffer() {
events_->Append(value.release()); events_->Append(value.release());
} }
void EtwSystemEventConsumer::AppendEventToBuffer(EVENT_TRACE* event) { void EtwTracingAgent::AppendEventToBuffer(EVENT_TRACE* event) {
using base::FundamentalValue; using base::FundamentalValue;
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
...@@ -213,7 +213,7 @@ void EtwSystemEventConsumer::AppendEventToBuffer(EVENT_TRACE* event) { ...@@ -213,7 +213,7 @@ void EtwSystemEventConsumer::AppendEventToBuffer(EVENT_TRACE* event) {
events_->Append(value.release()); events_->Append(value.release());
} }
void EtwSystemEventConsumer::TraceAndConsumeOnThread() { void EtwTracingAgent::TraceAndConsumeOnThread() {
// Create the events buffer. // Create the events buffer.
events_.reset(new base::ListValue()); events_.reset(new base::ListValue());
...@@ -227,7 +227,7 @@ void EtwSystemEventConsumer::TraceAndConsumeOnThread() { ...@@ -227,7 +227,7 @@ void EtwSystemEventConsumer::TraceAndConsumeOnThread() {
Close(); Close();
} }
void EtwSystemEventConsumer::FlushOnThread( void EtwTracingAgent::FlushOnThread(
const StopAgentTracingCallback& callback) { const StopAgentTracingCallback& callback) {
// Add the header information to the stream. // Add the header information to the stream.
std::unique_ptr<base::DictionaryValue> header(new base::DictionaryValue()); std::unique_ptr<base::DictionaryValue> header(new base::DictionaryValue());
...@@ -246,7 +246,7 @@ void EtwSystemEventConsumer::FlushOnThread( ...@@ -246,7 +246,7 @@ void EtwSystemEventConsumer::FlushOnThread(
base::RefCountedString::TakeString(&output); base::RefCountedString::TakeString(&output);
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
base::Bind(&EtwSystemEventConsumer::OnStopSystemTracingDone, base::Bind(&EtwTracingAgent::OnStopSystemTracingDone,
base::Unretained(this), base::Unretained(this),
callback, callback,
result)); result));
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_ #ifndef CONTENT_BROWSER_TRACING_ETW_TRACING_AGENT_H_
#define CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_ #define CONTENT_BROWSER_TRACING_ETW_TRACING_AGENT_H_
#include <memory> #include <memory>
...@@ -23,8 +23,8 @@ struct DefaultSingletonTraits; ...@@ -23,8 +23,8 @@ struct DefaultSingletonTraits;
namespace content { namespace content {
class EtwSystemEventConsumer class EtwTracingAgent
: public base::win::EtwTraceConsumerBase<EtwSystemEventConsumer>, : public base::win::EtwTraceConsumerBase<EtwTracingAgent>,
public base::trace_event::TracingAgent { public base::trace_event::TracingAgent {
public: public:
// base::trace_event::TracingAgent implementation. // base::trace_event::TracingAgent implementation.
...@@ -35,23 +35,23 @@ class EtwSystemEventConsumer ...@@ -35,23 +35,23 @@ class EtwSystemEventConsumer
void StopAgentTracing(const StopAgentTracingCallback& callback) override; void StopAgentTracing(const StopAgentTracingCallback& callback) override;
// Retrieve the ETW consumer instance. // Retrieve the ETW consumer instance.
static EtwSystemEventConsumer* GetInstance(); static EtwTracingAgent* GetInstance();
private: private:
// This allows constructor and destructor to be private and usable only // This allows constructor and destructor to be private and usable only
// by the Singleton class. // by the Singleton class.
friend struct base::DefaultSingletonTraits<EtwSystemEventConsumer>; friend struct base::DefaultSingletonTraits<EtwTracingAgent>;
// Constructor. // Constructor.
EtwSystemEventConsumer(); EtwTracingAgent();
~EtwSystemEventConsumer() override; ~EtwTracingAgent() override;
void AddSyncEventToBuffer(); void AddSyncEventToBuffer();
void AppendEventToBuffer(EVENT_TRACE* event); void AppendEventToBuffer(EVENT_TRACE* event);
// Static override of EtwTraceConsumerBase::ProcessEvent. // Static override of EtwTraceConsumerBase::ProcessEvent.
// @param event the raw ETW event to process. // @param event the raw ETW event to process.
friend class base::win::EtwTraceConsumerBase<EtwSystemEventConsumer>; friend class base::win::EtwTraceConsumerBase<EtwTracingAgent>;
static void ProcessEvent(EVENT_TRACE* event); static void ProcessEvent(EVENT_TRACE* event);
// Request the ETW trace controller to activate the kernel tracing. // Request the ETW trace controller to activate the kernel tracing.
...@@ -75,9 +75,9 @@ class EtwSystemEventConsumer ...@@ -75,9 +75,9 @@ class EtwSystemEventConsumer
TRACEHANDLE session_handle_; TRACEHANDLE session_handle_;
base::win::EtwTraceProperties properties_; base::win::EtwTraceProperties properties_;
DISALLOW_COPY_AND_ASSIGN(EtwSystemEventConsumer); DISALLOW_COPY_AND_ASSIGN(EtwTracingAgent);
}; };
} // namespace content } // namespace content
#endif // CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_ #endif // CONTENT_BROWSER_TRACING_ETW_TRACING_AGENT_H_
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#endif #endif
#if defined(OS_WIN) #if defined(OS_WIN)
#include "content/browser/tracing/etw_system_event_consumer_win.h" #include "content/browser/tracing/etw_tracing_agent_win.h"
#endif #endif
using base::trace_event::TraceLog; using base::trace_event::TraceLog;
...@@ -279,7 +279,7 @@ bool TracingControllerImpl::StartTracing( ...@@ -279,7 +279,7 @@ bool TracingControllerImpl::StartTracing(
++pending_start_tracing_ack_count_; ++pending_start_tracing_ack_count_;
} }
#elif defined(OS_WIN) #elif defined(OS_WIN)
EtwSystemEventConsumer::GetInstance()->StartAgentTracing( EtwTracingAgent::GetInstance()->StartAgentTracing(
trace_config, trace_config,
base::Bind(&TracingControllerImpl::OnStartAgentTracingAcked, base::Bind(&TracingControllerImpl::OnStartAgentTracingAcked,
base::Unretained(this))); base::Unretained(this)));
...@@ -586,7 +586,7 @@ void TracingControllerImpl::AddTracingAgent(const std::string& agent_name) { ...@@ -586,7 +586,7 @@ void TracingControllerImpl::AddTracingAgent(const std::string& agent_name) {
return; return;
} }
#elif defined(OS_WIN) #elif defined(OS_WIN)
auto etw_agent = EtwSystemEventConsumer::GetInstance(); auto etw_agent = EtwTracingAgent::GetInstance();
if (agent_name == etw_agent->GetTracingAgentName()) { if (agent_name == etw_agent->GetTracingAgentName()) {
additional_tracing_agents_.push_back(etw_agent); additional_tracing_agents_.push_back(etw_agent);
return; return;
......
...@@ -1575,8 +1575,8 @@ ...@@ -1575,8 +1575,8 @@
'browser/tracing/background_tracing_manager_impl.h', 'browser/tracing/background_tracing_manager_impl.h',
'browser/tracing/background_tracing_rule.cc', 'browser/tracing/background_tracing_rule.cc',
'browser/tracing/background_tracing_rule.h', 'browser/tracing/background_tracing_rule.h',
'browser/tracing/etw_system_event_consumer_win.cc', 'browser/tracing/etw_tracing_agent_win.cc',
'browser/tracing/etw_system_event_consumer_win.h', 'browser/tracing/etw_tracing_agent_win.h',
'browser/tracing/file_tracing_provider_impl.cc', 'browser/tracing/file_tracing_provider_impl.cc',
'browser/tracing/file_tracing_provider_impl.h', 'browser/tracing/file_tracing_provider_impl.h',
'browser/tracing/trace_message_filter.cc', 'browser/tracing/trace_message_filter.cc',
......
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