AcctIdx: report on partial progress during flushing (#21306)
This commit is contained in:
committed by
GitHub
parent
d12dfc1918
commit
a272e19f8d
@ -38,16 +38,19 @@ pub struct BucketMapHolderStats {
|
||||
pub active_threads: AtomicU64,
|
||||
pub get_range_us: AtomicU64,
|
||||
last_age: AtomicU8,
|
||||
last_ages_flushed: AtomicU64,
|
||||
pub flush_scan_update_us: AtomicU64,
|
||||
pub flush_remove_us: AtomicU64,
|
||||
pub flush_grow_us: AtomicU64,
|
||||
last_was_startup: AtomicBool,
|
||||
last_time: AtomicInterval,
|
||||
bins: u64,
|
||||
}
|
||||
|
||||
impl BucketMapHolderStats {
|
||||
pub fn new(bins: usize) -> BucketMapHolderStats {
|
||||
BucketMapHolderStats {
|
||||
bins: bins as u64,
|
||||
per_bucket_count: (0..bins)
|
||||
.into_iter()
|
||||
.map(|_| AtomicU64::default())
|
||||
@ -82,9 +85,10 @@ impl BucketMapHolderStats {
|
||||
}
|
||||
|
||||
fn ms_per_age<T: IndexValue>(&self, storage: &BucketMapHolder<T>, elapsed_ms: u64) -> u64 {
|
||||
if !storage.get_startup() {
|
||||
let age_now = storage.current_age();
|
||||
let ages_flushed = storage.count_ages_flushed() as u64;
|
||||
let last_age = self.last_age.swap(age_now, Ordering::Relaxed) as u64;
|
||||
let last_ages_flushed = self.last_ages_flushed.swap(ages_flushed, Ordering::Relaxed) as u64;
|
||||
let mut age_now = age_now as u64;
|
||||
if last_age > age_now {
|
||||
// age wrapped
|
||||
@ -93,6 +97,11 @@ impl BucketMapHolderStats {
|
||||
let age_delta = age_now.saturating_sub(last_age) as u64;
|
||||
if age_delta > 0 {
|
||||
return elapsed_ms / age_delta;
|
||||
} else {
|
||||
// did not advance an age, but probably did partial work, so report that
|
||||
let bin_delta = ages_flushed.saturating_sub(last_ages_flushed);
|
||||
if bin_delta > 0 {
|
||||
return elapsed_ms * self.bins / bin_delta;
|
||||
}
|
||||
}
|
||||
0 // avoid crazy numbers
|
||||
|
Reference in New Issue
Block a user