-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unconditionally flush the accounts bench stats when exiting #3958
Conversation
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(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted this logic into a function so that I can call it in two places. I'm a Rust moron so please let me know if this isn't the idiomatic way. I tried creating a || {}
closure, but ran into trouble with stats
since its mutated outside.
automerge label removed due to a CI failure |
bc2b28f
to
543ce3b
Compare
9f8d33f
to
624135e
Compare
Problem
When running the account benchmarks with a finite number of iterations, the final stats might not be logged. The logs are configured to print every 3 seconds.
Summary of Changes
This PR flushes them unconditionally when the exit signal is sent to the benchmark runner.
Related: #3242.