From 82672b40fd158c09813653586b1937033b194c9a Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Wed, 15 Dec 2021 19:52:23 -0600 Subject: [PATCH] AcctIdx: streamline metric update (#21936) --- runtime/src/in_mem_accounts_index.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/src/in_mem_accounts_index.rs b/runtime/src/in_mem_accounts_index.rs index d3daa9b0d8..1f9169f598 100644 --- a/runtime/src/in_mem_accounts_index.rs +++ b/runtime/src/in_mem_accounts_index.rs @@ -710,6 +710,7 @@ impl InMemAccountsIndex { assert!(self.get_stop_flush()); // caller should be controlling the lifetime of how long this needs to be present let m = Measure::start("range"); + let mut added_to_mem = 0; // load from disk if let Some(disk) = self.bucket.as_ref() { let mut map = self.map().write().unwrap(); @@ -724,11 +725,13 @@ impl InMemAccountsIndex { } Entry::Vacant(vacant) => { vacant.insert(self.disk_to_cache_entry(item.slot_list, item.ref_count)); - self.stats().insert_or_delete_mem(true, self.bin); + added_to_mem += 1; } } } } + self.stats() + .insert_or_delete_mem_count(true, self.bin, added_to_mem); Self::update_time_stat(&self.stats().get_range_us, m); }