Implement clock sync in multi-machine tracing

This revision implements the RelayPort exposed on the producer socket
for synchronization of clocks in multi-machine tracing:

* The RelayPort defines the IPC methods between the tracing service and
the relay service for operations that are specific to multi-machine
tracing (clock synchronization).

* ServiceIPCHostImpl exposes a second IPC service that implements
RelayPort to producer sockets (perfetto::RelayIPCService).

* The relay service connects to the RelayPort using the IPC client
implementation (perfetto::RelayIPCClient). On connected, the relay
service invokes the SyncClock() rpc methods with the tracing service to
capture clock snapshots on the host and client.

* In a tracing session, the tracing service emits the ClockSnapshots
packet for the remote machine and also the ClockSync packet for the
clock offsets of supported clocks.

Bug: 284258446
Test: unit tests and integration tests.

Change-Id: I95015c1e0bc8bec7b82b0fdac897900e0de923b7
diff --git a/BUILD b/BUILD
index 09790fd..75f048c 100644
--- a/BUILD
+++ b/BUILD
@@ -886,6 +886,7 @@
     name = "include_perfetto_tracing_core_core",
     srcs = [
         "include/perfetto/tracing/core/chrome_config.h",
+        "include/perfetto/tracing/core/clock_snapshots.h",
         "include/perfetto/tracing/core/data_source_config.h",
         "include/perfetto/tracing/core/data_source_descriptor.h",
         "include/perfetto/tracing/core/flush_flags.h",
@@ -3190,6 +3191,7 @@
 perfetto_filegroup(
     name = "src_tracing_core_core",
     srcs = [
+        "src/tracing/core/clock_snapshots.cc",
         "src/tracing/core/id_allocator.cc",
         "src/tracing/core/id_allocator.h",
         "src/tracing/core/in_process_shared_memory.cc",
@@ -3233,6 +3235,8 @@
         "src/tracing/ipc/service/consumer_ipc_service.h",
         "src/tracing/ipc/service/producer_ipc_service.cc",
         "src/tracing/ipc/service/producer_ipc_service.h",
+        "src/tracing/ipc/service/relay_ipc_service.cc",
+        "src/tracing/ipc/service/relay_ipc_service.h",
         "src/tracing/ipc/service/service_ipc_host_impl.cc",
         "src/tracing/ipc/service/service_ipc_host_impl.h",
     ],
@@ -4229,6 +4233,7 @@
     srcs = [
         "protos/perfetto/ipc/consumer_port.proto",
         "protos/perfetto/ipc/producer_port.proto",
+        "protos/perfetto/ipc/relay_port.proto",
     ],
     visibility = [
         PERFETTO_CONFIG.proto_library_visibility,
@@ -4783,6 +4788,7 @@
     srcs = [
         "protos/perfetto/trace/extension_descriptor.proto",
         "protos/perfetto/trace/memory_graph.proto",
+        "protos/perfetto/trace/remote_clock_sync.proto",
         "protos/perfetto/trace/test_event.proto",
         "protos/perfetto/trace/test_extensions.proto",
         "protos/perfetto/trace/trace.proto",