Struct wasmedge_sdk::Statistics
source · pub struct Statistics { /* private fields */ }
Expand description
Used to collect statistics of the WasmEdge runtime, such as the count of instructions in execution.
Implementations§
source§impl Statistics
impl Statistics
sourcepub fn new() -> WasmEdgeResult<Self>
pub fn new() -> WasmEdgeResult<Self>
sourcepub fn count_per_second(&self) -> f64
pub fn count_per_second(&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_sdk::Statistics;
// create a Statistics instance
let stat = Statistics::new().expect("fail to create a Statistics");
// check instruction count per second
assert!(stat.count_per_second().is_nan());
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)
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 moreAuto 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