Add timing metrics to bank creation and rewards calculation (#21066)
This commit is contained in:
@ -1325,6 +1325,7 @@ impl Bank {
|
|||||||
reward_calc_tracer: Option<impl Fn(&RewardCalculationEvent) + Send + Sync>,
|
reward_calc_tracer: Option<impl Fn(&RewardCalculationEvent) + Send + Sync>,
|
||||||
new_bank_options: NewBankOptions,
|
new_bank_options: NewBankOptions,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
let mut time = Measure::start("bank::new_from_parent");
|
||||||
let NewBankOptions {
|
let NewBankOptions {
|
||||||
vote_only_bank,
|
vote_only_bank,
|
||||||
disable_epoch_boundary_optimization,
|
disable_epoch_boundary_optimization,
|
||||||
@ -1430,13 +1431,6 @@ impl Bank {
|
|||||||
sysvar_cache: RwLock::new(Vec::new()),
|
sysvar_cache: RwLock::new(Vec::new()),
|
||||||
};
|
};
|
||||||
|
|
||||||
datapoint_info!(
|
|
||||||
"bank-new_from_parent-heights",
|
|
||||||
("slot_height", slot, i64),
|
|
||||||
("block_height", new.block_height, i64),
|
|
||||||
("parent_slot_height", parent.slot(), i64),
|
|
||||||
);
|
|
||||||
|
|
||||||
let mut ancestors = Vec::with_capacity(1 + new.parents().len());
|
let mut ancestors = Vec::with_capacity(1 + new.parents().len());
|
||||||
ancestors.push(new.slot());
|
ancestors.push(new.slot());
|
||||||
new.parents().iter().for_each(|p| {
|
new.parents().iter().for_each(|p| {
|
||||||
@ -1501,6 +1495,17 @@ impl Bank {
|
|||||||
new.update_clock(Some(parent_epoch));
|
new.update_clock(Some(parent_epoch));
|
||||||
new.update_fees();
|
new.update_fees();
|
||||||
new.fill_sysvar_cache();
|
new.fill_sysvar_cache();
|
||||||
|
|
||||||
|
time.stop();
|
||||||
|
|
||||||
|
datapoint_info!(
|
||||||
|
"bank-new_from_parent-heights",
|
||||||
|
("slot_height", slot, i64),
|
||||||
|
("block_height", new.block_height, i64),
|
||||||
|
("parent_slot_height", parent.slot(), i64),
|
||||||
|
("time_us", time.as_us(), i64),
|
||||||
|
);
|
||||||
|
|
||||||
new
|
new
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2095,6 +2100,7 @@ impl Bank {
|
|||||||
if prev_epoch == self.epoch() {
|
if prev_epoch == self.epoch() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let mut timing = Measure::start("epoch_rewards");
|
||||||
// if I'm the first Bank in an epoch, count, claim, disburse rewards from Inflation
|
// if I'm the first Bank in an epoch, count, claim, disburse rewards from Inflation
|
||||||
|
|
||||||
let slot_in_year = self.slot_in_year_for_inflation();
|
let slot_in_year = self.slot_in_year_for_inflation();
|
||||||
@ -2173,6 +2179,7 @@ impl Bank {
|
|||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
timing.stop();
|
||||||
|
|
||||||
datapoint_warn!(
|
datapoint_warn!(
|
||||||
"epoch_rewards",
|
"epoch_rewards",
|
||||||
@ -2184,7 +2191,8 @@ impl Bank {
|
|||||||
("validator_rewards", validator_rewards_paid, i64),
|
("validator_rewards", validator_rewards_paid, i64),
|
||||||
("active_stake", active_stake, i64),
|
("active_stake", active_stake, i64),
|
||||||
("pre_capitalization", capitalization, i64),
|
("pre_capitalization", capitalization, i64),
|
||||||
("post_capitalization", self.capitalization(), i64)
|
("post_capitalization", self.capitalization(), i64),
|
||||||
|
("time_us", timing.as_us(), i64)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user