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/events/logging/log_cat.cc b/aos/events/logging/log_cat.cc
index c146945..9c75076 100644
--- a/aos/events/logging/log_cat.cc
+++ b/aos/events/logging/log_cat.cc
@@ -62,7 +62,7 @@
// replaying it.
std::cout << channel->name()->c_str() << ' '
<< channel->type()->c_str() << " at "
- << context.monotonic_sent_time << ": "
+ << context.monotonic_event_time << ": "
<< aos::FlatbufferToJson(
channel->schema(),
static_cast<const uint8_t *>(message))
diff --git a/aos/events/logging/logger.cc b/aos/events/logging/logger.cc
index 01f75ec..e38c476 100644
--- a/aos/events/logging/logger.cc
+++ b/aos/events/logging/logger.cc
@@ -164,9 +164,9 @@
MessageHeader::Builder message_header_builder(*fbb);
message_header_builder.add_channel_index(channel_index);
message_header_builder.add_monotonic_sent_time(
- context.monotonic_sent_time.time_since_epoch().count());
+ context.monotonic_event_time.time_since_epoch().count());
message_header_builder.add_realtime_sent_time(
- context.realtime_sent_time.time_since_epoch().count());
+ context.realtime_event_time.time_since_epoch().count());
message_header_builder.add_queue_index(context.queue_index);
@@ -212,7 +212,7 @@
CHECK(!f.written);
// TODO(james): Write tests to exercise this logic.
- if (f.fetcher->context().monotonic_sent_time <
+ if (f.fetcher->context().monotonic_event_time <
last_synchronized_time_) {
// Write!
flatbuffers::FlatBufferBuilder fbb(f.fetcher->context().size +
@@ -410,7 +410,7 @@
std::pair<monotonic_clock::time_point, int> oldest_channel_index =
PopOldestChannel();
const monotonic_clock::time_point monotonic_now =
- event_loop_->context().monotonic_sent_time;
+ event_loop_->context().monotonic_event_time;
CHECK(monotonic_now == oldest_channel_index.first)
<< ": Now " << monotonic_now.time_since_epoch().count()
<< " trying to send "