Chromium Code Reviews| Index: base/trace_event/tracing_agent.h |
| diff --git a/base/trace_event/tracing_agent.h b/base/trace_event/tracing_agent.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..11e822aff071101d48f226123afa6701b746990f |
| --- /dev/null |
| +++ b/base/trace_event/tracing_agent.h |
| @@ -0,0 +1,79 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BASE_TRACE_EVENT_TRACING_AGENT_H_ |
| +#define BASE_TRACE_EVENT_TRACING_AGENT_H_ |
| + |
| +#include "base/base_export.h" |
| +#include "base/callback.h" |
| +#include "base/memory/ref_counted_memory.h" |
| +#include "base/trace_event/trace_config.h" |
|
Primiano Tucci (use gerrit)
2015/12/01 11:42:43
this header is not needed, just forward declare wh
Zhen Wang
2015/12/01 18:02:52
Done.
|
| +#include "base/values.h" |
| + |
| +namespace base { |
| +namespace trace_event { |
| + |
| +// A tracing agent is the entity that records its own sort of trace. Each |
| +// tracing method that produces its own trace log should implement this |
| +// interface. And all tracing agents are and should only be controlled by the |
| +// TracingController. |
| +// |
| +// Some existing examples include TracingControllerImpl for Chrome trace events, |
| +// DebugDaemonClient for CrOs system trace, EtwSystemEventConsumer for Windows |
| +// system trace and PowerTracingAgent for BattOr power trace. |
| +class BASE_EXPORT TracingAgent { |
| + public: |
| + typedef base::Callback<void( |
|
Primiano Tucci (use gerrit)
2015/12/01 11:42:43
these days "using" is the thing :)
using StopAgent
Zhen Wang
2015/12/01 18:02:52
Done.
|
| + const std::string& agent_name, |
| + const std::string& events_label, |
| + const scoped_refptr<base::RefCountedString>& events_str_ptr)> |
| + StopAgentTracingCallback; |
| + |
| + // Get the name of the tracing agent. The name should be one of the possible |
| + // tracing agent names declared below. |
| + virtual std::string GetTracingAgentName() = 0; |
| + |
| + // Get the trace event label of this tracing agent. The label should be one of |
| + // the possible trace event labels declared below. |
| + virtual std::string GetTraceEventLabel() = 0; |
| + |
| + // Start tracing on the tracing agent with the trace configuration. |
| + virtual bool StartAgentTracing(const TraceConfig& trace_config) = 0; |
| + |
| + // Stop tracing on the tracing agent. The trace data will be passed back to |
| + // the TracingController via the callback. |
| + virtual void StopAgentTracing(const StopAgentTracingCallback& callback) = 0; |
| + |
| + // Check if the tracing agent supports explicit clock synchronization. |
| + virtual bool SupportsExplicitClockSync(); |
| + |
| + // Record a clock sync marker issued by another tracing agent. This is only |
| + // used if the tracing agent supports explicit clock synchronization. |
| + virtual void RecordClockSyncMarker( |
| + scoped_ptr<base::DictionaryValue> marker); |
|
Primiano Tucci (use gerrit)
2015/12/01 11:42:43
Not related with this CL but out curiosity why thi
Zhen Wang
2015/12/01 18:02:52
Because this marker will be recorded by the agent,
|
| + |
| + // Issue clock sync markers to other tracing agents if possible. This is only |
| + // used if the tracing agent supports explicit clock synchronization. |
| + virtual void IssueClockSyncMarker(); |
| + |
| + virtual ~TracingAgent() {} |
| + |
| + // Declare all possible tracing agent names here. All new tracing agents |
|
Primiano Tucci (use gerrit)
2015/12/01 11:42:43
See https://google.github.io/styleguide/cppguide.h
Zhen Wang
2015/12/01 18:02:52
Done.
|
| + // should declare their name here. |
| + static const char kChromeTracingAgentName[]; |
| + static const char kCrOSTracingAgentName[]; |
| + static const char kETWTracingAgentName[]; |
| + static const char kPowerTracingAgentName[]; |
| + |
| + // Declare all possible trace event labels here. |
| + static const char kChromeTraceLabel[]; |
| + static const char kMetadataTraceLabel[]; |
| + static const char kPowerTraceLabel[]; |
| + static const char kSystemTraceLabel[]; |
| +}; |
| + |
| +} // namespace trace_event |
| +} // namespace base |
| + |
| +#endif // BASE_TRACE_EVENT_TRACING_AGENT_H_ |