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

Used to collect statistics of the WasmEdge runtime, such as the count of instructions in execution.

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

Returns the total cost in execution.

Sets the cost of instructions.

Arguments
  • cost_table specifies the slice of cost table.

Sets the cost limit in execution.

Arguments
  • limit specifies the cost limit.

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

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.