add historical_roots_len stat (#24497)

This commit is contained in:
Jeff Washington (jwash) 2022-04-19 16:53:24 -05:00 committed by GitHub
parent 5d0dcca1e7
commit 255a6a729d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -1264,6 +1264,7 @@ struct FlushStats {
#[derive(Debug, Default)]
struct LatestAccountsIndexRootsStats {
roots_len: AtomicUsize,
historical_roots_len: AtomicUsize,
uncleaned_roots_len: AtomicUsize,
previous_uncleaned_roots_len: AtomicUsize,
roots_range: AtomicU64,
@ -1285,6 +1286,10 @@ impl LatestAccountsIndexRootsStats {
accounts_index_roots_stats.previous_uncleaned_roots_len,
Ordering::Relaxed,
);
self.historical_roots_len.store(
accounts_index_roots_stats.historical_roots_len,
Ordering::Relaxed,
);
self.roots_range
.store(accounts_index_roots_stats.roots_range, Ordering::Relaxed);
self.rooted_cleaned_count.fetch_add(
@ -1313,6 +1318,11 @@ impl LatestAccountsIndexRootsStats {
self.roots_len.load(Ordering::Relaxed) as i64,
i64
),
(
"historical_roots_len",
self.historical_roots_len.load(Ordering::Relaxed) as i64,
i64
),
(
"uncleaned_roots_len",
self.uncleaned_roots_len.load(Ordering::Relaxed) as i64,

View File

@ -462,6 +462,7 @@ pub struct AccountsIndexRootsStats {
pub uncleaned_roots_len: usize,
pub previous_uncleaned_roots_len: usize,
pub roots_range: u64,
pub historical_roots_len: usize,
pub rooted_cleaned_count: usize,
pub unrooted_cleaned_count: usize,
pub clean_unref_from_storage_us: u64,
@ -1834,6 +1835,7 @@ impl<T: IndexValue> AccountsIndex<T> {
stats.uncleaned_roots_len = w_roots_tracker.uncleaned_roots.len();
stats.previous_uncleaned_roots_len = w_roots_tracker.previous_uncleaned_roots.len();
stats.roots_range = w_roots_tracker.alive_roots.range_width();
stats.historical_roots_len = w_roots_tracker.historical_roots.len();
true
}
}