AcctIdx: metrics for loading from disk (#20124)

This commit is contained in:
Jeff Washington (jwash)
2021-09-23 08:14:08 -05:00
committed by GitHub
parent 4d3e32803f
commit cb9d93525b
2 changed files with 39 additions and 4 deletions

View File

@@ -106,10 +106,21 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
}
fn load_from_disk(&self, pubkey: &Pubkey) -> Option<(SlotList<T>, RefCount)> {
self.storage
.disk
.as_ref()
.and_then(|disk| disk.read_value(pubkey))
self.storage.disk.as_ref().and_then(|disk| {
let m = Measure::start("load_disk_found_count");
let entry_disk = disk.read_value(pubkey);
match &entry_disk {
Some(_) => {
Self::update_time_stat(&self.stats().load_disk_found_us, m);
Self::update_stat(&self.stats().load_disk_found_count, 1);
}
None => {
Self::update_time_stat(&self.stats().load_disk_missing_us, m);
Self::update_stat(&self.stats().load_disk_missing_count, 1);
}
}
entry_disk
})
}
fn load_account_entry_from_disk(&self, pubkey: &Pubkey) -> Option<AccountMapEntry<T>> {