store slot on BlockBatchUpdate (#31190)

This commit is contained in:
Andrew Fitzgerald 2023-04-14 13:15:31 -07:00 committed by GitHub
parent 93d0d25d77
commit b657004141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -441,7 +441,7 @@ impl Consumer {
self.qos_service.accumulate_actual_execute_time(us);
// reports qos service stats for this batch
self.qos_service.report_metrics(bank.clone());
self.qos_service.report_metrics(bank.slot());
debug!(
"bank: {} lock: {}us unlock: {}us txs_len: {}",

View File

@ -28,14 +28,14 @@ use {
};
pub enum QosMetrics {
BlockBatchUpdate { bank: Arc<Bank> },
BlockBatchUpdate { slot: Slot },
}
// QosService is local to each banking thread, each instance of QosService provides services to
// one banking thread.
// It hosts a private thread for async metrics reporting, tagged with banking thredas ID. Banking
// threda calls `report_metrics(&bank)` at end of `process_and_record_tramsaction()`, or any time
// it wants, QosService sends `&bank` to reporting thread via channel, signalling stats to be
// It hosts a private thread for async metrics reporting, tagged with banking threads ID. Banking
// thread calls `report_metrics(slot)` at end of `process_and_record_tramsaction()`, or any time
// it wants, QosService sends `slot` to reporting thread via channel, signalling stats to be
// reported if new bank slot has changed.
//
pub struct QosService {
@ -244,9 +244,9 @@ impl QosService {
}
// metrics are reported by bank slot
pub fn report_metrics(&self, bank: Arc<Bank>) {
pub fn report_metrics(&self, slot: Slot) {
self.report_sender
.send(QosMetrics::BlockBatchUpdate { bank })
.send(QosMetrics::BlockBatchUpdate { slot })
.unwrap_or_else(|err| warn!("qos service report metrics failed: {:?}", err));
}
@ -427,8 +427,8 @@ impl QosService {
while running_flag.load(Ordering::Relaxed) {
for qos_metrics in report_receiver.try_iter() {
match qos_metrics {
QosMetrics::BlockBatchUpdate { bank } => {
metrics.report(bank.slot());
QosMetrics::BlockBatchUpdate { slot: bank_slot } => {
metrics.report(bank_slot);
}
}
}