Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
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
35 changes: 35 additions & 0 deletions core/src/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,42 @@ impl BankingStageStats {
}
}

fn is_empty(&self) -> bool {
0 == self.process_packets_count.load(Ordering::Relaxed) as u64
+ self.new_tx_count.load(Ordering::Relaxed) as u64
+ self.dropped_packet_batches_count.load(Ordering::Relaxed) as u64
+ self.dropped_packets_count.load(Ordering::Relaxed) as u64
+ self
.dropped_duplicated_packets_count
.load(Ordering::Relaxed) as u64
+ self.newly_buffered_packets_count.load(Ordering::Relaxed) as u64
+ self.current_buffered_packets_count.load(Ordering::Relaxed) as u64
+ self
.current_buffered_packet_batches_count
.load(Ordering::Relaxed) as u64
+ self.rebuffered_packets_count.load(Ordering::Relaxed) as u64
+ self.consumed_buffered_packets_count.load(Ordering::Relaxed) as u64
+ self
.consume_buffered_packets_elapsed
.load(Ordering::Relaxed)
+ self.process_packets_elapsed.load(Ordering::Relaxed)
+ self
.handle_retryable_packets_elapsed
.load(Ordering::Relaxed)
+ self.filter_pending_packets_elapsed.load(Ordering::Relaxed)
+ self.packet_duplicate_check_elapsed.load(Ordering::Relaxed)
+ self.packet_conversion_elapsed.load(Ordering::Relaxed)
+ self
.unprocessed_packet_conversion_elapsed
.load(Ordering::Relaxed)
+ self.transaction_processing_elapsed.load(Ordering::Relaxed)
}
Comment on lines +123 to +151
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may be a bit clunky to maintain every time we add a field.

What if we moved all the fields excluding last_report and id into a separate BankingStageStatsInner which derives default, and then this is_empty() check can be self == BankingStageStatsInner::default()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brilliant, would work great if those counter are not atomic type. self.inner == BankingStageStatsInner::default() would invoke == on AtomicU64, which I need to implemented counter by counter, would end to be the same effect. Maybe I missed some neat Rust feature.


fn report(&self, report_interval_ms: u64) {
// skip repoting metrics if stats is empty
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: repoting -> reporting

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed...thanks. (I need find a plugin for vim to spell-check for me)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed...thanks. (I need find a plugin for vim to spell-check for me)

It's built in! :set spell

if self.is_empty() {
return;
}
if self.last_report.should_update(report_interval_ms) {
datapoint_info!(
"banking_stage-loop-stats",
Expand Down