Scope SamplePerformanceService Bank only for initial sample snapshot (#30316)

* Scope Bank only for initial sample snapshot

* Remove nesting
This commit is contained in:
Tyera 2023-02-14 16:32:26 -07:00 committed by GitHub
parent 2e885cf99a
commit 7c35191322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 10 deletions

View File

@ -51,18 +51,19 @@ impl SamplePerformanceService {
blockstore: &Arc<Blockstore>, blockstore: &Arc<Blockstore>,
exit: Arc<AtomicBool>, exit: Arc<AtomicBool>,
) { ) {
let (bank, highest_slot) = { let mut snapshot = {
let forks = bank_forks.read().unwrap(); let forks = bank_forks.read().unwrap();
(forks.root_bank(), forks.highest_slot()) let bank = forks.root_bank();
}; let highest_slot = forks.highest_slot();
// Store the absolute transaction counts to that we can compute the // Store the absolute transaction counts to that we can compute the
// difference between these values at points in time to figure out // difference between these values at points in time to figure out
// how many transactions occurred in that timespan. // how many transactions occurred in that timespan.
let mut snapshot = SamplePerformanceSnapshot { SamplePerformanceSnapshot {
num_transactions: bank.transaction_count(), num_transactions: bank.transaction_count(),
num_non_vote_transactions: bank.non_vote_transaction_count_since_restart(), num_non_vote_transactions: bank.non_vote_transaction_count_since_restart(),
highest_slot, highest_slot,
}
}; };
let mut now = Instant::now(); let mut now = Instant::now();