Add remote timestamps and queue_index to context
This gives us the knobs to expose the remote timestamps and queue_index
to anything receiving the events. The first use case is the logger. It
can now log forwarded entries *without* having to make the
message_gateway responsible for logging this data.
Change-Id: Ie34dd040d270f4fa90ecd6e463069e1adca1818a
diff --git a/aos/ipc_lib/queue_racer.cc b/aos/ipc_lib/queue_racer.cc
index 350350c..9bb0a70 100644
--- a/aos/ipc_lib/queue_racer.cc
+++ b/aos/ipc_lib/queue_racer.cc
@@ -251,6 +251,9 @@
i < (1 + write_wrap_count) * num_messages_ * num_threads_; ++i) {
::aos::monotonic_clock::time_point monotonic_sent_time;
::aos::realtime_clock::time_point realtime_sent_time;
+ ::aos::monotonic_clock::time_point monotonic_remote_time;
+ ::aos::realtime_clock::time_point realtime_remote_time;
+ uint32_t remote_queue_index;
size_t length;
char read_data[1024];
@@ -259,7 +262,8 @@
0xffffffffu, queue.QueueSize()));
LocklessQueue::ReadResult read_result =
queue.Read(wrapped_i, &monotonic_sent_time, &realtime_sent_time,
- &length, &(read_data[0]));
+ &monotonic_remote_time, &realtime_remote_time,
+ &remote_queue_index, &length, &(read_data[0]));
if (race_reads) {
if (read_result == LocklessQueue::ReadResult::NOTHING_NEW) {
@@ -280,6 +284,9 @@
ASSERT_GT(monotonic_sent_time, last_monotonic_sent_time);
last_monotonic_sent_time = monotonic_sent_time;
+ EXPECT_EQ(monotonic_remote_time, aos::monotonic_clock::min_time);
+ EXPECT_EQ(realtime_remote_time, aos::realtime_clock::min_time);
+
ThreadPlusCount tpc;
ASSERT_EQ(length, sizeof(ThreadPlusCount));
memcpy(&tpc, read_data + queue.message_data_size() - length,