Traces with real-to-elapsed time offset
Add real_to_elapsed_time_offset_nanos field to protobuf traces:
- SF layers
- SF transactions
Bug: 235196806
Test: record and view SF + transaction traces with winscope
Change-Id: I5f4d2a2b4e2ceaacf75c43d01f866fe1e2b76532
diff --git a/services/surfaceflinger/Tracing/LayerTracing.cpp b/services/surfaceflinger/Tracing/LayerTracing.cpp
index afa3e50..566d553 100644
--- a/services/surfaceflinger/Tracing/LayerTracing.cpp
+++ b/services/surfaceflinger/Tracing/LayerTracing.cpp
@@ -89,6 +89,9 @@
LayersTraceFileProto fileProto;
fileProto.set_magic_number(uint64_t(LayersTraceFileProto_MagicNumber_MAGIC_NUMBER_H) << 32 |
LayersTraceFileProto_MagicNumber_MAGIC_NUMBER_L);
+ auto timeOffsetNs = static_cast<std::uint64_t>(systemTime(SYSTEM_TIME_REALTIME) -
+ systemTime(SYSTEM_TIME_MONOTONIC));
+ fileProto.set_real_to_elapsed_time_offset_nanos(timeOffsetNs);
return fileProto;
}