Added vreplay with stdout
This commit is contained in:
@@ -470,9 +470,12 @@ public:
|
||||
cleanup_channels();
|
||||
}
|
||||
|
||||
int replay_logfile(const char *fn) {
|
||||
int replay_logfile(const char *fn, bool verbose) {
|
||||
drv::ReplayPlayer player;
|
||||
player.open_logfile(fn);
|
||||
if (verbose) {
|
||||
player.enable_stdout();
|
||||
}
|
||||
while (true) {
|
||||
drv::ReplayPlayer::Status st = player.step();
|
||||
if (st != drv::ReplayPlayer::ST_REPLAYING) {
|
||||
@@ -493,27 +496,33 @@ public:
|
||||
|
||||
// If argv contains "replay <filename>", do a replay,
|
||||
// and then skip everything else.
|
||||
if ((argc >= 1) && (strcmp(argv[0], "replay") == 0)) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "usage: " << program << " replay <filename>" << std::endl;
|
||||
exit(1);
|
||||
if (argc >= 1) {
|
||||
std::string cmd(argv[0]);
|
||||
if ((cmd == "replay") || (cmd == "vreplay")) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "usage: " << program << " replay <filename>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
return replay_logfile(argv[1], cmd == "vreplay");
|
||||
}
|
||||
return replay_logfile(argv[1]);
|
||||
}
|
||||
|
||||
// If argv contains "record <filename>", start recording,
|
||||
// and remove the "record <filename>" from argv.
|
||||
if ((argc >= 1) && (strcmp(argv[0], "record") == 0)) {
|
||||
if (argc < 2) {
|
||||
DrivenEngine::print_usage(std::cerr, program);
|
||||
return 1;
|
||||
if (argc >= 1) {
|
||||
std::string cmd = argv[0];
|
||||
if (cmd == "record") {
|
||||
if (argc < 2) {
|
||||
DrivenEngine::print_usage(std::cerr, program);
|
||||
return 1;
|
||||
}
|
||||
bool ok = recorder_.open_logfile(argv[1]);
|
||||
if (!ok) {
|
||||
std::cerr << "Could not open logfile: " << argv[1] << std::endl;
|
||||
return 1;
|
||||
}
|
||||
argc -= 2; argv += 2;
|
||||
}
|
||||
bool ok = recorder_.open_logfile(argv[1]);
|
||||
if (!ok) {
|
||||
std::cerr << "Could not open logfile: " << argv[1] << std::endl;
|
||||
return 1;
|
||||
}
|
||||
argc -= 2; argv += 2;
|
||||
}
|
||||
|
||||
// Create the engine.
|
||||
|
||||
Reference in New Issue
Block a user