metrics on rent partitions (#19728)

This commit is contained in:
Jeff Washington (jwash) 2021-09-09 10:50:35 -05:00 committed by GitHub
parent 46fc92f392
commit df5befdaca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 6 deletions

View File

@ -3864,10 +3864,18 @@ impl Bank {
}
let mut measure = Measure::start("collect_rent_eagerly-ms");
for partition in self.rent_collection_partitions() {
self.collect_rent_in_partition(partition);
}
let partitions = self.rent_collection_partitions();
let count = partitions.len();
let account_count: usize = partitions
.into_iter()
.map(|partition| self.collect_rent_in_partition(partition))
.sum();
measure.stop();
datapoint_info!(
"collect_rent_eagerly",
("accounts", account_count, i64),
("partitions", count, i64)
);
inc_new_counter_info!("collect_rent_eagerly-ms", measure.as_ms() as usize);
}
@ -3904,7 +3912,7 @@ impl Bank {
}
}
fn collect_rent_in_partition(&self, partition: Partition) {
fn collect_rent_in_partition(&self, partition: Partition) -> usize {
let subrange = Self::pubkey_range_from_partition(partition);
let accounts = self
@ -3934,8 +3942,7 @@ impl Bank {
}
self.collected_rent.fetch_add(total_rent, Relaxed);
self.rewards.write().unwrap().append(&mut rent_debits.0);
datapoint_info!("collect_rent_eagerly", ("accounts", account_count, i64));
account_count
}
// Mostly, the pair (start_index & end_index) is equivalent to this range: