correctly calculate hash_total for hash/lamport calculation (#18144)
This commit is contained in:
parent
e808f34b0b
commit
d5f9f3b7ce
|
@ -520,6 +520,7 @@ impl AccountsHash {
|
||||||
let mut zeros = Measure::start("eliminate zeros");
|
let mut zeros = Measure::start("eliminate zeros");
|
||||||
let overall_sum = Mutex::new(0u64);
|
let overall_sum = Mutex::new(0u64);
|
||||||
let unreduced_entries = AtomicUsize::new(0);
|
let unreduced_entries = AtomicUsize::new(0);
|
||||||
|
let hash_total = AtomicUsize::new(0);
|
||||||
let hashes: Vec<Vec<Hash>> = (0..max_bin)
|
let hashes: Vec<Vec<Hash>> = (0..max_bin)
|
||||||
.into_par_iter()
|
.into_par_iter()
|
||||||
.map(|bin| {
|
.map(|bin| {
|
||||||
|
@ -531,6 +532,7 @@ impl AccountsHash {
|
||||||
Self::checked_cast_for_capitalization(sum as u128 + *overall as u128);
|
Self::checked_cast_for_capitalization(sum as u128 + *overall as u128);
|
||||||
}
|
}
|
||||||
unreduced_entries.fetch_add(unreduced_entries_count, Ordering::Relaxed);
|
unreduced_entries.fetch_add(unreduced_entries_count, Ordering::Relaxed);
|
||||||
|
hash_total.fetch_add(hashes.len(), Ordering::Relaxed);
|
||||||
hashes
|
hashes
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
@ -538,6 +540,7 @@ impl AccountsHash {
|
||||||
stats.zeros_time_total_us += zeros.as_us();
|
stats.zeros_time_total_us += zeros.as_us();
|
||||||
let sum = *overall_sum.lock().unwrap();
|
let sum = *overall_sum.lock().unwrap();
|
||||||
stats.unreduced_entries += unreduced_entries.load(Ordering::Relaxed);
|
stats.unreduced_entries += unreduced_entries.load(Ordering::Relaxed);
|
||||||
|
stats.hash_total += hash_total.load(Ordering::Relaxed);
|
||||||
(hashes, sum)
|
(hashes, sum)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,7 +691,6 @@ impl AccountsHash {
|
||||||
let mut next_pass = PreviousPass::default();
|
let mut next_pass = PreviousPass::default();
|
||||||
let cumulative = CumulativeOffsets::from_raw(&hashes);
|
let cumulative = CumulativeOffsets::from_raw(&hashes);
|
||||||
let mut hash_total = cumulative.total_count;
|
let mut hash_total = cumulative.total_count;
|
||||||
stats.hash_total += hash_total;
|
|
||||||
next_pass.reduced_hashes = previous_state.reduced_hashes;
|
next_pass.reduced_hashes = previous_state.reduced_hashes;
|
||||||
|
|
||||||
const TARGET_FANOUT_LEVEL: usize = 3;
|
const TARGET_FANOUT_LEVEL: usize = 3;
|
||||||
|
|
Loading…
Reference in New Issue