More set_root metrics (#21286)

This commit is contained in:
sakridge
2021-11-15 23:28:18 +00:00
committed by GitHub
parent 33d9491f41
commit 398af132a5
2 changed files with 70 additions and 25 deletions

View File

@ -2724,11 +2724,20 @@ impl ReplayStage {
voted_signatures: &mut Vec<Signature>,
epoch_slots_frozen_slots: &mut EpochSlotsFrozenSlots,
) {
bank_forks.write().unwrap().set_root(
let removed_banks = bank_forks.write().unwrap().set_root(
new_root,
accounts_background_request_sender,
highest_confirmed_root,
);
let mut dropped_banks_time = Measure::start("handle_new_root::drop_banks");
drop(removed_banks);
dropped_banks_time.stop();
if dropped_banks_time.as_ms() > 10 {
datapoint_info!(
"handle_new_root-dropped_banks",
("elapsed_ms", dropped_banks_time.as_ms(), i64)
);
}
// Dropping the bank_forks write lock and reacquiring as a read lock is
// safe because updates to bank_forks are only made by a single thread.
let r_bank_forks = bank_forks.read().unwrap();