Skip to content

Commit

Permalink
Unconditionally flush the accounts bench stats when exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
steveluscher committed Dec 5, 2024
1 parent b120fc1 commit bc2b28f
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions accounts-cluster-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,37 @@ fn run_rpc_bench_loop(
let mut iters = 0;
let mut last_error = Instant::now();
let mut last_print = Instant::now();
fn flush_stats(
iters: &i32,
last_print: &mut Instant,
rpc_bench: &RpcBench,
stats: &mut RpcBenchStats,
thread: &usize,
) {
info!(
"t({}) rpc({:?}) iters: {} success: {} errors: {}",
thread, rpc_bench, iters, stats.success, stats.errors
);
if stats.success > 0 {
info!(
" t({}) rpc({:?} average success_time: {} us",
thread,
rpc_bench,
stats.total_success_time_us / stats.success
);
}
if stats.errors > 0 {
info!(
" rpc average average errors time: {} us",
stats.total_errors_time_us / stats.errors
);
}
*last_print = Instant::now();
*stats = RpcBenchStats::default();
}
loop {
if exit.load(Ordering::Relaxed) {
flush_stats(&mut iters, &mut last_print, &rpc_bench, &mut stats, &thread);
break;
}
match rpc_bench {
Expand Down Expand Up @@ -430,26 +459,7 @@ fn run_rpc_bench_loop(
}

if last_print.elapsed().as_secs() > 3 {
info!(
"t({}) rpc({:?}) iters: {} success: {} errors: {}",
thread, rpc_bench, iters, stats.success, stats.errors
);
if stats.success > 0 {
info!(
" t({}) rpc({:?} average success_time: {} us",
thread,
rpc_bench,
stats.total_success_time_us / stats.success
);
}
if stats.errors > 0 {
info!(
" rpc average average errors time: {} us",
stats.total_errors_time_us / stats.errors
);
}
last_print = Instant::now();
stats = RpcBenchStats::default();
flush_stats(&mut iters, &mut last_print, &rpc_bench, &mut stats, &thread);
}

iters += 1;
Expand Down

0 comments on commit bc2b28f

Please sign in to comment.