report on min/max bin stats for accounts index (#18338)

This commit is contained in:
Jeff Washington (jwash) 2021-06-30 19:46:59 -05:00 committed by GitHub
parent 52290dbd35
commit 531f1bce78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 0 deletions

View File

@ -166,6 +166,9 @@ struct GenerateIndexTimings {
pub index_time: u64,
pub scan_time: u64,
pub insertion_time_us: u64,
pub min_bin_size: usize,
pub max_bin_size: usize,
pub total_items: usize,
}
impl GenerateIndexTimings {
@ -176,6 +179,9 @@ impl GenerateIndexTimings {
("total_us", self.index_time, i64),
("scan_stores_us", self.scan_time, i64),
("insertion_time_us", self.insertion_time_us, i64),
("min_bin_size", self.min_bin_size as i64, i64),
("max_bin_size", self.max_bin_size as i64, i64),
("total_items", self.total_items as i64, i64),
);
}
}
@ -5945,10 +5951,28 @@ impl AccountsDb {
})
.sum();
index_time.stop();
let mut min_bin_size = usize::MAX;
let mut max_bin_size = usize::MIN;
let total_items = self
.accounts_index
.account_maps
.iter()
.map(|i| {
let len = i.read().unwrap().len();
min_bin_size = std::cmp::min(min_bin_size, len);
max_bin_size = std::cmp::max(max_bin_size, len);
len
})
.sum();
let timings = GenerateIndexTimings {
scan_time,
index_time: index_time.as_us(),
insertion_time_us: insertion_time_us.load(Ordering::Relaxed),
min_bin_size,
max_bin_size,
total_items,
};
timings.report();