Skip to content

Commit

Permalink
Perf: Add metrics to facilitate performance testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
anonymousGiga committed Mar 18, 2024
1 parent dee3c77 commit 8a4c4d0
Show file tree
Hide file tree
Showing 35 changed files with 1,786 additions and 69 deletions.
34 changes: 34 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions crates/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ serde = { version = "1.0", default-features = false, features = [
"derive",
"rc",
], optional = true }
revm-utils = {path = "../utils", optional = true}

[features]
default = ["std"]
Expand Down Expand Up @@ -55,3 +56,5 @@ optional_eip3607 = ["revm-primitives/optional_eip3607"]
optional_gas_refund = ["revm-primitives/optional_gas_refund"]
optional_no_base_fee = ["revm-primitives/optional_no_base_fee"]
optional_beneficiary_reward = ["revm-primitives/optional_beneficiary_reward"]
enable_opcode_metrics = ["revm-utils"]
enable_cache_record = ["revm-primitives/enable_cache_record"]
5 changes: 4 additions & 1 deletion crates/interpreter/src/instructions/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ pub fn mulmod<H: Host>(interpreter: &mut Interpreter, _host: &mut H) {

pub fn exp<H: Host, SPEC: Spec>(interpreter: &mut Interpreter, _host: &mut H) {
pop_top!(interpreter, op1, op2);
gas_or_fail!(interpreter, gas::exp_cost::<SPEC>(*op2));
let cost = gas::exp_cost::<SPEC>(*op2);
gas_or_fail!(interpreter, cost);
#[cfg(feature = "enable_opcode_metrics")]
revm_utils::metrics::record_gas(crate::opcode::EXP, cost.unwrap_or(0));
*op2 = op1.pow(*op2);
}

Expand Down
Loading

0 comments on commit 8a4c4d0

Please sign in to comment.