pub struct Statistics { /* private fields */ }
Expand description

Struct of WasmEdge Statistics.

Implementations§

Creates a new Statistics.

Error

If fail to create a Statistics, then an error is returned.

Returns the instruction count in execution.

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());

Returns the total cost in execution.

Sets the cost of instructions.

Arguments
  • cost_table - The slice of cost table.

Sets the cost limit in execution.

Arguments
  • limit - The cost limit.

Clears the data in this statistics.

Provides a raw pointer to the inner Statistics context.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.