Struct near_vm_logic::profile::ProfileData
source · [−]pub struct ProfileData { /* private fields */ }
Expand description
Profile of gas consumption. When add new cost, the new cost should also be append to Cost::ALL
Implementations
sourceimpl ProfileData
impl ProfileData
pub fn new() -> ProfileData
pub fn merge(&mut self, other: &ProfileData)
pub fn add_action_cost(&mut self, action: ActionCosts, value: u64)
pub fn add_ext_cost(&mut self, ext: ExtCosts, value: u64)
sourcepub fn compute_wasm_instruction_cost(&mut self, total_gas_burnt: u64)
pub fn compute_wasm_instruction_cost(&mut self, total_gas_burnt: u64)
WasmInstruction is the only cost we don’t explicitly account for. Instead, we compute it at the end of contract call as the difference between total gas burnt and what we’ve explicitly accounted for in the profile.
This is because WasmInstruction is the hottest cost and is implemented with the help on the VM side, so we don’t want to have profiling logic there both for simplicity and efficiency reasons.
pub fn get_action_cost(&self, action: ActionCosts) -> u64
pub fn get_ext_cost(&self, ext: ExtCosts) -> u64
pub fn host_gas(&self) -> u64
pub fn action_gas(&self) -> u64
Trait Implementations
sourceimpl BorshDeserialize for ProfileData where
DataArray: BorshDeserialize,
impl BorshDeserialize for ProfileData where
DataArray: BorshDeserialize,
sourceimpl BorshSerialize for ProfileData where
DataArray: BorshSerialize,
impl BorshSerialize for ProfileData where
DataArray: BorshSerialize,
sourceimpl Clone for ProfileData
impl Clone for ProfileData
sourcefn clone(&self) -> ProfileData
fn clone(&self) -> ProfileData
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ProfileData
impl Debug for ProfileData
sourceimpl Default for ProfileData
impl Default for ProfileData
sourcefn default() -> ProfileData
fn default() -> ProfileData
Returns the “default value” for a type. Read more
sourceimpl Index<Cost> for ProfileData
impl Index<Cost> for ProfileData
sourceimpl IndexMut<Cost> for ProfileData
impl IndexMut<Cost> for ProfileData
sourceimpl PartialEq<ProfileData> for ProfileData
impl PartialEq<ProfileData> for ProfileData
sourcefn eq(&self, other: &ProfileData) -> bool
fn eq(&self, other: &ProfileData) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ProfileData) -> bool
fn ne(&self, other: &ProfileData) -> bool
This method tests for !=
.
impl Eq for ProfileData
impl StructuralEq for ProfileData
impl StructuralPartialEq for ProfileData
Auto Trait Implementations
impl RefUnwindSafe for ProfileData
impl Send for ProfileData
impl Sync for ProfileData
impl Unpin for ProfileData
impl UnwindSafe for ProfileData
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more