benchmarks! macro: factorize instance usage. (#6750)

* factorize benchmark!

* fix types

* fix types
This commit is contained in:
Guillaume Thiolliere
2020-07-29 14:33:54 +02:00
committed by GitHub
parent 6e6568167a
commit 1eeb4b0e3f
2 changed files with 97 additions and 419 deletions
+4 -13
View File
@@ -134,19 +134,10 @@ pub trait Benchmarking<T> {
}
/// The required setup for creating a benchmark.
pub trait BenchmarkingSetup<T> {
/// Return the components and their ranges which should be tested in this benchmark.
fn components(&self) -> Vec<(BenchmarkParameter, u32, u32)>;
/// Set up the storage, and prepare a closure to run the benchmark.
fn instance(&self, components: &[(BenchmarkParameter, u32)]) -> Result<Box<dyn FnOnce() -> Result<(), &'static str>>, &'static str>;
/// Set up the storage, and prepare a closure to test and verify the benchmark
fn verify(&self, components: &[(BenchmarkParameter, u32)]) -> Result<Box<dyn FnOnce() -> Result<(), &'static str>>, &'static str>;
}
/// The required setup for creating a benchmark.
pub trait BenchmarkingSetupInstance<T, I> {
///
/// Instance generic parameter is optional and can be used in order to capture unused generics for
/// instantiable pallets.
pub trait BenchmarkingSetup<T, I = ()> {
/// Return the components and their ranges which should be tested in this benchmark.
fn components(&self) -> Vec<(BenchmarkParameter, u32, u32)>;