AcctIdx: metric for active bg threads (#20026)

This commit is contained in:
Jeff Washington (jwash) 2021-09-20 09:44:40 -05:00 committed by GitHub
parent 2a42f8a06e
commit bc7983b13e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -109,11 +109,13 @@ impl<T: IndexValue> AccountsIndexStorage<T> {
break;
}
storage.stats.active_threads.fetch_add(1, Ordering::Relaxed);
for bucket in &in_mem {
bucket.flush();
}
storage.stats.report_stats();
storage.stats.active_threads.fetch_sub(1, Ordering::Relaxed);
}
}
}

View File

@ -19,6 +19,7 @@ pub struct BucketMapHolderStats {
pub inserts: AtomicU64,
pub count_in_mem: AtomicU64,
pub per_bucket_count: Vec<AtomicU64>,
pub active_threads: AtomicU64,
pub get_range_us: AtomicU64,
last_time: AtomicInterval,
}
@ -125,6 +126,11 @@ impl BucketMapHolderStats {
),
("inserts", self.inserts.swap(0, Ordering::Relaxed), i64),
("deletes", self.deletes.swap(0, Ordering::Relaxed), i64),
(
"active_threads",
self.active_threads.load(Ordering::Relaxed),
i64
),
("items", self.items.swap(0, Ordering::Relaxed), i64),
("keys", self.keys.swap(0, Ordering::Relaxed), i64),
);