Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save duration to CallInfo #25

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/blockifier/src/execution/call_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ pub struct CallInfo {
pub charged_resources: ChargedResources,

// Additional information gathered during execution.
pub time: std::time::Duration,
pub storage_read_values: Vec<Felt>,
pub accessed_storage_keys: HashSet<StorageKey>,
pub read_class_hash_values: Vec<ClassHash>,
Expand Down
1 change: 1 addition & 0 deletions crates/blockifier/src/execution/entry_point_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ pub fn finalize_execution(
accessed_storage_keys: syscall_handler_base.accessed_keys,
read_class_hash_values: syscall_handler_base.read_class_hash_values,
accessed_contract_addresses: syscall_handler_base.accessed_contract_addresses,
time: std::time::Duration::default(),
})
}

Expand Down
24 changes: 19 additions & 5 deletions crates/blockifier/src/execution/execution_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,26 @@ pub fn execute_entry_point_call(
) -> EntryPointExecutionResult<CallInfo> {
match compiled_class {
RunnableCompiledClass::V0(compiled_class) => {
deprecated_entry_point_execution::execute_entry_point_call(
let pre_time = std::time::Instant::now();
let mut result = deprecated_entry_point_execution::execute_entry_point_call(
call,
compiled_class,
state,
context,
)
)?;
result.time = pre_time.elapsed();
Ok(result)
}
RunnableCompiledClass::V1(compiled_class) => {
entry_point_execution::execute_entry_point_call(call, compiled_class, state, context)
let pre_time = std::time::Instant::now();
let mut result = entry_point_execution::execute_entry_point_call(
call,
compiled_class,
state,
context,
)?;
result.time = pre_time.elapsed();
Ok(result)
}
#[cfg(feature = "cairo_native")]
RunnableCompiledClass::V1Native(compiled_class) => {
Expand All @@ -148,12 +159,15 @@ pub fn execute_entry_point_call(
// context,
// )
// } else {
native_entry_point_execution::execute_entry_point_call(
let pre_time = std::time::Instant::now();
let mut result = native_entry_point_execution::execute_entry_point_call(
call,
compiled_class,
state,
context,
)
)?;
result.time = pre_time.elapsed();
Ok(result)
// }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,6 @@ fn create_callinfo(
accessed_contract_addresses: syscall_handler.base.accessed_contract_addresses,
read_class_hash_values: syscall_handler.base.read_class_hash_values,
tracked_resource: TrackedResource::SierraGas,
time: std::time::Duration::default(),
})
}
Loading