diff --git a/poh-bench/Cargo.toml b/poh-bench/Cargo.toml index 4ef1ffce86..1915da83e0 100644 --- a/poh-bench/Cargo.toml +++ b/poh-bench/Cargo.toml @@ -10,7 +10,7 @@ documentation = "https://docs.rs/solana-poh-bench" publish = false [dependencies] -clap = "2.33.1" +clap = { version = "3.1.5", features = ["cargo"] } log = "0.4.14" rand = "0.7.0" rayon = "1.5.1" diff --git a/poh-bench/src/main.rs b/poh-bench/src/main.rs index 0cac2074ac..c07c4b00c6 100644 --- a/poh-bench/src/main.rs +++ b/poh-bench/src/main.rs @@ -4,7 +4,7 @@ use solana_entry::entry::{self, create_ticks, init_poh, EntrySlice, VerifyRecycl #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] use solana_entry::entry::{create_ticks, init_poh, EntrySlice, VerifyRecyclers}; use { - clap::{crate_description, crate_name, value_t, App, Arg}, + clap::{crate_description, crate_name, Arg, Command}, solana_measure::measure::Measure, solana_perf::perf_libs, solana_sdk::hash::hash, @@ -13,61 +13,63 @@ use { fn main() { solana_logger::setup(); - let matches = App::new(crate_name!()) + let matches = Command::new(crate_name!()) .about(crate_description!()) .version(solana_version::version!()) .arg( - Arg::with_name("max_num_entries") + Arg::new("max_num_entries") .long("max-num-entries") .takes_value(true) .value_name("SIZE") .help("Number of entries."), ) .arg( - Arg::with_name("start_num_entries") + Arg::new("start_num_entries") .long("start-num-entries") .takes_value(true) .value_name("SIZE") .help("Packets per chunk"), ) .arg( - Arg::with_name("hashes_per_tick") + Arg::new("hashes_per_tick") .long("hashes-per-tick") .takes_value(true) .value_name("SIZE") .help("hashes per tick"), ) .arg( - Arg::with_name("num_transactions_per_entry") + Arg::new("num_transactions_per_entry") .long("num-transactions-per-entry") .takes_value(true) .value_name("NUM") .help("Skip transaction sanity execution"), ) .arg( - Arg::with_name("iterations") + Arg::new("iterations") .long("iterations") .takes_value(true) .help("Number of iterations"), ) .arg( - Arg::with_name("num_threads") + Arg::new("num_threads") .long("num-threads") .takes_value(true) .help("Number of threads"), ) .arg( - Arg::with_name("cuda") + Arg::new("cuda") .long("cuda") .takes_value(false) .help("Use cuda"), ) .get_matches(); - let max_num_entries = value_t!(matches, "max_num_entries", u64).unwrap_or(64); - let start_num_entries = value_t!(matches, "start_num_entries", u64).unwrap_or(max_num_entries); - let iterations = value_t!(matches, "iterations", usize).unwrap_or(10); - let hashes_per_tick = value_t!(matches, "hashes_per_tick", u64).unwrap_or(10_000); + let max_num_entries: u64 = matches.value_of_t("max_num_entries").unwrap_or(64); + let start_num_entries: u64 = matches + .value_of_t("start_num_entries") + .unwrap_or(max_num_entries); + let iterations: usize = matches.value_of_t("iterations").unwrap_or(10); + let hashes_per_tick: u64 = matches.value_of_t("hashes_per_tick").unwrap_or(10_000); let start_hash = hash(&[1, 2, 3, 4]); let ticks = create_ticks(max_num_entries, hashes_per_tick, start_hash); let mut num_entries = start_num_entries as usize;