update clap to v3: poh-bench

This commit is contained in:
klykov 2022-03-08 11:43:19 +01:00 committed by kirill lykov
parent 22404ca1fc
commit 36807d5fa3
2 changed files with 16 additions and 14 deletions

View File

@ -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"

View File

@ -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;