Skip to content

Commit

Permalink
add stats for ancient bytes_from_smallest_storages
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington committed Jun 20, 2024
1 parent 246fc3c commit 62445ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1956,6 +1956,7 @@ pub(crate) struct ShrinkAncientStats {
pub(crate) bytes_ancient_created: AtomicU64,
pub(crate) bytes_from_must_shrink: AtomicU64,
pub(crate) bytes_from_smallest_storages: AtomicU64,
pub(crate) bytes_from_newest_storages: AtomicU64,
pub(crate) many_ref_slots_skipped: AtomicU64,
pub(crate) slots_cannot_move_count: AtomicU64,
pub(crate) many_refs_old_alive: AtomicU64,
Expand Down Expand Up @@ -2258,6 +2259,11 @@ impl ShrinkAncientStats {
self.bytes_from_smallest_storages.swap(0, Ordering::Relaxed) as i64,
i64
),
(
"bytes_from_newest_storages",
self.bytes_from_newest_storages.swap(0, Ordering::Relaxed) as i64,
i64
),
(
"many_ref_slots_skipped",
self.many_ref_slots_skipped.swap(0, Ordering::Relaxed),
Expand Down
6 changes: 6 additions & 0 deletions accounts-db/src/ancient_append_vecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ impl AncientSlotInfos {
let low_threshold = tuning.max_ancient_slots * 50 / 100;
let mut bytes_from_must_shrink = 0;
let mut bytes_from_smallest_storages = 0;
let mut bytes_from_newest_storages = 0;
for (i, info) in self.all_infos.iter().enumerate() {
cumulative_bytes += info.alive_bytes;
let ancient_storages_required =
Expand All @@ -235,6 +236,8 @@ impl AncientSlotInfos {
}
if info.should_shrink {
bytes_from_must_shrink += info.alive_bytes;
} if info.is_high_slot {
bytes_from_newest_storages += info.alive_bytes;
} else {
bytes_from_smallest_storages += info.alive_bytes;
}
Expand All @@ -245,6 +248,9 @@ impl AncientSlotInfos {
stats
.bytes_from_smallest_storages
.fetch_add(bytes_from_smallest_storages, Ordering::Relaxed);
stats
.bytes_from_newest_storages
.fetch_add(bytes_from_newest_storages, Ordering::Relaxed);
}

/// remove entries from 'all_infos' such that combining
Expand Down

0 comments on commit 62445ed

Please sign in to comment.