1/* 2 * Copyright (C) 2024 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 21// IPC interface definition for serving the requests from the relay service. 22service RelayPort { 23 // Synchronize the clocks with a guest. This is used for multi-machine tracing 24 // with a VM guest or a remote machine. The client may make consecutive calls 25 // of this method to get better results. 26 rpc SyncClock(SyncClockRequest) returns (SyncClockResponse) {} 27} 28 29// For the client to send its clock readings to the host. 30message SyncClockRequest { 31 // Relay service synchronizes its clocks with the host using round-trip 32 // messages of clock snapshots on both sides for an estimation of clock 33 // offsets of the built-in clocks. 34 enum Phase { 35 // Clock synchronization starts with the client (relay service) sends its 36 // clock snapshots in the PING phase. The host also snapshots its clocks on 37 // receiving the request and acks the client. 38 PING = 1; 39 // Clock synchronization completes with the client sending the second clock 40 // snapshot request after the round-trip of the PING request. The host 41 // estimates the clock offsets using 2 consecutive clock snapshots on both 42 // sides. 43 UPDATE = 2; 44 }; 45 46 message Clock { 47 // The clock ID enumerated in builtin_clocks.proto. 48 optional uint32 clock_id = 1; 49 // The clock reading value (e.g. in nanoseconds for BUILTIN_CLOCK_BOOTTIME). 50 optional uint64 timestamp = 2; 51 } 52 53 optional Phase phase = 1; 54 repeated Clock clocks = 2; 55} 56 57// The host doesn't send any information back to the client. 58message SyncClockResponse {} 59