Add load/execute/store timings (#14561)
This commit is contained in:
@ -93,6 +93,21 @@ pub const SECONDS_PER_YEAR: f64 = 365.25 * 24.0 * 60.0 * 60.0;
|
||||
|
||||
pub const MAX_LEADER_SCHEDULE_STAKES: Epoch = 5;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct ExecuteTimings {
|
||||
pub load_us: u64,
|
||||
pub execute_us: u64,
|
||||
pub store_us: u64,
|
||||
}
|
||||
|
||||
impl ExecuteTimings {
|
||||
pub fn accumulate(&mut self, other: &ExecuteTimings) {
|
||||
self.load_us += other.load_us;
|
||||
self.execute_us += other.execute_us;
|
||||
self.store_us += other.store_us;
|
||||
}
|
||||
}
|
||||
|
||||
type BankStatusCache = StatusCache<Result<()>>;
|
||||
#[frozen_abi(digest = "MUmkgPsCRrWL2HEsMEvpkWMis35kbBnaEZtrph5P6bk")]
|
||||
pub type BankSlotDelta = SlotDelta<Result<()>>;
|
||||
@ -2437,6 +2452,7 @@ impl Bank {
|
||||
MAX_PROCESSING_AGE - MAX_TRANSACTION_FORWARDING_DELAY,
|
||||
false,
|
||||
true,
|
||||
&mut ExecuteTimings::default(),
|
||||
);
|
||||
|
||||
let transaction_result = executed[0].0.clone().map(|_| ());
|
||||
@ -2847,6 +2863,7 @@ impl Bank {
|
||||
max_age: usize,
|
||||
enable_cpi_recording: bool,
|
||||
enable_log_recording: bool,
|
||||
timings: &mut ExecuteTimings,
|
||||
) -> (
|
||||
Vec<TransactionLoadResult>,
|
||||
Vec<TransactionExecutionResult>,
|
||||
@ -2988,6 +3005,8 @@ impl Bank {
|
||||
execution_time.as_us(),
|
||||
txs.len(),
|
||||
);
|
||||
timings.load_us += load_time.as_us();
|
||||
timings.execute_us += execution_time.as_us();
|
||||
|
||||
let mut tx_count: u64 = 0;
|
||||
let err_count = &mut error_counters.total;
|
||||
@ -3143,6 +3162,7 @@ impl Bank {
|
||||
executed: &[TransactionExecutionResult],
|
||||
tx_count: u64,
|
||||
signature_count: u64,
|
||||
timings: &mut ExecuteTimings,
|
||||
) -> TransactionResults {
|
||||
assert!(
|
||||
!self.freeze_started(),
|
||||
@ -3182,6 +3202,7 @@ impl Bank {
|
||||
// once committed there is no way to unroll
|
||||
write_time.stop();
|
||||
debug!("store: {}us txs_len={}", write_time.as_us(), txs.len(),);
|
||||
timings.store_us += write_time.as_us();
|
||||
self.update_transaction_statuses(txs, iteration_order, &executed);
|
||||
let fee_collection_results =
|
||||
self.filter_program_errors_and_collect_fee(txs, iteration_order, executed);
|
||||
@ -3764,6 +3785,7 @@ impl Bank {
|
||||
collect_balances: bool,
|
||||
enable_cpi_recording: bool,
|
||||
enable_log_recording: bool,
|
||||
timings: &mut ExecuteTimings,
|
||||
) -> (
|
||||
TransactionResults,
|
||||
TransactionBalancesSet,
|
||||
@ -3789,6 +3811,7 @@ impl Bank {
|
||||
max_age,
|
||||
enable_cpi_recording,
|
||||
enable_log_recording,
|
||||
timings,
|
||||
);
|
||||
|
||||
let results = self.commit_transactions(
|
||||
@ -3798,6 +3821,7 @@ impl Bank {
|
||||
&executed,
|
||||
tx_count,
|
||||
signature_count,
|
||||
timings,
|
||||
);
|
||||
let post_balances = if collect_balances {
|
||||
self.collect_balances(batch)
|
||||
@ -3815,9 +3839,16 @@ impl Bank {
|
||||
#[must_use]
|
||||
pub fn process_transactions(&self, txs: &[Transaction]) -> Vec<Result<()>> {
|
||||
let batch = self.prepare_batch(txs, None);
|
||||
self.load_execute_and_commit_transactions(&batch, MAX_PROCESSING_AGE, false, false, false)
|
||||
.0
|
||||
.fee_collection_results
|
||||
self.load_execute_and_commit_transactions(
|
||||
&batch,
|
||||
MAX_PROCESSING_AGE,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
&mut ExecuteTimings::default(),
|
||||
)
|
||||
.0
|
||||
.fee_collection_results
|
||||
}
|
||||
|
||||
/// Create, sign, and process a Transaction from `keypair` to `to` of
|
||||
@ -7664,6 +7695,7 @@ pub(crate) mod tests {
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
&mut ExecuteTimings::default(),
|
||||
)
|
||||
.0
|
||||
.fee_collection_results;
|
||||
@ -9644,6 +9676,7 @@ pub(crate) mod tests {
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
&mut ExecuteTimings::default(),
|
||||
);
|
||||
|
||||
assert!(inner_instructions[0].iter().all(|ix| ix.is_empty()));
|
||||
|
Reference in New Issue
Block a user