Skip to content

Commit

Permalink
share index_read_elapsed code (solana-labs#28557)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington authored and gnapoli23 committed Dec 16, 2022
1 parent f9c2fa6 commit c6179aa
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ struct ShrinkCollect<'a> {
unrefed_pubkeys: Vec<&'a Pubkey>,
alive_accounts: Vec<&'a (Pubkey, FoundStoredAccount<'a>)>,
alive_total: usize,
index_read_elapsed: Measure,
total_starting_accounts: usize,
}

Expand Down Expand Up @@ -3702,6 +3701,10 @@ impl AccountsDb {
let alive_total = alive_total_collect.load(Ordering::Relaxed);

index_read_elapsed.stop();
stats
.index_read_elapsed
.fetch_add(index_read_elapsed.as_us(), Ordering::Relaxed);

let aligned_total: u64 = Self::page_align(alive_total as u64);

ShrinkCollect {
Expand All @@ -3711,7 +3714,6 @@ impl AccountsDb {
unrefed_pubkeys,
alive_accounts,
alive_total,
index_read_elapsed,
total_starting_accounts: len,
}
}
Expand All @@ -3726,7 +3728,6 @@ impl AccountsDb {
store_ids,
original_bytes,
alive_total,
index_read_elapsed,
aligned_total,
unrefed_pubkeys,
alive_accounts,
Expand Down Expand Up @@ -3835,7 +3836,6 @@ impl AccountsDb {

Self::update_shrink_stats(
&self.shrink_stats,
index_read_elapsed,
find_alive_elapsed,
create_and_insert_store_elapsed_us,
store_accounts_timing,
Expand All @@ -3853,7 +3853,6 @@ impl AccountsDb {
#[allow(clippy::too_many_arguments)]
fn update_shrink_stats(
shrink_stats: &ShrinkStats,
index_read_elapsed: Measure,
find_alive_elapsed: Measure,
create_and_insert_store_elapsed_us: u64,
store_accounts_timing: StoreAccountsTiming,
Expand All @@ -3866,9 +3865,6 @@ impl AccountsDb {
shrink_stats
.num_slots_shrunk
.fetch_add(1, Ordering::Relaxed);
shrink_stats
.index_read_elapsed
.fetch_add(index_read_elapsed.as_us(), Ordering::Relaxed);
shrink_stats
.find_alive_elapsed
.fetch_add(find_alive_elapsed.as_us(), Ordering::Relaxed);
Expand Down Expand Up @@ -4328,7 +4324,6 @@ impl AccountsDb {
let mut stored_accounts = Vec::default();
let ShrinkCollect {
original_bytes,
index_read_elapsed,
aligned_total,
unrefed_pubkeys,
alive_accounts,
Expand Down Expand Up @@ -4452,7 +4447,6 @@ impl AccountsDb {

Self::update_shrink_stats(
&self.shrink_ancient_stats.shrink_stats,
index_read_elapsed,
find_alive_elapsed,
create_and_insert_store_elapsed_us,
store_accounts_timing,
Expand Down

0 comments on commit c6179aa

Please sign in to comment.