add stats for stakes_cache_check_and_store_us (#24349)

* add stats for stakes_cache_check_and_store_us

* remove redundant metrics
This commit is contained in:
Jeff Washington (jwash) 2022-05-05 17:22:48 -05:00 committed by GitHub
parent 6a9a7df272
commit 0cc97689f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 3 deletions

View File

@ -1052,7 +1052,7 @@ pub struct AccountsDb {
pub bank_hashes: RwLock<HashMap<Slot, BankHashInfo>>,
stats: AccountsStats,
pub stats: AccountsStats,
clean_accounts_stats: CleanAccountsStats,
@ -1113,7 +1113,7 @@ pub struct AccountsDb {
}
#[derive(Debug, Default)]
struct AccountsStats {
pub struct AccountsStats {
delta_hash_scan_time_total_us: AtomicU64,
delta_hash_accumulate_time_total_us: AtomicU64,
delta_hash_num: AtomicU64,
@ -1125,6 +1125,7 @@ struct AccountsStats {
store_update_index: AtomicU64,
store_handle_reclaims: AtomicU64,
store_append_accounts: AtomicU64,
pub stakes_cache_check_and_store_us: AtomicU64,
store_find_store: AtomicU64,
store_num_accounts: AtomicU64,
store_total_data: AtomicU64,
@ -6574,6 +6575,13 @@ impl AccountsDb {
self.stats.store_append_accounts.swap(0, Ordering::Relaxed),
i64
),
(
"stakes_cache_check_and_store_us",
self.stats
.stakes_cache_check_and_store_us
.swap(0, Ordering::Relaxed),
i64
),
(
"find_storage",
self.stats.store_find_store.swap(0, Ordering::Relaxed),

View File

@ -5815,8 +5815,15 @@ impl Bank {
self.rc
.accounts
.store_slow_cached(self.slot(), pubkey, account);
let mut m = Measure::start("stakes_cache.check_and_store");
self.stakes_cache.check_and_store(pubkey, account);
m.stop();
self.rc
.accounts
.accounts_db
.stats
.stakes_cache_check_and_store_us
.fetch_add(m.as_us(), Relaxed);
}
pub fn force_flush_accounts_cache(&self) {
@ -6543,6 +6550,8 @@ impl Bank {
load_result,
execution_results[i].was_executed_successfully(),
) {
// note that this could get timed to: self.rc.accounts.accounts_db.stats.stakes_cache_check_and_store_us,
// but this code path is captured separately in ExecuteTimingType::UpdateStakesCacheUs
let message = tx.message();
for (_i, (pubkey, account)) in
(0..message.account_keys().len()).zip(loaded_transaction.accounts.iter())