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

Commit

Permalink
datapoint for verify_snapshot_bank (#17306) (#17339)
Browse files Browse the repository at this point in the history
(cherry picked from commit 75335b4)

Co-authored-by: Jeff Washington (jwash) <75863576+jeffwashington@users.noreply.github.com>
  • Loading branch information
mergify[bot] and jeffwashington authored May 20, 2021
1 parent 0e9fe08 commit e9c3e0b
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4415,12 +4415,36 @@ impl Bank {
/// A snapshot bank should be purged of 0 lamport accounts which are not part of the hash
/// calculation and could shield other real accounts.
pub fn verify_snapshot_bank(&self) -> bool {
let mut clean_time = Measure::start("clean");
if self.slot() > 0 {
self.clean_accounts(true);
}
clean_time.stop();

let mut shrink_all_slots_time = Measure::start("shrink_all_slots");
if self.slot() > 0 {
self.shrink_all_slots();
}
shrink_all_slots_time.stop();

let mut verify_time = Measure::start("verify_bank_hash");
let mut verify = self.verify_bank_hash();
verify_time.stop();

let mut verify2_time = Measure::start("verify_hash");
// Order and short-circuiting is significant; verify_hash requires a valid bank hash
self.verify_bank_hash() && self.verify_hash()
verify = verify && self.verify_hash();
verify2_time.stop();

datapoint_info!(
"verify_snapshot_bank",
("clean_us", clean_time.as_us(), i64),
("shrink_all_slots_us", shrink_all_slots_time.as_us(), i64),
("verify_bank_hash_us", verify_time.as_us(), i64),
("verify_hash_us", verify2_time.as_us(), i64),
);

verify
}

/// Return the number of hashes per tick
Expand Down

0 comments on commit e9c3e0b

Please sign in to comment.