Sort parts by UUID and part_index
Also update log_cat to support this! This makes it significantly more
memory efficient to read logs with lots of parts.
Change-Id: I5ce70f9342b3ab1c7a7823a878ebd890c00ce04f
diff --git a/aos/events/logging/log_cat.cc b/aos/events/logging/log_cat.cc
index 4ef9237..f406d24 100644
--- a/aos/events/logging/log_cat.cc
+++ b/aos/events/logging/log_cat.cc
@@ -122,12 +122,14 @@
LOG(FATAL) << "Expected at least 1 logfile as an argument.";
}
- std::vector<std::vector<std::string>> logfiles;
-
+ std::vector<std::string> unsorted_logfiles;
for (int i = 1; i < argc; ++i) {
- logfiles.emplace_back(std::vector<std::string>{std::string(argv[i])});
+ unsorted_logfiles.emplace_back(std::string(argv[i]));
}
+ std::vector<std::vector<std::string>> logfiles =
+ aos::logger::SortParts(unsorted_logfiles);
+
aos::logger::LogReader reader(logfiles);
aos::FastStringBuilder builder;