diff --git a/simulator/src/replay/cmd_prepare.rs b/simulator/src/replay/cmd_prepare.rs index f5cc2925c8d..3016792c9b1 100644 --- a/simulator/src/replay/cmd_prepare.rs +++ b/simulator/src/replay/cmd_prepare.rs @@ -65,7 +65,7 @@ impl Prepare { header.set_cksum(); tar.append(&header, payload.as_slice()).unwrap(); - // bump version and print progress + // print progress if version < 1000 || version % 1000 == 0 { println!("New version: {}", version); } diff --git a/simulator/src/replay/cmd_run.rs b/simulator/src/replay/cmd_run.rs index 844d9d18e60..9b257b0b8f6 100644 --- a/simulator/src/replay/cmd_run.rs +++ b/simulator/src/replay/cmd_run.rs @@ -17,6 +17,7 @@ use radix_engine_stores::rocks_db_with_merkle_tree::RocksDBWithMerkleTreeSubstat use std::fs::File; use std::io::Read; use std::path::PathBuf; +use std::time::Duration; use tar::Archive; use transaction::validation::{ NotarizedTransactionValidator, TransactionValidator, ValidationConfig, @@ -77,7 +78,8 @@ impl Run { let new_version = database.get_current_version(); if new_version < 1000 || new_version % 1000 == 0 { let new_root = database.get_current_root_hash(); - println!("New version: {}, {}", new_version, new_root); + let duration = start.elapsed(); + print_progress(duration, new_version, new_root); } } let duration = start.elapsed(); @@ -89,6 +91,16 @@ impl Run { } } +pub fn print_progress(duration: Duration, new_version: u64, new_root: Hash) { + let seconds = duration.as_secs() % 60; + let minutes = (duration.as_secs() / 60) % 60; + let hours = (duration.as_secs() / 60) / 60; + println!( + "New version: {}, {}, {:0>2}:{:0>2}:{:0>2}", + new_version, new_root, hours, minutes, seconds + ); +} + pub fn decompress_entry(mut entry: tar::Entry>) -> Option<(u64, Vec)> { let tx_version = entry .header() diff --git a/simulator/src/replay/cmd_run_in_memory.rs b/simulator/src/replay/cmd_run_in_memory.rs index 371bd2c1724..f9bbabb3b0d 100644 --- a/simulator/src/replay/cmd_run_in_memory.rs +++ b/simulator/src/replay/cmd_run_in_memory.rs @@ -1,5 +1,6 @@ use crate::replay::decompress_entry; use crate::replay::execute_ledger_transaction; +use crate::replay::print_progress; use crate::replay::Error; use clap::Parser; use flate2::read::GzDecoder; @@ -69,7 +70,8 @@ impl RunInMemory { let new_version = database.get_current_version(); if new_version < 1000 || new_version % 1000 == 0 { let new_root = database.get_current_root_hash(); - println!("New version: {}, {}", new_version, new_root); + let duration = start.elapsed(); + print_progress(duration, new_version, new_root); } } let duration = start.elapsed();