From 4c2a8596ffa5e437577173b86c3733a7e07f9862 Mon Sep 17 00:00:00 2001 From: xudaquan2003 Date: Sun, 8 Oct 2023 15:56:33 +0800 Subject: [PATCH] Split the get_revm_metric_record function into two --- crates/revm/src/executor.rs | 10 ++++++++-- crates/stages/src/stages/execution.rs | 5 +++-- crates/storage/provider/src/traits/executor.rs | 10 ++++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/crates/revm/src/executor.rs b/crates/revm/src/executor.rs index 672654bc2684..8aaa96e2a5ea 100644 --- a/crates/revm/src/executor.rs +++ b/crates/revm/src/executor.rs @@ -394,8 +394,14 @@ where /// Handle revm metric records. #[cfg(feature = "open_revm_metrics_record")] - fn get_revm_metric_record(&self) -> (RevmMetricRecord, usize) { - (self.revm_metric_record.clone(), self.evm.db.as_ref().expect("db is empty").size()) + fn get_revm_metric_record(&self) -> RevmMetricRecord { + self.revm_metric_record.clone() + } + + /// Handle revm metric records. + #[cfg(feature = "open_revm_metrics_record")] + fn get_revm_metric_cachedb_size(&self) -> usize { + self.evm.db.as_ref().expect("db is empty").size() } } diff --git a/crates/stages/src/stages/execution.rs b/crates/stages/src/stages/execution.rs index 049c46a3eae4..50b1f00ce406 100644 --- a/crates/stages/src/stages/execution.rs +++ b/crates/stages/src/stages/execution.rs @@ -216,8 +216,9 @@ impl ExecutionStage { let record = executor.get_revm_metric_record(); println!(""); println!("block_number = {:?}", block_number); - println!("revm_record = {:?}", record.0); - println!("cachedb_size = {:?}", record.1); + println!("revm_record = {:?}", record); + let cachedb_size = executor.get_revm_metric_cachedb_size(); + println!("cachedb_size = {:?}", cachedb_size); println!(""); } cnt1 += 1; diff --git a/crates/storage/provider/src/traits/executor.rs b/crates/storage/provider/src/traits/executor.rs index a1cc4361be18..d8f28812b7d2 100644 --- a/crates/storage/provider/src/traits/executor.rs +++ b/crates/storage/provider/src/traits/executor.rs @@ -47,7 +47,13 @@ pub trait BlockExecutor { /// Handle revm metric records. #[cfg(feature = "open_revm_metrics_record")] - fn get_revm_metric_record(&self) -> (RevmMetricRecord, usize) { - (RevmMetricRecord::default(), 0) + fn get_revm_metric_record(&self) -> RevmMetricRecord { + RevmMetricRecord::default() + } + + /// Handle revm metric records. + #[cfg(feature = "open_revm_metrics_record")] + fn get_revm_metric_cachedb_size(&self) -> usize { + 0 } }