Make timestamp_to_csv work with multiple boots
The old code used a starting monotonic time to sync all the data on the
same plot. This doesn't work when reboots are at play. Rather than
fight that, use the distributed clock for everything.
Rather than push the concept of the distributed clock into the timestamp
filter, pull the concept of logging CSV files completely into the
multinode filter code. This actually simplifies things a fair amount.
The next step is to take this beautiful set of boot/time correspondances
and plumb it into the simulation code.
Change-Id: Id9336d683a13dd214eeec3af883d0f38a4cfa711
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/events/logging/timestamp_extractor.cc b/aos/events/logging/timestamp_extractor.cc
index ae3c4cc..6a2c95a 100644
--- a/aos/events/logging/timestamp_extractor.cc
+++ b/aos/events/logging/timestamp_extractor.cc
@@ -119,37 +119,38 @@
// Don't get clever. Use the first time as the start time. Note: this is
// different than how log_cat and others work.
- std::optional<
- std::tuple<distributed_clock::time_point, std::vector<BootTimestamp>>>
- next_timestamp = multinode_estimator.NextTimestamp();
+ std::optional<const std::tuple<distributed_clock::time_point,
+ std::vector<BootTimestamp>> *>
+ next_timestamp = multinode_estimator.QueueNextTimestamp();
CHECK(next_timestamp);
LOG(INFO) << "Starting at:";
for (const Node *node : configuration::GetNodes(config)) {
const size_t node_index = configuration::GetNodeIndex(config, node);
LOG(INFO) << " " << node->name()->string_view() << " -> "
- << std::get<1>(*next_timestamp)[node_index].time;
+ << std::get<1>(*next_timestamp.value())[node_index].time;
}
std::vector<monotonic_clock::time_point> just_monotonic(
- std::get<1>(*next_timestamp).size());
+ std::get<1>(*next_timestamp.value()).size());
for (size_t i = 0; i < just_monotonic.size(); ++i) {
- CHECK_EQ(std::get<1>(*next_timestamp)[i].boot, 0u);
- just_monotonic[i] = std::get<1>(*next_timestamp)[i].time;
+ CHECK_EQ(std::get<1>(*next_timestamp.value())[i].boot, 0u);
+ just_monotonic[i] = std::get<1>(*next_timestamp.value())[i].time;
}
multinode_estimator.Start(just_monotonic);
// As we pull off all the timestamps, the time problem is continually solved,
// filling in the CSV files.
while (true) {
- std::optional<
- std::tuple<distributed_clock::time_point, std::vector<BootTimestamp>>>
- next_timestamp = multinode_estimator.NextTimestamp();
- // TODO(austin): Figure out how to make the plot work across reboots.
+ std::optional<const std::tuple<distributed_clock::time_point,
+ std::vector<BootTimestamp>> *>
+ next_timestamp = multinode_estimator.QueueNextTimestamp();
if (!next_timestamp) {
break;
}
}
+ LOG(INFO) << "Done";
+
return 0;
}