Skip to content

Commit

Permalink
add ancient.total_alive_bytes metric
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington committed Sep 3, 2024
1 parent ea5653f commit 5612871
Show file tree
Hide file tree
Showing 2 changed files with 9 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 @@ -1992,6 +1992,7 @@ pub(crate) struct ShrinkAncientStats {
pub(crate) many_refs_old_alive: AtomicU64,
pub(crate) slots_eligible_to_shrink: AtomicU64,
pub(crate) total_dead_bytes: AtomicU64,
pub(crate) total_alive_bytes: AtomicU64,
pub(crate) ideal_storage_size: AtomicU64,
}

Expand Down Expand Up @@ -2340,6 +2341,11 @@ impl ShrinkAncientStats {
self.total_dead_bytes.swap(0, Ordering::Relaxed),
i64
),
(
"total_alive_bytes",
self.total_alive_bytes.swap(0, Ordering::Relaxed),
i64
),
(
"slots_considered",
self.slots_considered.swap(0, Ordering::Relaxed) as i64,
Expand Down
3 changes: 3 additions & 0 deletions accounts-db/src/ancient_append_vecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,9 @@ impl AccountsDb {
self.shrink_ancient_stats
.total_dead_bytes
.fetch_add(total_dead_bytes, Ordering::Relaxed);
self.shrink_ancient_stats
.total_alive_bytes
.fetch_add(total_alive_bytes, Ordering::Relaxed);
if randoms > 0 {
self.shrink_ancient_stats
.random_shrink
Expand Down

0 comments on commit 5612871

Please sign in to comment.