From e5225b7e68c35099dc890d39f973ea856dbed415 Mon Sep 17 00:00:00 2001 From: sakridge Date: Thu, 4 Feb 2021 09:11:05 -0800 Subject: [PATCH] Add ref count from storage (#15078) --- runtime/src/accounts_db.rs | 2 +- runtime/src/accounts_index.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 7eada8101a..e194a9a994 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -4605,7 +4605,7 @@ impl AccountsDB { roots.sort(); info!("{}: accounts_index roots: {:?}", label, roots,); for (pubkey, account_entry) in self.accounts_index.account_maps.read().unwrap().iter() { - info!(" key: {}", pubkey); + info!(" key: {} ref_count: {}", pubkey, account_entry.ref_count(),); info!( " slots: {:?}", *account_entry.slot_list.read().unwrap() diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index de453fb2e4..90b4f1a4e2 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -78,6 +78,12 @@ pub struct AccountMapEntryInner { pub slot_list: RwLock>, } +impl AccountMapEntryInner { + pub fn ref_count(&self) -> u64 { + self.ref_count.load(Ordering::Relaxed) + } +} + #[self_referencing] pub struct ReadAccountMapEntry { owned_entry: AccountMapEntry,