Skip to content

Commit

Permalink
Adds benchmark to user-host Program
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoximenes committed Dec 11, 2024
1 parent d2d27d2 commit 228f963
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arbitrator/wasm-libraries/user-host/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE

use arbutil::{
benchmark::Benchmark,
evm::{
api::{EvmApiMethod, Gas, Ink, VecReader, EVM_API_METHOD_REQ_OFFSET},
req::{EvmApiRequestor, RequestHandler},
Expand Down Expand Up @@ -75,6 +76,8 @@ pub(crate) struct Program {
pub evm_api: EvmApiRequestor<VecReader, UserHostRequester>,
/// EVM Context info.
pub evm_data: EvmData,
// Used to benchmark execution blocks of code
pub benchmark: Option<Benchmark>,
/// WAVM module index.
pub module: u32,
/// Call configuration.
Expand Down Expand Up @@ -167,6 +170,7 @@ impl Program {
outs: vec![],
evm_api: EvmApiRequestor::new(UserHostRequester::default()),
evm_data,
benchmark: None,
module,
config,
early_exit: None,
Expand Down Expand Up @@ -237,6 +241,10 @@ impl UserHost<VecReader> for Program {
&self.evm_data
}

fn benchmark(&mut self) -> &mut Option<Benchmark> {
&mut self.benchmark
}

fn evm_return_data_len(&mut self) -> &mut u32 {
&mut self.evm_data.return_data_len
}
Expand Down

0 comments on commit 228f963

Please sign in to comment.