AcctIdx: stats for how much time bg threads wait (#20127)
This commit is contained in:
parent
fe28f17718
commit
093dd68214
|
@ -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<T: IndexValue> BucketMapHolder<T> {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -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<AtomicU64>,
|
||||
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),
|
||||
|
|
Loading…
Reference in New Issue