Index: services/resource_coordinator/public/interfaces/tracing/tracing.mojom |
diff --git a/services/resource_coordinator/public/interfaces/tracing/tracing.mojom b/services/resource_coordinator/public/interfaces/tracing/tracing.mojom |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fb8cd3cbac55e130bd256d99acf7e8df6844c50c |
--- /dev/null |
+++ b/services/resource_coordinator/public/interfaces/tracing/tracing.mojom |
@@ -0,0 +1,58 @@ |
+// Copyright 2017 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. |
+ |
+module resource_coordinator.tracing.mojom; |
+ |
+import "mojo/common/time.mojom"; |
+import "mojo/common/values.mojom"; |
+ |
+// The JSON type of data coming from a tracing agents. |
+// |
+// - All agents with the same label should have the same type. |
+// - There can be multiple agents with the same label, if their data type is |
+// ARRAY. Their data will be concatenated together and separated by commas. |
+// - There can be only one agent with data type STRING. |
+enum TraceDataType { |
+ ARRAY, |
+ STRING |
+}; |
+ |
+// Tracing agents, like |chrome|, |etw|, |battor|, and |cros|, use this |
+// interface to register themselves to the tracing service. |
+interface Factory { |
+ RegisterAgent(Agent agent, string name, string label, TraceDataType type, |
+ bool supports_explicit_clock_sync_); |
+}; |
+ |
+// There should be at most one implementation of this interface per process. |
+// When the tracing service calls |StopAndFlush| on an agent, the agent begins |
+// serializing data into the recorder that was given in the |StartTracing| call. |
+// When finished, the agent should close the recorder connection to signal the |
+// tracing service that no more data will be sent. |
+interface Agent { |
+ StartTracing(string categories, Recorder recorder); |
+ StopAndFlush(); |
+ RequestClockSyncMarker() => (mojo.common.mojom.TimeTicks issue_ts, |
+ mojo.common.mojom.TimeTicks issue_end_ts); |
+ RequestBufferStatus() => (uint32 capacity, uint32 count); |
+}; |
+ |
+// An agent can make several calls to |AddChunk|. Chunks will be concatenated |
+// with no separator (type STRING) or using comma as the separator (type ARRAY). |
+// There should be only one agent of type STRING per agent label; otherwise |
+// their trace data would be mixed up. |
+interface Recorder { |
+ AddChunk(string chunk); |
+ AddMetadata(mojo.common.mojom.DictionaryValue metadata); |
+}; |
+ |
+// A tracing controller uses this interface to coordinate trace data collection |
+// from all registered agents. At any given time, there should be at most one |
+// connected controller. |
+interface Coordinator { |
+ StartTracing(handle<data_pipe_producer> stream, string categories); |
+ StopAndFlush(); |
+ IsTracing() => (bool is_tracing); |
+ RequestBufferUsage() => (float percent_full, uint32 approximate_count); |
+}; |