Skip to content
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

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

steveluscher
Copy link

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.

Comment on lines +338 to +365
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();
}
Copy link
Author

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.

@steveluscher steveluscher added the automerge automerge Merge this Pull Request automatically once CI passes label Dec 6, 2024
Copy link

mergify bot commented Dec 6, 2024

automerge label removed due to a CI failure

@mergify mergify bot removed the automerge automerge Merge this Pull Request automatically once CI passes label Dec 6, 2024
@steveluscher steveluscher merged commit be65bc9 into anza-xyz:master Dec 7, 2024
38 of 40 checks passed
@steveluscher steveluscher deleted the flush-those-logs branch December 7, 2024 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants