From 357ac79a23e5e5453493907f93611870b933ab75 Mon Sep 17 00:00:00 2001 From: anonymousGiga Date: Fri, 1 Dec 2023 16:44:48 +0800 Subject: [PATCH] add --- crates/revm/Cargo.toml | 4 ++-- crates/revm/src/utils.rs | 15 ++++++++++++++- crates/stages/src/stages/execution.rs | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index 64b32687f833..3f1f905c5510 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -25,7 +25,7 @@ revm-utils = { workspace = true, optional = true } # common tracing.workspace = true -ctor = "0.2.5" +ctor = {version = "0.2.5", optional = true } [dev-dependencies] reth-rlp.workspace = true @@ -43,4 +43,4 @@ enable_cache_record = [ "reth-provider/enable_cache_record", "revm-utils", ] -enable_execute_measure = ["revm-utils"] \ No newline at end of file +enable_execute_measure = ["revm-utils", "ctor"] \ No newline at end of file diff --git a/crates/revm/src/utils.rs b/crates/revm/src/utils.rs index bb074891aa1d..493ae9aa1426 100644 --- a/crates/revm/src/utils.rs +++ b/crates/revm/src/utils.rs @@ -1,4 +1,4 @@ -use revm_utils::time_utils::instant::Instant; +use revm_utils::time_utils::{convert_cycles_to_ns_f64, instant::Instant}; /// ExecuteTxsRecord #[derive(Debug, Clone, Copy, Default)] @@ -96,6 +96,19 @@ impl ExecuteTxsRecord { pub fn verify_receipt(&self) -> u64 { self.verify_receipt } + /// TODO: This function needs to be deleted later on. + pub fn print(&self) { + self.printline("total", self.total); + self.printline("transact", self.transact); + self.printline("commit_changes", self.commit_changes); + self.printline("add receipt", self.add_receipt); + self.printline("apply_post_block_changes", self.apply_post_block_changes); + self.printline("verify_receipt", self.verify_receipt); + } + + fn printline(&self, cat: &'static str, cycles: u64) { + println!("{:?}: {:?} ns", cat, convert_cycles_to_ns_f64(cycles)); + } } // TODO: This variable needs to be merged into a large structural variable later. diff --git a/crates/stages/src/stages/execution.rs b/crates/stages/src/stages/execution.rs index 9b62a800615f..9c0fbe8abac9 100644 --- a/crates/stages/src/stages/execution.rs +++ b/crates/stages/src/stages/execution.rs @@ -277,6 +277,7 @@ impl ExecutionStage { if let Some(metrics_tx) = &mut self.metrics_tx { let _ = metrics_tx.send(MetricEvent::ExecuteTxsInfo { execute_txs_record: record }); } + record.print(); } // Write remaining changes