Trait polkadot_sdk_frame::benchmarking::prelude::v1::v2::BenchmarkingSetup
pub trait BenchmarkingSetup<T, I = ()> {
// Required methods
fn components(&self) -> Vec<(BenchmarkParameter, u32, u32)>;
fn instance(
&self,
recording: &mut impl Recording,
components: &[(BenchmarkParameter, u32)],
verify: bool,
) -> Result<(), BenchmarkError>;
// Provided methods
fn test_instance(
&self,
components: &[(BenchmarkParameter, u32)],
on_before_start: &dyn Fn(),
) -> Result<(), BenchmarkError> { ... }
fn unit_test_instance(
&self,
components: &[(BenchmarkParameter, u32)],
) -> Result<(), BenchmarkError> { ... }
}
Expand description
The required setup for creating a benchmark.
Instance generic parameter is optional and can be used in order to capture unused generics for instantiable pallets.
Required Methods§
fn components(&self) -> Vec<(BenchmarkParameter, u32, u32)>
fn components(&self) -> Vec<(BenchmarkParameter, u32, u32)>
Return the components and their ranges which should be tested in this benchmark.
fn instance(
&self,
recording: &mut impl Recording,
components: &[(BenchmarkParameter, u32)],
verify: bool,
) -> Result<(), BenchmarkError>
fn instance( &self, recording: &mut impl Recording, components: &[(BenchmarkParameter, u32)], verify: bool, ) -> Result<(), BenchmarkError>
Set up the storage, and prepare a closure to run the benchmark.
Provided Methods§
fn test_instance(
&self,
components: &[(BenchmarkParameter, u32)],
on_before_start: &dyn Fn(),
) -> Result<(), BenchmarkError>
fn test_instance( &self, components: &[(BenchmarkParameter, u32)], on_before_start: &dyn Fn(), ) -> Result<(), BenchmarkError>
Same as instance
but passing a closure to run before the benchmark starts.
fn unit_test_instance(
&self,
components: &[(BenchmarkParameter, u32)],
) -> Result<(), BenchmarkError>
fn unit_test_instance( &self, components: &[(BenchmarkParameter, u32)], ) -> Result<(), BenchmarkError>
Same as instance
but passing a no-op recording for unit tests.
Object Safety§
This trait is not object safe.