Track our time buffer more explicitly
We were getting crashes because we couldn't register the timer inside
LogReader because we had forgotten how to translate the current time
(t=0). That's wrong...
The root cause was that our concept of how much to buffer was too
loose. We really needed to be pruning off the current time, not off the
size of the buffer, since there is nothing saying that we haven't
buffered too far into the future and forget now. Add a callback from
the scheduler for this.
Change-Id: I4b396b4e317140ff2abfe7b573bf7c3dae157e5c
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/events/event_scheduler.h b/aos/events/event_scheduler.h
index 397b5f0..f981ef2 100644
--- a/aos/events/event_scheduler.h
+++ b/aos/events/event_scheduler.h
@@ -58,6 +58,9 @@
// node.
virtual monotonic_clock::time_point FromDistributedClock(
size_t node_index, distributed_clock::time_point time) = 0;
+
+ // Called whenever time passes this point and we can forget about it.
+ virtual void ObserveTimePassed(distributed_clock::time_point time) = 0;
};
class EventSchedulerScheduler;
@@ -151,6 +154,8 @@
size_t /*node_index*/, distributed_clock::time_point time) override {
return monotonic_clock::epoch() + time.time_since_epoch();
}
+
+ void ObserveTimePassed(distributed_clock::time_point /*time*/) override {}
};
UnityConverter unity_converter_;