chore: move BlockExecutorStats (#7672)

This commit is contained in:
Matthias Seitz
2024-04-16 13:59:00 +02:00
committed by GitHub
parent cd5be8e084
commit 0aae8c4210
4 changed files with 36 additions and 38 deletions

View File

@ -3,8 +3,6 @@
use crate::{bundle_state::BundleStateWithReceipts, StateProvider};
use reth_interfaces::executor::BlockExecutionError;
use reth_primitives::{BlockNumber, BlockWithSenders, PruneModes, Receipt, U256};
use std::time::Duration;
use tracing::debug;
/// Executor factory that would create the EVM with particular state provider.
///
@ -70,34 +68,3 @@ pub trait PrunableBlockExecutor: BlockExecutor {
/// Set prune modes.
fn set_prune_modes(&mut self, prune_modes: PruneModes);
}
/// Block execution statistics. Contains duration of each step of block execution.
#[derive(Clone, Debug, Default)]
pub struct BlockExecutorStats {
/// Execution duration.
pub execution_duration: Duration,
/// Time needed to apply output of revm execution to revm cached state.
pub apply_state_duration: Duration,
/// Time needed to apply post execution state changes.
pub apply_post_execution_state_changes_duration: Duration,
/// Time needed to merge transitions and create reverts.
/// It this time transitions are applies to revm bundle state.
pub merge_transitions_duration: Duration,
/// Time needed to calculate receipt roots.
pub receipt_root_duration: Duration,
}
impl BlockExecutorStats {
/// Log duration to debug level log.
pub fn log_debug(&self) {
debug!(
target: "evm",
evm_transact = ?self.execution_duration,
apply_state = ?self.apply_state_duration,
apply_post_state = ?self.apply_post_execution_state_changes_duration,
merge_transitions = ?self.merge_transitions_duration,
receipt_root = ?self.receipt_root_duration,
"Execution time"
);
}
}

View File

@ -49,7 +49,7 @@ mod withdrawals;
pub use withdrawals::WithdrawalsProvider;
mod executor;
pub use executor::{BlockExecutor, BlockExecutorStats, ExecutorFactory, PrunableBlockExecutor};
pub use executor::{BlockExecutor, ExecutorFactory, PrunableBlockExecutor};
mod chain;
pub use chain::{