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 Freeze for Statistics
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