From 1e20d449ce4e300a20e720ce21b4e080dcd989a1 Mon Sep 17 00:00:00 2001 From: anatoly yakovenko Date: Tue, 16 Apr 2019 19:35:38 -0700 Subject: [PATCH] `bank_height / slot` is the block drop rate (#3816) * bank_height/slot would give is the block drop rate * use metrics --- runtime/src/bank.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 49a0973fb..8015539dc 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -146,6 +146,9 @@ pub struct Bank { /// Bank fork (i.e. slot, i.e. block) slot: u64, + /// Bank height in term of banks + bank_height: u64, + /// The pubkey to send transactions fees to. collector_id: Pubkey, @@ -203,6 +206,7 @@ impl Bank { let mut bank = Self::default(); bank.blockhash_queue = RwLock::new(parent.blockhash_queue.read().unwrap().clone()); bank.status_cache = parent.status_cache.clone(); + bank.bank_height = parent.bank_height + 1; bank.transaction_count .store(parent.transaction_count() as usize, Ordering::Relaxed); @@ -215,6 +219,15 @@ impl Bank { bank.slot = slot; bank.max_tick_height = (bank.slot + 1) * bank.ticks_per_slot - 1; + solana_metrics::submit( + influxdb::Point::new("bank-new_from_parent-heights") + .add_field("slot_height", influxdb::Value::Integer(slot as i64)) + .add_field( + "bank_height", + influxdb::Value::Integer(bank.bank_height as i64), + ) + .to_owned(), + ); bank.parent = RwLock::new(Some(parent.clone())); bank.parent_hash = parent.hash();