add calc_stored_meta_us metric (#17318)

This commit is contained in:
Jeff Washington (jwash) 2021-05-19 12:29:41 -05:00 committed by GitHub
parent f1b4a0a2e0
commit b5302e7619
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -838,6 +838,7 @@ struct AccountsStats {
last_store_report: AtomicU64, last_store_report: AtomicU64,
store_hash_accounts: AtomicU64, store_hash_accounts: AtomicU64,
calc_stored_meta: AtomicU64,
store_accounts: AtomicU64, store_accounts: AtomicU64,
store_update_index: AtomicU64, store_update_index: AtomicU64,
store_handle_reclaims: AtomicU64, store_handle_reclaims: AtomicU64,
@ -3811,6 +3812,7 @@ impl AccountsDb {
mut write_version_producer: P, mut write_version_producer: P,
is_cached_store: bool, is_cached_store: bool,
) -> Vec<AccountInfo> { ) -> Vec<AccountInfo> {
let mut calc_stored_meta_time = Measure::start("calc_stored_meta");
let accounts_and_meta_to_store: Vec<_> = accounts let accounts_and_meta_to_store: Vec<_> = accounts
.iter() .iter()
.map(|(pubkey, account)| { .map(|(pubkey, account)| {
@ -3831,6 +3833,10 @@ impl AccountsDb {
(meta, account) (meta, account)
}) })
.collect(); .collect();
calc_stored_meta_time.stop();
self.stats
.calc_stored_meta
.fetch_add(calc_stored_meta_time.as_us(), Ordering::Relaxed);
if self.caching_enabled && is_cached_store { if self.caching_enabled && is_cached_store {
self.write_accounts_to_cache(slot, hashes, &accounts_and_meta_to_store) self.write_accounts_to_cache(slot, hashes, &accounts_and_meta_to_store)
@ -4754,6 +4760,11 @@ impl AccountsDb {
read_only_cache_misses, read_only_cache_misses,
i64 i64
), ),
(
"calc_stored_meta_us",
self.stats.calc_stored_meta.swap(0, Ordering::Relaxed),
i64
),
); );
let recycle_stores = self.recycle_stores.read().unwrap(); let recycle_stores = self.recycle_stores.read().unwrap();