Chromium Code Reviews| 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" | |
|
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.
| |
| 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( | |
|
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.
| |
| 28 const std::string& agent_name, | |
| 29 const std::string& events_label, | |
| 30 const scoped_refptr<base::RefCountedString>& events_str_ptr)> | |
| 31 StopAgentTracingCallback; | |
| 32 | |
| 33 // Get the name of the tracing agent. The name should be one of the possible | |
| 34 // tracing agent names declared below. | |
| 35 virtual std::string GetTracingAgentName() = 0; | |
| 36 | |
| 37 // Get the trace event label of this tracing agent. The label should be one of | |
| 38 // the possible trace event labels declared below. | |
| 39 virtual std::string GetTraceEventLabel() = 0; | |
| 40 | |
| 41 // Start tracing on the tracing agent with the trace configuration. | |
| 42 virtual bool StartAgentTracing(const TraceConfig& trace_config) = 0; | |
| 43 | |
| 44 // Stop tracing on the tracing agent. The trace data will be passed back to | |
| 45 // the TracingController via the callback. | |
| 46 virtual void StopAgentTracing(const StopAgentTracingCallback& callback) = 0; | |
| 47 | |
| 48 // Check if the tracing agent supports explicit clock synchronization. | |
| 49 virtual bool SupportsExplicitClockSync(); | |
| 50 | |
| 51 // Record a clock sync marker issued by another tracing agent. This is only | |
| 52 // used if the tracing agent supports explicit clock synchronization. | |
| 53 virtual void RecordClockSyncMarker( | |
| 54 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,
| |
| 55 | |
| 56 // Issue clock sync markers to other tracing agents if possible. This is only | |
| 57 // used if the tracing agent supports explicit clock synchronization. | |
| 58 virtual void IssueClockSyncMarker(); | |
| 59 | |
| 60 virtual ~TracingAgent() {} | |
| 61 | |
| 62 // 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.
| |
| 63 // should declare their name here. | |
| 64 static const char kChromeTracingAgentName[]; | |
| 65 static const char kCrOSTracingAgentName[]; | |
| 66 static const char kETWTracingAgentName[]; | |
| 67 static const char kPowerTracingAgentName[]; | |
| 68 | |
| 69 // Declare all possible trace event labels here. | |
| 70 static const char kChromeTraceLabel[]; | |
| 71 static const char kMetadataTraceLabel[]; | |
| 72 static const char kPowerTraceLabel[]; | |
| 73 static const char kSystemTraceLabel[]; | |
| 74 }; | |
| 75 | |
| 76 } // namespace trace_event | |
| 77 } // namespace base | |
| 78 | |
| 79 #endif // BASE_TRACE_EVENT_TRACING_AGENT_H_ | |
| OLD | NEW |