@@ -63,7 +63,7 @@ impl EngineApiMetrics {
6363 pub ( crate ) fn execute_metered < E , DB > (
6464 & self ,
6565 executor : E ,
66- transactions : impl Iterator < Item = Result < impl ExecutableTx < E > , BlockExecutionError > > ,
66+ mut transactions : impl Iterator < Item = Result < impl ExecutableTx < E > , BlockExecutionError > > ,
6767 state_hook : Box < dyn OnStateHook > ,
6868 ) -> Result < ( BlockExecutionOutput < E :: Receipt > , Vec < Address > ) , BlockExecutionError >
6969 where
@@ -83,14 +83,21 @@ impl EngineApiMetrics {
8383 . entered ( )
8484 . in_scope ( || executor. apply_pre_execution_changes ( ) ) ?;
8585 let exec_span = debug_span ! ( target: "engine::tree" , "execution" ) . entered ( ) ;
86- for tx in transactions {
86+ loop {
87+ let start = Instant :: now ( ) ;
88+ let Some ( tx) = transactions. next ( ) else { break } ;
89+ self . executor . transaction_wait_histogram . record ( start. elapsed ( ) ) ;
90+
8791 let tx = tx?;
92+ senders. push ( * tx. signer ( ) ) ;
93+
8894 let span =
8995 debug_span ! ( target: "engine::tree" , "execute tx" , tx_hash=?tx. tx( ) . tx_hash( ) ) ;
9096 let enter = span. entered ( ) ;
9197 trace ! ( target: "engine::tree" , "Executing transaction" ) ;
92- senders . push ( * tx . signer ( ) ) ;
98+ let start = Instant :: now ( ) ;
9399 let gas_used = executor. execute_transaction ( tx) ?;
100+ self . executor . transaction_execution_histogram . record ( start. elapsed ( ) ) ;
94101
95102 // record the tx gas used
96103 enter. record ( "gas_used" , gas_used) ;
0 commit comments