Austin Schuh | ba20ea7 | 2021-01-21 16:47:01 -0800 | [diff] [blame] | 1 | #include <iostream> |
| 2 | #include <string> |
| 3 | #include <vector> |
| 4 | |
Austin Schuh | 99f7c6a | 2024-06-25 22:07:44 -0700 | [diff] [blame^] | 5 | #include "absl/flags/flag.h" |
| 6 | #include "absl/flags/usage.h" |
Philipp Schrader | 790cb54 | 2023-07-05 21:06:52 -0700 | [diff] [blame] | 7 | |
Austin Schuh | ba20ea7 | 2021-01-21 16:47:01 -0800 | [diff] [blame] | 8 | #include "aos/events/logging/logfile_sorting.h" |
| 9 | #include "aos/events/logging/logfile_utils.h" |
James Kuszmaul | beaa3c8 | 2023-09-07 11:11:27 -0700 | [diff] [blame] | 10 | #include "aos/events/logging/logfile_validator.h" |
Austin Schuh | ba20ea7 | 2021-01-21 16:47:01 -0800 | [diff] [blame] | 11 | #include "aos/init.h" |
Austin Schuh | ba20ea7 | 2021-01-21 16:47:01 -0800 | [diff] [blame] | 12 | |
Austin Schuh | 99f7c6a | 2024-06-25 22:07:44 -0700 | [diff] [blame^] | 13 | ABSL_DECLARE_FLAG(bool, timestamps_to_csv); |
| 14 | ABSL_FLAG(bool, skip_order_validation, false, |
| 15 | "If true, ignore any out of orderness in replay"); |
Austin Schuh | ba20ea7 | 2021-01-21 16:47:01 -0800 | [diff] [blame] | 16 | |
| 17 | namespace aos::logger { |
| 18 | |
Austin Schuh | ba20ea7 | 2021-01-21 16:47:01 -0800 | [diff] [blame] | 19 | int Main(int argc, char **argv) { |
Austin Schuh | 95460cc | 2023-06-26 11:53:10 -0700 | [diff] [blame] | 20 | const LogFilesContainer log_files(SortParts(FindLogs(argc, argv))); |
Austin Schuh | 99f7c6a | 2024-06-25 22:07:44 -0700 | [diff] [blame^] | 21 | CHECK(MultiNodeLogIsReadable(log_files, |
| 22 | absl::GetFlag(FLAGS_skip_order_validation))); |
Austin Schuh | ba20ea7 | 2021-01-21 16:47:01 -0800 | [diff] [blame] | 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | } // namespace aos::logger |
| 27 | |
| 28 | int main(int argc, char **argv) { |
Austin Schuh | 99f7c6a | 2024-06-25 22:07:44 -0700 | [diff] [blame^] | 29 | absl::SetFlag(&FLAGS_timestamps_to_csv, true); |
| 30 | absl::SetProgramUsageMessage( |
Austin Schuh | ba20ea7 | 2021-01-21 16:47:01 -0800 | [diff] [blame] | 31 | "Usage:\n" |
| 32 | " timestamp_extractor [args] logfile1 logfile2 ...\n\nThis program " |
| 33 | "dumps out all the timestamps from a set of log files for plotting. Use " |
| 34 | "--skip_order_validation to skip any time estimation problems we find."); |
| 35 | aos::InitGoogle(&argc, &argv); |
| 36 | |
| 37 | return aos::logger::Main(argc, argv); |
| 38 | } |