1/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package perfetto.protos;
20
21message ChromeLatencyInfo {
22  optional int64 trace_id = 1;
23
24  // NEXT ID: 12
25  // All step are optional but the enum is ordered (not by number) below in the
26  // order we expect them to appear if they are emitted in trace in a blocking
27  // fashion.
28  enum Step {
29    STEP_UNSPECIFIED = 0;
30    // Emitted on the browser main thread.
31    STEP_SEND_INPUT_EVENT_UI = 3;
32    // Happens on the renderer's compositor.
33    STEP_HANDLE_INPUT_EVENT_IMPL = 5;
34    STEP_DID_HANDLE_INPUT_AND_OVERSCROLL = 8;
35    // Occurs on the Renderer's main thread.
36    STEP_HANDLE_INPUT_EVENT_MAIN = 4;
37    STEP_MAIN_THREAD_SCROLL_UPDATE = 2;
38    STEP_HANDLE_INPUT_EVENT_MAIN_COMMIT = 1;
39    // Could be emitted on both the renderer's main OR compositor.
40    STEP_HANDLED_INPUT_EVENT_MAIN_OR_IMPL = 9;
41    // Optionally sometimes HANDLED_INPUT_EVENT_MAIN_OR_IMPL will proxy to the
42    // renderer's compositor and this will be emitted.
43    STEP_HANDLED_INPUT_EVENT_IMPL = 10;
44    // Renderer's compositor.
45    STEP_SWAP_BUFFERS = 6;
46    // Happens on the VizCompositor in the GPU process.
47    STEP_DRAW_AND_SWAP = 7;
48    // Happens on the GPU main thread after the swap has completed.
49    STEP_FINISHED_SWAP_BUFFERS = 11;
50    // See above for NEXT ID, enum steps are not ordered by tag number.
51  };
52
53  optional Step step = 2;
54  optional int32 frame_tree_node_id = 3;
55
56  // This enum is a copy of LatencyComponentType enum in Chrome, located in
57  // ui/latency/latency_info.h, modulo added UNKNOWN value per protobuf
58  // practices.
59  enum LatencyComponentType {
60    COMPONENT_UNSPECIFIED = 0;
61    COMPONENT_INPUT_EVENT_LATENCY_BEGIN_RWH = 1;
62    COMPONENT_INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL = 2;
63    COMPONENT_INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL = 3;
64    COMPONENT_INPUT_EVENT_LATENCY_ORIGINAL = 4;
65    COMPONENT_INPUT_EVENT_LATENCY_UI = 5;
66    COMPONENT_INPUT_EVENT_LATENCY_RENDERER_MAIN = 6;
67    COMPONENT_INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN = 7;
68    COMPONENT_INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL = 8;
69    COMPONENT_INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT = 9;
70    COMPONENT_INPUT_EVENT_LATENCY_ACK_RWH = 10;
71    COMPONENT_INPUT_EVENT_LATENCY_RENDERER_SWAP = 11;
72    COMPONENT_DISPLAY_COMPOSITOR_RECEIVED_FRAME = 12;
73    COMPONENT_INPUT_EVENT_GPU_SWAP_BUFFER = 13;
74    COMPONENT_INPUT_EVENT_LATENCY_FRAME_SWAP = 14;
75  }
76
77  message ComponentInfo {
78    optional LatencyComponentType component_type = 1;
79
80    // Microsecond timestamp in CLOCK_MONOTONIC domain
81    optional uint64 time_us = 2;
82  };
83
84  repeated ComponentInfo component_info = 4;
85  optional bool is_coalesced = 5;
86  optional int64 gesture_scroll_id = 6;
87}
88