Skip to main content

Crate nub_bench

Crate nub_bench 

Source
Expand description

Shared harness for nub’s benchmarks and end-to-end tests.

Every program in nub/programs is cross-compiled and linked by this crate’s build.rs, then exposed here as a decoded ProgramBlob. Both the criterion benches and the conformance tests drive the same list, so a new program is one line away from being both measured and checked.

Structs§

Program
One benchmark program: its name, its linked blob, and the (return_value, gas_used) its endpoint 0 must produce.

Constants§

BENCH_GAS
Gas ceiling for a benchmark run. i64::MAX, not u64::MAX: the JIT’s gas counter is an i64 and it detects exhaustion by sign, so a u64::MAX budget would present as already-negative.
EXIT_HOST_CALL
Clean-halt exit reason: nub-rt’s endpoint trampoline ends in a bare ecall, which the linker rewrites to custom-0 ecalli imm=0 and the engine surfaces as HostCall(0).
FLAT_GUEST_BLOB_PATH
Path to the flat personality’s guest ELF, built by this crate’s build.rs.
PROGRAMS
Every program, in a stable order.

Functions§

flat_sandbox
A process-wide Nub<Flat> over the KVM sandbox.
run_interpreter
Run endpoint 0 of blob on the interpreter, returning (return_value, gas_used).