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

banking stage: actually aggregate tracer packet stats (backport #27118) #27270

Merged
merged 1 commit into from
Aug 22, 2022
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
24 changes: 12 additions & 12 deletions core/src/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1998,26 +1998,26 @@ impl BankingStage {
packet_count_upperbound: usize,
) -> Result<(Vec<PacketBatch>, Option<SigverifyTracerPacketStats>), RecvTimeoutError> {
let start = Instant::now();
let mut aggregated_tracer_packet_stats_option: Option<SigverifyTracerPacketStats> = None;
let (mut packet_batches, new_tracer_packet_stats_option) =
let (mut packet_batches, mut aggregated_tracer_packet_stats_option) =
verified_receiver.recv_timeout(recv_timeout)?;

if let Some(new_tracer_packet_stats) = &new_tracer_packet_stats_option {
if let Some(aggregated_tracer_packet_stats) = &mut aggregated_tracer_packet_stats_option
{
aggregated_tracer_packet_stats.aggregate(new_tracer_packet_stats);
} else {
aggregated_tracer_packet_stats_option = new_tracer_packet_stats_option;
}
}

let mut num_packets_received: usize = packet_batches.iter().map(|batch| batch.len()).sum();
while let Ok((packet_batch, _tracer_packet_stats_option)) = verified_receiver.try_recv() {
while let Ok((packet_batch, tracer_packet_stats_option)) = verified_receiver.try_recv() {
trace!("got more packet batches in banking stage");
let (packets_received, packet_count_overflowed) = num_packets_received
.overflowing_add(packet_batch.iter().map(|batch| batch.len()).sum());
packet_batches.extend(packet_batch);

if let Some(tracer_packet_stats) = &tracer_packet_stats_option {
if let Some(aggregated_tracer_packet_stats) =
&mut aggregated_tracer_packet_stats_option
{
aggregated_tracer_packet_stats.aggregate(tracer_packet_stats);
} else {
aggregated_tracer_packet_stats_option = tracer_packet_stats_option;
}
}

// Spend any leftover receive time budget to greedily receive more packet batches,
// until the upperbound of the packet count is reached.
if start.elapsed() >= recv_timeout
Expand Down