Struct wasmedge_sys::Statistics
source · pub struct Statistics { /* private fields */ }
Expand description
Struct of WasmEdge Statistics.
Implementations§
source§impl Statistics
impl Statistics
sourcepub fn create() -> WasmEdgeResult<Self>
pub fn create() -> WasmEdgeResult<Self>
sourcepub fn instr_count(&self) -> u64
pub fn instr_count(&self) -> u64
Returns the instruction count in execution.
sourcepub fn instr_per_sec(&self) -> f64
pub fn instr_per_sec(&self) -> f64
Returns the instruction count per second in execution.
Notice
For the following cases,
- Statistics is not enabled, or
- the total execution time is 0
The instructions per second could be NaN
, which represents divided-by-zero
.
Use the is_nan
function of F64 to check the return value before use it,
for example,
use wasmedge_sys::Statistics;
// create a Statistics instance
let stat = Statistics::create().expect("fail to create a Statistics");
// check instruction count per second
assert!(stat.instr_per_sec().is_nan());
sourcepub fn cost_in_total(&self) -> u64
pub fn cost_in_total(&self) -> u64
Returns the total cost in execution.
sourcepub fn set_cost_table(&mut self, cost_table: impl AsRef<[u64]>)
pub fn set_cost_table(&mut self, cost_table: impl AsRef<[u64]>)
sourcepub fn set_cost_limit(&mut self, limit: u64)
pub fn set_cost_limit(&mut self, limit: u64)
sourcepub fn as_ptr(&self) -> *const WasmEdge_StatisticsContext
Available on crate feature ffi
only.
pub fn as_ptr(&self) -> *const WasmEdge_StatisticsContext
ffi
only.Provides a raw pointer to the inner Statistics context.
Trait Implementations§
source§impl Clone for Statistics
impl Clone for Statistics
source§fn clone(&self) -> Statistics
fn clone(&self) -> Statistics
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Statistics
impl Debug for Statistics
Auto Trait Implementations§
impl RefUnwindSafe for Statistics
impl Send for Statistics
impl Sync for Statistics
impl Unpin for Statistics
impl UnwindSafe for Statistics
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more