diff --git a/runtime/src/bucket_map_holder.rs b/runtime/src/bucket_map_holder.rs index 9fd2c5c932..d06109ded6 100644 --- a/runtime/src/bucket_map_holder.rs +++ b/runtime/src/bucket_map_holder.rs @@ -3,6 +3,7 @@ use crate::bucket_map_holder_stats::BucketMapHolderStats; use crate::in_mem_accounts_index::{InMemAccountsIndex, SlotT}; use crate::waitable_condvar::WaitableCondvar; use solana_bucket_map::bucket_map::{BucketMap, BucketMapConfig}; +use solana_measure::measure::Measure; use solana_sdk::clock::SLOT_MS; use solana_sdk::timing::AtomicInterval; use std::fmt::Debug; @@ -157,9 +158,15 @@ impl BucketMapHolder { let bins = in_mem.len(); let flush = self.disk.is_some(); loop { + let mut m = Measure::start("wait"); // this will transition to waits and thread throttling self.wait_dirty_or_aged .wait_timeout(Duration::from_millis(AGE_MS)); + m.stop(); + self.stats + .bg_waiting_us + .fetch_add(m.as_us(), Ordering::Relaxed); + if exit.load(Ordering::Relaxed) { break; } diff --git a/runtime/src/bucket_map_holder_stats.rs b/runtime/src/bucket_map_holder_stats.rs index 05342b5715..da2a1e8981 100644 --- a/runtime/src/bucket_map_holder_stats.rs +++ b/runtime/src/bucket_map_holder_stats.rs @@ -24,6 +24,7 @@ pub struct BucketMapHolderStats { pub deletes: AtomicU64, pub inserts: AtomicU64, pub count: AtomicU64, + pub bg_waiting_us: AtomicU64, pub count_in_mem: AtomicU64, pub per_bucket_count: Vec, pub flush_entries_updated_on_disk: AtomicU64, @@ -119,6 +120,11 @@ impl BucketMapHolderStats { i64 ), ("count", self.count.load(Ordering::Relaxed), i64), + ( + "bg_waiting_us", + self.bg_waiting_us.swap(0, Ordering::Relaxed), + i64 + ), ("min_in_bin", min, i64), ("max_in_bin", max, i64), ("count_from_bins", ct, i64),