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 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