Reduce bench-tps funding printing (#9290)

This commit is contained in:
sakridge 2020-04-04 08:21:28 -07:00 committed by GitHub
parent ed86d8d1fc
commit c0afbae940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -26,7 +26,7 @@ use std::{
process::exit,
sync::{
atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering},
Arc, RwLock,
Arc, Mutex, RwLock,
},
thread::{sleep, Builder},
time::{Duration, Instant},
@ -603,7 +603,9 @@ impl<'a> FundingTransactions<'a> for Vec<(&'a Keypair, Transaction)> {
let too_many_failures = Arc::new(AtomicBool::new(false));
let loops = if starting_txs < 1000 { 3 } else { 1 };
// Only loop multiple times for small (quick) transaction batches
let time = Arc::new(Mutex::new(Instant::now()));
for _ in 0..loops {
let time = time.clone();
let failed_verify = Arc::new(AtomicUsize::new(0));
let client = client.clone();
let verified_txs = &verified_txs;
@ -634,11 +636,15 @@ impl<'a> FundingTransactions<'a> for Vec<(&'a Keypair, Transaction)> {
remaining_count, verified_txs, failed_verify
);
}
if remaining_count % 100 == 0 {
info!(
"Verifying transfers... {} remaining, {} verified, {} failures",
remaining_count, verified_txs, failed_verify
);
if remaining_count > 0 {
let mut time_l = time.lock().unwrap();
if time_l.elapsed().as_secs() > 2 {
info!(
"Verifying transfers... {} remaining, {} verified, {} failures",
remaining_count, verified_txs, failed_verify
);
*time_l = Instant::now();
}
}
verified