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.
7 // To participate in the tracing ecosystem, implement the TraceController
8 // interface and connect to the tracing app. Then, when the controller's Start()
9 // function is called collect tracing data and pass it back via the provided
10 // TraceDataCollector interface up until Stop() is called.
12 interface TraceController {
13 StartTracing(string categories, TraceDataCollector collector);
17 interface TraceDataCollector {
18 DataCollected(string json);
21 interface TraceCoordinator {
22 // Request tracing data from all connected TraceControllers to stream to
24 Start(handle<data_pipe_producer> stream, string categories);
26 // Stop tracing and flush results to file.
30 // These times are used to determine startup performance metrics.
31 // TODO(msw): Use TimeTicks to avoid system clock changes: crbug.com/521164
32 struct StartupPerformanceTimes {
33 // TODO(msw): Rename to match "BrowserMainEntryTimeAbsolute" metric?
34 int64 shell_process_creation_time;
35 int64 shell_main_entry_point_time;
36 int64 browser_message_loop_start_time;
37 int64 browser_window_display_time;
38 int64 browser_open_tabs_time_delta;
39 // TODO(msw): Rename to avoid "web contents"?
40 int64 first_web_contents_main_frame_load_time;
41 // TODO(msw): Rename to match "FirstWebContents.NonEmptyPaint" metric?
42 int64 first_visually_non_empty_layout_time;
45 // This interface accepts startup performance timing from a variety of sources.
46 interface StartupPerformanceDataCollector {
47 // These setters may be called many times, only the first time is recorded.
48 SetShellProcessCreationTime(int64 time);
49 SetShellMainEntryPointTime(int64 time);
50 SetBrowserMessageLoopStartTime(int64 time);
51 SetBrowserWindowDisplayTime(int64 time);
52 SetBrowserOpenTabsTimeDelta(int64 delta);
53 SetFirstWebContentsMainFrameLoadTime(int64 time);
54 SetFirstVisuallyNonEmptyLayoutTime(int64 time);
56 // Get the currently available startup performance times.
57 GetStartupPerformanceTimes() => (StartupPerformanceTimes times);