Prechádzať zdrojové kódy

store slot on BlockBatchUpdate (#31190)

Andrew Fitzgerald 2 rokov pred
rodič
commit
b657004141

+ 1 - 1
core/src/banking_stage/consumer.rs

@@ -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: {}",

+ 8 - 8
core/src/qos_service.rs

@@ -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);
                     }
                 }
             }