Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

metrics on rent partitions #19728

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down