OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_TRACE_EVENT_TRACING_AGENT_H_ |
| 6 #define BASE_TRACE_EVENT_TRACING_AGENT_H_ |
| 7 |
| 8 #include "base/base_export.h" |
| 9 #include "base/callback.h" |
| 10 #include "base/memory/ref_counted_memory.h" |
| 11 #include "base/trace_event/trace_config.h" |
| 12 #include "base/values.h" |
| 13 |
| 14 namespace base { |
| 15 namespace trace_event { |
| 16 |
| 17 // A tracing agent is the entity that records its own sort of trace. Each |
| 18 // tracing method that produces its own trace log should implement this |
| 19 // interface. And all tracing agents are and should only be controlled by the |
| 20 // TracingController. |
| 21 // |
| 22 // Some existing examples include TracingControllerImpl for Chrome trace events, |
| 23 // DebugDaemonClient for CrOs system trace, EtwSystemEventConsumer for Windows |
| 24 // system trace and PowerTracingAgent for BattOr power trace. |
| 25 class BASE_EXPORT TracingAgent { |
| 26 public: |
| 27 typedef base::Callback<void( |
| 28 const std::string& agent_name, |
| 29 const scoped_refptr<base::RefCountedString>& events_str_ptr)> |
| 30 StopAgentTracingCallback; |
| 31 |
| 32 // Get the name of the tracing agent. The name should be one of the possible |
| 33 // tracing agent names declared below. |
| 34 virtual std::string GetTracingAgentName() = 0; |
| 35 |
| 36 // Start tracing on the tracing agent with the trace configuration. |
| 37 virtual bool StartAgentTracing(const TraceConfig& trace_config) = 0; |
| 38 |
| 39 // Stop tracing on the tracing agent. The trace data will be passed back to |
| 40 // the TracingController via the callback. |
| 41 virtual void StopAgentTracing(const StopAgentTracingCallback& callback) = 0; |
| 42 |
| 43 // Check if the tracing agent supports explicit clock synchronization. |
| 44 virtual bool SupportsExplicitClockSync(); |
| 45 |
| 46 // Record a clock sync marker issued by another tracing agent. This is only |
| 47 // used if the tracing agent supports explicit clock synchronization. |
| 48 virtual void RecordClockSyncMarker( |
| 49 scoped_ptr<base::DictionaryValue> marker); |
| 50 |
| 51 // Issue clock sync markers to other tracing agents if possible. This is only |
| 52 // used if the tracing agent supports explicit clock synchronization. |
| 53 virtual void IssueClockSyncMarker(); |
| 54 |
| 55 virtual ~TracingAgent() {} |
| 56 |
| 57 // Declare all possible tracing agent names here. All new tracing agents |
| 58 // should declare their name here. |
| 59 static const char kChromeTracingAgentName[]; |
| 60 static const char kCrOSTracingAgentName[]; |
| 61 static const char kETWTracingAgentName[]; |
| 62 static const char kPowerTracingAgentName[]; |
| 63 }; |
| 64 |
| 65 } // namespace trace_event |
| 66 } // namespace base |
| 67 |
| 68 #endif // BASE_TRACE_EVENT_TRACING_AGENT_H_ |
OLD | NEW |