Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bench-vote/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ fn sink(
) -> JoinHandle<()> {
spawn(move || {
let mut last_report = Instant::now();
let mut last_count = 0;
while !exit.load(Ordering::Relaxed) {
if let Ok(packet_batch) = receiver.recv_timeout(SINK_RECEIVE_TIMEOUT) {
received_size.fetch_add(packet_batch.len(), Ordering::Relaxed);
Expand All @@ -63,8 +64,11 @@ fn sink(
let count = received_size.load(Ordering::Relaxed);

if verbose && last_report.elapsed() > SINK_REPORT_INTERVAL {
println!("Received txns count: {count}");
let change = count - last_count;
let rate = change as u64 / SINK_REPORT_INTERVAL.as_secs();
println!("Received txns count: total: {count}, rate {rate}/s");
last_report = Instant::now();
last_count = count;
}
}
})
Expand Down
Loading