| OLD | NEW |
| (Empty) |
| 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 | |
| 7 // To participate in the tracing ecosystem, implement the TraceProvider | |
| 8 // interface and connect to the tracing app. Then, when the provider's Start() | |
| 9 // function is called collect tracing data and pass it back via the provided | |
| 10 // TraceRecorder interface up until Stop() is called. | |
| 11 | |
| 12 interface TraceProvider { | |
| 13 // Categories can either be the empty string to mean the default set of | |
| 14 // categories or a comma-delimited list of categories to trace. | |
| 15 StartTracing(string categories, TraceRecorder recorder); | |
| 16 StopTracing(); | |
| 17 }; | |
| 18 | |
| 19 interface TraceRecorder { | |
| 20 Record(string json); | |
| 21 }; | |
| 22 | |
| 23 interface TraceCollector { | |
| 24 // Request tracing data from all connected providers to stream to | |
| 25 // |stream|. | |
| 26 Start(handle<data_pipe_producer> stream, string categories); | |
| 27 | |
| 28 // Stop tracing and flush results to the |stream| passed in to Start(). | |
| 29 // Closes |stream| when all data is collected. | |
| 30 StopAndFlush(); | |
| 31 }; | |
| 32 | |
| 33 // These times are used to determine startup performance metrics. | |
| 34 // TODO(msw): Find a way to convert *_time metrics into TimeTicks earlier (ref: | |
| 35 // https://goo.gl/vZ8dZW). | |
| 36 struct StartupPerformanceTimes { | |
| 37 // TODO(msw): Rename to match "BrowserMainEntryTimeAbsolute" metric? | |
| 38 int64 shell_process_creation_time; | |
| 39 int64 shell_main_entry_point_time; | |
| 40 int64 browser_message_loop_start_ticks; | |
| 41 int64 browser_window_display_ticks; | |
| 42 int64 browser_open_tabs_time_delta; | |
| 43 // TODO(msw): Rename to avoid "web contents"? | |
| 44 int64 first_web_contents_main_frame_load_ticks; | |
| 45 // TODO(msw): Rename to match "FirstWebContents.NonEmptyPaint" metric? | |
| 46 int64 first_visually_non_empty_layout_ticks; | |
| 47 }; | |
| 48 | |
| 49 // This interface accepts startup performance timing from a variety of sources. | |
| 50 interface StartupPerformanceDataCollector { | |
| 51 // These setters may be called many times, only the first time is recorded. | |
| 52 SetShellProcessCreationTime(int64 time); | |
| 53 SetShellMainEntryPointTime(int64 time); | |
| 54 SetBrowserMessageLoopStartTicks(int64 ticks); | |
| 55 SetBrowserWindowDisplayTicks(int64 ticks); | |
| 56 SetBrowserOpenTabsTimeDelta(int64 delta); | |
| 57 SetFirstWebContentsMainFrameLoadTicks(int64 ticks); | |
| 58 SetFirstVisuallyNonEmptyLayoutTicks(int64 ticks); | |
| 59 | |
| 60 // Get the currently available startup performance times. | |
| 61 GetStartupPerformanceTimes() => (StartupPerformanceTimes times); | |
| 62 }; | |
| OLD | NEW |