Skip to content

Commit

Permalink
update stats in shrink_collect (solana-labs#28563)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington authored Oct 25, 2022
1 parent e79c1cb commit 470ed4f
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();

Expand All @@ -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
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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,
);
}

Expand Down

0 comments on commit 470ed4f

Please sign in to comment.