From f1f0f451b7d836017cbf2d9260fe73c47c4bc1a3 Mon Sep 17 00:00:00 2001 From: Brooks Date: Wed, 5 Jul 2023 13:57:07 -0400 Subject: [PATCH] Adds cache_hash_data_us to HashStats (#32371) --- runtime/src/accounts_db.rs | 7 ++++++- runtime/src/accounts_hash.rs | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 7fd8f1c3d..1d28b9dfe 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -7616,7 +7616,12 @@ impl AccountsDb { let slot = storages.max_slot_inclusive(); let use_bg_thread_pool = config.use_bg_thread_pool; let scan_and_hash = || { - let cache_hash_data = Self::get_cache_hash_data(accounts_hash_cache_path, config, slot); + let (cache_hash_data, cache_hash_data_us) = measure_us!(Self::get_cache_hash_data( + accounts_hash_cache_path, + config, + slot + )); + stats.cache_hash_data_us += cache_hash_data_us; let bounds = Range { start: 0, diff --git a/runtime/src/accounts_hash.rs b/runtime/src/accounts_hash.rs index d633732f9..e20ba747b 100644 --- a/runtime/src/accounts_hash.rs +++ b/runtime/src/accounts_hash.rs @@ -139,6 +139,7 @@ pub type StorageSizeQuartileStats = [usize; 6]; #[derive(Debug, Default)] pub struct HashStats { pub mark_time_us: u64, + pub cache_hash_data_us: u64, pub scan_time_total_us: u64, pub zeros_time_total_us: u64, pub hash_time_total_us: u64, @@ -193,6 +194,7 @@ impl HashStats { // NOTE: Purposely do *not* include `sort_time_total_us` in `total_time_us`, since it is // overlapping parallel scans, which is not the wallclock time. let total_time_us = self.mark_time_us + + self.cache_hash_data_us + self.scan_time_total_us + self.zeros_time_total_us + self.hash_time_total_us @@ -201,6 +203,7 @@ impl HashStats { datapoint_info!( "calculate_accounts_hash_from_storages", ("mark_time_us", self.mark_time_us, i64), + ("cache_hash_data_us", self.cache_hash_data_us, i64), ("accounts_scan_us", self.scan_time_total_us, i64), ("eliminate_zeros_us", self.zeros_time_total_us, i64), ("hash_us", self.hash_time_total_us, i64),