AcctIdx: metrics for loading from disk (#20124)
This commit is contained in:
parent
4d3e32803f
commit
cb9d93525b
|
@ -14,6 +14,10 @@ pub struct BucketMapHolderStats {
|
|||
pub entries_from_mem: AtomicU64,
|
||||
pub entry_missing_us: AtomicU64,
|
||||
pub entries_missing: AtomicU64,
|
||||
pub load_disk_found_count: AtomicU64,
|
||||
pub load_disk_found_us: AtomicU64,
|
||||
pub load_disk_missing_count: AtomicU64,
|
||||
pub load_disk_missing_us: AtomicU64,
|
||||
pub updates_in_mem: AtomicU64,
|
||||
pub items: AtomicU64,
|
||||
pub keys: AtomicU64,
|
||||
|
@ -138,6 +142,26 @@ impl BucketMapHolderStats {
|
|||
self.entry_mem_us.swap(0, Ordering::Relaxed) / 1000,
|
||||
i64
|
||||
),
|
||||
(
|
||||
"load_disk_found_count",
|
||||
self.load_disk_found_count.swap(0, Ordering::Relaxed),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"load_disk_found_us",
|
||||
self.load_disk_found_us.swap(0, Ordering::Relaxed) / 1000,
|
||||
i64
|
||||
),
|
||||
(
|
||||
"load_disk_missing_count",
|
||||
self.load_disk_missing_count.swap(0, Ordering::Relaxed),
|
||||
i64
|
||||
),
|
||||
(
|
||||
"load_disk_missing_us",
|
||||
self.load_disk_missing_us.swap(0, Ordering::Relaxed) / 1000,
|
||||
i64
|
||||
),
|
||||
(
|
||||
"entries_missing",
|
||||
self.entries_missing.swap(0, Ordering::Relaxed),
|
||||
|
|
|
@ -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>> {
|
||||
|
|
Loading…
Reference in New Issue