diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index 7ca0e7ce5a5dd4..48798260ed1d03 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -60,6 +60,7 @@ use { cache_hash_data::{CacheHashData, CacheHashDataFileReference}, contains::Contains, epoch_accounts_hash::EpochAccountsHashManager, + in_mem_accounts_index::StartupStats, partitioned_rewards::{PartitionedEpochRewardsConfig, TestPartitionedEpochRewards}, pubkey_bins::PubkeyBinCalculator24, read_only_accounts_cache::ReadOnlyAccountsCache, @@ -636,7 +637,7 @@ struct StorageSizeAndCount { type StorageSizeAndCountMap = DashMap; impl GenerateIndexTimings { - pub fn report(&self) { + pub fn report(&self, startup_stats: &StartupStats) { datapoint_info!( "generate_index", ("overall_us", self.total_time_us, i64), @@ -695,6 +696,11 @@ impl GenerateIndexTimings { ), ("total_slots", self.total_slots, i64), ("slots_to_clean", self.slots_to_clean, i64), + ( + "copy_data_us", + startup_stats.copy_data_us.swap(0, Ordering::Relaxed), + i64 + ), ); } } @@ -9369,7 +9375,7 @@ impl AccountsDb { } total_time.stop(); timings.total_time_us = total_time.as_us(); - timings.report(); + timings.report(self.accounts_index.get_startup_stats()); } self.accounts_index.log_secondary_indexes(); diff --git a/accounts-db/src/accounts_index.rs b/accounts-db/src/accounts_index.rs index b9038441d12515..45ecc13b851133 100644 --- a/accounts-db/src/accounts_index.rs +++ b/accounts-db/src/accounts_index.rs @@ -5,7 +5,7 @@ use { ancestors::Ancestors, bucket_map_holder::{Age, BucketMapHolder}, contains::Contains, - in_mem_accounts_index::{InMemAccountsIndex, InsertNewEntryResults}, + in_mem_accounts_index::{InMemAccountsIndex, InsertNewEntryResults, StartupStats}, inline_spl_token::{self, GenericTokenAccount}, inline_spl_token_2022, pubkey_bins::PubkeyBinCalculator24, @@ -1336,6 +1336,11 @@ impl + Into> AccountsIndex { iter.hold_range_in_memory(range, start_holding, thread_pool); } + /// get stats related to startup + pub(crate) fn get_startup_stats(&self) -> &StartupStats { + &self.storage.storage.startup_stats + } + pub fn set_startup(&self, value: Startup) { self.storage.set_startup(value); } diff --git a/accounts-db/src/bucket_map_holder.rs b/accounts-db/src/bucket_map_holder.rs index dfc77671ed43a9..77ae98bdfe9574 100644 --- a/accounts-db/src/bucket_map_holder.rs +++ b/accounts-db/src/bucket_map_holder.rs @@ -2,7 +2,7 @@ use { crate::{ accounts_index::{AccountsIndexConfig, DiskIndexValue, IndexLimitMb, IndexValue}, bucket_map_holder_stats::BucketMapHolderStats, - in_mem_accounts_index::InMemAccountsIndex, + in_mem_accounts_index::{InMemAccountsIndex, StartupStats}, waitable_condvar::WaitableCondvar, }, solana_bucket_map::bucket_map::{BucketMap, BucketMapConfig}, @@ -68,6 +68,8 @@ pub struct BucketMapHolder + Into> /// Note startup is an optimization and is not required for correctness. startup: AtomicBool, _phantom: PhantomData, + + pub(crate) startup_stats: Arc, } impl + Into> Debug for BucketMapHolder { @@ -259,6 +261,7 @@ impl + Into> BucketMapHolder mem_budget_mb, threads, _phantom: PhantomData, + startup_stats: Arc::default(), } } diff --git a/accounts-db/src/in_mem_accounts_index.rs b/accounts-db/src/in_mem_accounts_index.rs index 067ab65d6ca051..3d943956cab23d 100644 --- a/accounts-db/src/in_mem_accounts_index.rs +++ b/accounts-db/src/in_mem_accounts_index.rs @@ -27,6 +27,11 @@ type CacheRangesHeld = RwLock>>; type InMemMap = HashMap>; +#[derive(Debug, Default)] +pub struct StartupStats { + pub copy_data_us: AtomicU64, +} + #[derive(Debug)] pub struct PossibleEvictions { /// vec per age in the future, up to size 'ages_to_stay_in_cache' @@ -116,6 +121,9 @@ pub struct InMemAccountsIndex + Into< /// Higher numbers mean we flush less buckets/s /// Lower numbers mean we flush more buckets/s num_ages_to_distribute_flushes: Age, + + /// stats related to starting up + pub(crate) startup_stats: Arc, } impl + Into> Debug for InMemAccountsIndex { @@ -182,6 +190,7 @@ impl + Into> InMemAccountsIndex + Into> InMemAccountsIndex