fix hash calc # storages, # slots (#20832)
This commit is contained in:
committed by
GitHub
parent
f4f281e7c7
commit
9e85499d4c
@ -5538,7 +5538,8 @@ impl AccountsDb {
|
|||||||
let bin_calculator = PubkeyBinCalculator24::new(bins);
|
let bin_calculator = PubkeyBinCalculator24::new(bins);
|
||||||
assert!(bin_range.start < bins && bin_range.end <= bins && bin_range.start < bin_range.end);
|
assert!(bin_range.start < bins && bin_range.end <= bins && bin_range.start < bin_range.end);
|
||||||
let mut time = Measure::start("scan all accounts");
|
let mut time = Measure::start("scan all accounts");
|
||||||
stats.num_snapshot_storage = storage.slot_count();
|
stats.num_snapshot_storage = storage.storage_count();
|
||||||
|
stats.num_slots = storage.slot_count();
|
||||||
let mismatch_found = AtomicU64::new(0);
|
let mismatch_found = AtomicU64::new(0);
|
||||||
let range = bin_range.end - bin_range.start;
|
let range = bin_range.end - bin_range.start;
|
||||||
let sort_time = AtomicU64::new(0);
|
let sort_time = AtomicU64::new(0);
|
||||||
|
@ -27,6 +27,7 @@ pub struct HashStats {
|
|||||||
pub hash_total: usize,
|
pub hash_total: usize,
|
||||||
pub unreduced_entries: usize,
|
pub unreduced_entries: usize,
|
||||||
pub num_snapshot_storage: usize,
|
pub num_snapshot_storage: usize,
|
||||||
|
pub num_slots: usize,
|
||||||
pub collect_snapshots_us: u64,
|
pub collect_snapshots_us: u64,
|
||||||
pub storage_sort_us: u64,
|
pub storage_sort_us: u64,
|
||||||
pub min_bin_size: usize,
|
pub min_bin_size: usize,
|
||||||
@ -59,6 +60,7 @@ impl HashStats {
|
|||||||
self.num_snapshot_storage as i64,
|
self.num_snapshot_storage as i64,
|
||||||
i64
|
i64
|
||||||
),
|
),
|
||||||
|
("num_slots", self.num_slots as i64, i64),
|
||||||
("min_bin_size", self.min_bin_size as i64, i64),
|
("min_bin_size", self.min_bin_size as i64, i64),
|
||||||
("max_bin_size", self.max_bin_size as i64, i64),
|
("max_bin_size", self.max_bin_size as i64, i64),
|
||||||
("total", total_time_us as i64, i64),
|
("total", total_time_us as i64, i64),
|
||||||
|
@ -8,6 +8,7 @@ pub struct SortedStorages<'a> {
|
|||||||
range: Range<Slot>,
|
range: Range<Slot>,
|
||||||
storages: Vec<Option<&'a SnapshotStorage>>,
|
storages: Vec<Option<&'a SnapshotStorage>>,
|
||||||
slot_count: usize,
|
slot_count: usize,
|
||||||
|
storage_count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> SortedStorages<'a> {
|
impl<'a> SortedStorages<'a> {
|
||||||
@ -32,6 +33,10 @@ impl<'a> SortedStorages<'a> {
|
|||||||
self.slot_count
|
self.slot_count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn storage_count(&self) -> usize {
|
||||||
|
self.storage_count
|
||||||
|
}
|
||||||
|
|
||||||
// assumptions:
|
// assumptions:
|
||||||
// 1. each SnapshotStorage.!is_empty()
|
// 1. each SnapshotStorage.!is_empty()
|
||||||
// 2. SnapshotStorage.first().unwrap().get_slot() is unique from all other SnapshotStorage items.
|
// 2. SnapshotStorage.first().unwrap().get_slot() is unique from all other SnapshotStorage items.
|
||||||
@ -79,7 +84,9 @@ impl<'a> SortedStorages<'a> {
|
|||||||
let mut slot_count = 0;
|
let mut slot_count = 0;
|
||||||
let mut time = Measure::start("get slot");
|
let mut time = Measure::start("get slot");
|
||||||
let source_ = source.clone();
|
let source_ = source.clone();
|
||||||
source_.for_each(|(_, slot)| {
|
let mut storage_count = 0;
|
||||||
|
source_.for_each(|(storages, slot)| {
|
||||||
|
storage_count += storages.len();
|
||||||
slot_count += 1;
|
slot_count += 1;
|
||||||
adjust_min_max(*slot);
|
adjust_min_max(*slot);
|
||||||
});
|
});
|
||||||
@ -109,6 +116,7 @@ impl<'a> SortedStorages<'a> {
|
|||||||
range,
|
range,
|
||||||
storages,
|
storages,
|
||||||
slot_count,
|
slot_count,
|
||||||
|
storage_count,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,6 +140,7 @@ pub mod tests {
|
|||||||
range,
|
range,
|
||||||
storages,
|
storages,
|
||||||
slot_count,
|
slot_count,
|
||||||
|
storage_count: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user