Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit cb9d935

Browse files
AcctIdx: metrics for loading from disk (#20124)
1 parent 4d3e328 commit cb9d935

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

runtime/src/bucket_map_holder_stats.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ pub struct BucketMapHolderStats {
1414
pub entries_from_mem: AtomicU64,
1515
pub entry_missing_us: AtomicU64,
1616
pub entries_missing: AtomicU64,
17+
pub load_disk_found_count: AtomicU64,
18+
pub load_disk_found_us: AtomicU64,
19+
pub load_disk_missing_count: AtomicU64,
20+
pub load_disk_missing_us: AtomicU64,
1721
pub updates_in_mem: AtomicU64,
1822
pub items: AtomicU64,
1923
pub keys: AtomicU64,
@@ -138,6 +142,26 @@ impl BucketMapHolderStats {
138142
self.entry_mem_us.swap(0, Ordering::Relaxed) / 1000,
139143
i64
140144
),
145+
(
146+
"load_disk_found_count",
147+
self.load_disk_found_count.swap(0, Ordering::Relaxed),
148+
i64
149+
),
150+
(
151+
"load_disk_found_us",
152+
self.load_disk_found_us.swap(0, Ordering::Relaxed) / 1000,
153+
i64
154+
),
155+
(
156+
"load_disk_missing_count",
157+
self.load_disk_missing_count.swap(0, Ordering::Relaxed),
158+
i64
159+
),
160+
(
161+
"load_disk_missing_us",
162+
self.load_disk_missing_us.swap(0, Ordering::Relaxed) / 1000,
163+
i64
164+
),
141165
(
142166
"entries_missing",
143167
self.entries_missing.swap(0, Ordering::Relaxed),

runtime/src/in_mem_accounts_index.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,21 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
106106
}
107107

108108
fn load_from_disk(&self, pubkey: &Pubkey) -> Option<(SlotList<T>, RefCount)> {
109-
self.storage
110-
.disk
111-
.as_ref()
112-
.and_then(|disk| disk.read_value(pubkey))
109+
self.storage.disk.as_ref().and_then(|disk| {
110+
let m = Measure::start("load_disk_found_count");
111+
let entry_disk = disk.read_value(pubkey);
112+
match &entry_disk {
113+
Some(_) => {
114+
Self::update_time_stat(&self.stats().load_disk_found_us, m);
115+
Self::update_stat(&self.stats().load_disk_found_count, 1);
116+
}
117+
None => {
118+
Self::update_time_stat(&self.stats().load_disk_missing_us, m);
119+
Self::update_stat(&self.stats().load_disk_missing_count, 1);
120+
}
121+
}
122+
entry_disk
123+
})
113124
}
114125

115126
fn load_account_entry_from_disk(&self, pubkey: &Pubkey) -> Option<AccountMapEntry<T>> {

0 commit comments

Comments
 (0)