From da81bb838266f3159ae35c2b6a690f13aa0a28f9 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Thu, 29 Aug 2024 09:22:58 -0500 Subject: [PATCH] add clean metric for # slots cleaned (#2777) --- accounts-db/src/accounts_db.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index 63c03ada543eef..0634ab6ba2a1da 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -1962,6 +1962,7 @@ struct CleanAccountsStats { clean_stored_dead_slots_us: AtomicU64, uncleaned_roots_slot_list_1: AtomicU64, get_account_sizes_us: AtomicU64, + slots_cleaned: AtomicU64, } impl CleanAccountsStats { @@ -3603,6 +3604,13 @@ impl AccountsDb { .swap(0, Ordering::Relaxed), i64 ), + ( + "slots_cleaned", + self.clean_accounts_stats + .slots_cleaned + .swap(0, Ordering::Relaxed), + i64 + ), ( "clean_old_root_us", self.clean_accounts_stats @@ -8020,6 +8028,10 @@ impl AccountsDb { assert!(reclaimed_offsets.contains_key(&expected_slot)); } + self.clean_accounts_stats + .slots_cleaned + .fetch_add(reclaimed_offsets.len() as u64, Ordering::Relaxed); + reclaimed_offsets.iter().for_each(|(slot, offsets)| { if let Some(store) = self .storage