Introduce benchmarking API

The new crate introduced here, `wasmtime-bench-api`, creates a shared library, e.g. `wasmtime_bench_api.so`, for executing Wasm benchmarks using Wasmtime. It allows us to measure several phases separately by exposing `engine_compile_module`, `engine_instantiate_module`, and `engine_execute_module`, which pass around an opaque pointer to the internally initialized state. This state is initialized and freed by `engine_create` and `engine_free`, respectively. The API also introduces a way of passing in functions to satisfy the `"bench" "start"` and `"bench" "end"` symbols that we expect Wasm benchmarks to import. The API is exposed in a C-compatible way so that we can dynamically load it (carefully) in our benchmark runner.
This commit is contained in:
Andrew Brown
2020-11-20 11:37:13 -08:00
parent 2cec20aa57
commit 41d668b4da
4 changed files with 235 additions and 0 deletions

View File

@@ -64,6 +64,7 @@ opt-level = 0
[workspace]
members = [
"cranelift",
"crates/bench-api",
"crates/c-api",
"crates/fuzzing",
"crates/misc/run-examples",