pull/34863/head
deanlee 1 month ago
parent 6449b1cad7
commit b719daa312
  1. 4
      tools/lib/logreader.py
  2. 10
      tools/replay/main.cc
  3. 4
      tools/replay/route.cc

@ -336,9 +336,7 @@ if __name__ == "__main__":
parser = ArgumentParser(description="Process a log file and print identifiers or full messages.") parser = ArgumentParser(description="Process a log file and print identifiers or full messages.")
parser.add_argument("log_path", help="Path to the log file") parser.add_argument("log_path", help="Path to the log file")
parser.add_argument( parser.add_argument("--identifiers-only", action="store_true", help="Print only log identifiers")
"--identifiers-only", action="store_true", help="Print only log identifiers instead of full messages"
)
args = parser.parse_args() args = parser.parse_args()
lr = LogReader(args.log_path, sort_by_time=True) lr = LogReader(args.log_path, sort_by_time=True)

@ -97,13 +97,9 @@ bool parseArgs(int argc, char *argv[], ReplayConfig &config) {
case 'p': config.prefix = optarg; break; case 'p': config.prefix = optarg; break;
case 0: { case 0: {
std::string name = cli_options[option_index].name; std::string name = cli_options[option_index].name;
if (name == "demo") { if (name == "demo") config.route = DEMO_ROUTE;
config.route = DEMO_ROUTE; else if (name == "auto") config.auto_source = true;
} else if (name == "auto") { else config.flags |= flag_map.at(name);
config.auto_source = true;
} else {
config.flags |= flag_map.at(name);
}
break; break;
} }
case 'h': std::cout << helpText; return false; case 'h': std::cout << helpText; return false;

@ -77,8 +77,7 @@ bool Route::loadFromCommaApi() {
bool Route::loadFromAutoSource() { bool Route::loadFromAutoSource() {
auto cmd = util::string_format("python ../lib/logreader.py \"%s\" --identifiers-only", route_string_.c_str()); auto cmd = util::string_format("python ../lib/logreader.py \"%s\" --identifiers-only", route_string_.c_str());
auto output = util::check_output(cmd); auto log_files = split(util::check_output(cmd), '\n');
auto log_files = split(output, '\n');
for (int i = 0; i < log_files.size(); ++i) { for (int i = 0; i < log_files.size(); ++i) {
addFileToSegment(i, log_files[i]); addFileToSegment(i, log_files[i]);
} }
@ -86,7 +85,6 @@ bool Route::loadFromAutoSource() {
route_.end_segment = log_files.size() - 1; route_.end_segment = log_files.size() - 1;
route_.dongle_id = route_string_; route_.dongle_id = route_string_;
route_.str = route_string_; route_.str = route_string_;
route_.timestamp = "";
return !segments_.empty(); return !segments_.empty();
} }

Loading…
Cancel
Save