From 470ed4f06ea320ee1d19d6bd14287a94e80381b5 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Tue, 25 Oct 2022 11:27:33 -0700 Subject: [PATCH] update stats in shrink_collect (#28563) --- runtime/src/accounts_db.rs | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 97eff1268b..c855d2ed3f 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -3774,6 +3774,17 @@ impl AccountsDb { let aligned_total: u64 = Self::page_align(alive_total as u64); + stats + .accounts_removed + .fetch_add(len - alive_accounts.len(), Ordering::Relaxed); + stats.bytes_removed.fetch_add( + original_bytes.saturating_sub(aligned_total), + Ordering::Relaxed, + ); + stats + .bytes_written + .fetch_add(aligned_total, Ordering::Relaxed); + ShrinkCollect { store_ids, original_bytes, @@ -3910,9 +3921,6 @@ impl AccountsDb { store_accounts_timing, rewrite_elapsed, write_storage_elapsed_us, - shrink_collect.total_starting_accounts - total_accounts_after_shrink, - shrink_collect.original_bytes, - shrink_collect.aligned_total, ); self.shrink_stats.report(); @@ -3927,9 +3935,6 @@ impl AccountsDb { store_accounts_timing: StoreAccountsTiming, rewrite_elapsed: Measure, write_storage_elapsed_us: u64, - accounts_removed: usize, - original_bytes: u64, - aligned_total: u64, ) { shrink_stats .num_slots_shrunk @@ -3958,16 +3963,6 @@ impl AccountsDb { shrink_stats .rewrite_elapsed .fetch_add(rewrite_elapsed.as_us(), Ordering::Relaxed); - shrink_stats - .accounts_removed - .fetch_add(accounts_removed, Ordering::Relaxed); - shrink_stats.bytes_removed.fetch_add( - original_bytes.saturating_sub(aligned_total), - Ordering::Relaxed, - ); - shrink_stats - .bytes_written - .fetch_add(aligned_total, Ordering::Relaxed); } /// get stores for 'slot' @@ -4486,9 +4481,6 @@ impl AccountsDb { store_accounts_timing, rewrite_elapsed, write_storage_elapsed.as_us(), - shrink_collect.total_starting_accounts - shrink_collect.alive_accounts.len(), - shrink_collect.original_bytes, - shrink_collect.aligned_total, ); }