mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: move BlockExecutorStats (#7672)
This commit is contained in:
@ -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"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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::{
|
||||
|
||||
Reference in New Issue
Block a user