Struct wasmedge_sys::Statistics
source · pub struct Statistics { /* private fields */ }
Expand description
Struct of WasmEdge Statistics.
Implementations§
source§impl Statistics
impl Statistics
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
pub fn as_ptr(&self) -> *const WasmEdge_StatisticsContext
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 more