This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
banking stage: actually aggregate tracer packet stats #27118
Merged
apfitzge
merged 2 commits into
solana-labs:master
from
apfitzge:clean_up/banking_stage_tracer_stats_always_none
Aug 19, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2000,26 +2000,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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is unreachable since |
||
} 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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved the code that was above into here. Not sure if there's a better way to do this with options in rust, like: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems fine, thanks for the fix! |
||
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 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
we set aggregated_tracer_packet_stats_option to None here, and then get a new option back from recv_timeout.