James Robinson | 85ccf05 | 2014-12-01 16:31:03 -0800 | [diff] [blame] | 1 | // Copyright 2014 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 | module tracing; |
| 6 | |
Viet-Trung Luu | 97276c7 | 2015-02-12 22:52:03 -0800 | [diff] [blame] | 7 | // To participate in the tracing ecosystem, implement the TraceController |
James Robinson | 85ccf05 | 2014-12-01 16:31:03 -0800 | [diff] [blame] | 8 | // interface and connect to the tracing app. Then, when the controller's Start() |
James Robinson | 47225cb | 2015-02-02 16:56:34 -0800 | [diff] [blame] | 9 | // function is called collect tracing data and pass it back via the provided |
James Robinson | 85ccf05 | 2014-12-01 16:31:03 -0800 | [diff] [blame] | 10 | // TraceDataCollector interface up until Stop() is called. |
| 11 | |
James Robinson | 85ccf05 | 2014-12-01 16:31:03 -0800 | [diff] [blame] | 12 | interface TraceController { |
James Robinson | 47225cb | 2015-02-02 16:56:34 -0800 | [diff] [blame] | 13 | StartTracing(string categories, TraceDataCollector collector); |
James Robinson | 85ccf05 | 2014-12-01 16:31:03 -0800 | [diff] [blame] | 14 | StopTracing(); |
| 15 | }; |
| 16 | |
James Robinson | 85ccf05 | 2014-12-01 16:31:03 -0800 | [diff] [blame] | 17 | interface TraceDataCollector { |
| 18 | DataCollected(string json); |
James Robinson | 85ccf05 | 2014-12-01 16:31:03 -0800 | [diff] [blame] | 19 | }; |
| 20 | |
| 21 | interface TraceCoordinator { |
Adam Barth | 9b3cd6f | 2015-01-15 16:32:16 -0800 | [diff] [blame] | 22 | // Request tracing data from all connected TraceControllers to stream to |
| 23 | // |stream|. |
| 24 | Start(handle<data_pipe_producer> stream, string categories); |
James Robinson | 85ccf05 | 2014-12-01 16:31:03 -0800 | [diff] [blame] | 25 | |
| 26 | // Stop tracing and flush results to file. |
| 27 | StopAndFlush(); |
| 28 | }; |