Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1549)

Unified Diff: base/trace_event/tracing_agent.h

Issue 1468173003: [Tracing Clock Sync] Add TracingAgent interface in Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile failure for cros Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a78d36cb7a6d15b7ec85297c281c9e7ec164d2fc
--- /dev/null
+++ b/base/trace_event/tracing_agent.h
@@ -0,0 +1,68 @@
+// 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"
+#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(
+ const std::string& agent_name,
+ 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;
+
+ // 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);
+
+ // 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
+ // should declare their name here.
+ static const char kChromeTracingAgentName[];
+ static const char kCrOSTracingAgentName[];
+ static const char kETWTracingAgentName[];
+ static const char kPowerTracingAgentName[];
+};
+
+} // namespace trace_event
+} // namespace base
+
+#endif // BASE_TRACE_EVENT_TRACING_AGENT_H_

Powered by Google App Engine
This is Rietveld 408576698