Add options to overwrite range bounds in benchmark command. (#5072)

* Add --mins --maxs to benchmark command.

* Apply review suggestions.
This commit is contained in:
Marcio Diaz
2020-02-28 15:40:42 +01:00
committed by GitHub
parent d39605d9cd
commit 347b5d641c
4 changed files with 81 additions and 16 deletions
@@ -39,6 +39,14 @@ pub struct BenchmarkCmd {
#[structopt(short, long, use_delimiter = true)]
pub steps: Vec<u32>,
/// Indicates lowest values for each of the component ranges.
#[structopt(long, use_delimiter = true)]
pub lowest_range_values: Vec<u32>,
/// Indicates highest values for each of the component ranges.
#[structopt(long, use_delimiter = true)]
pub highest_range_values: Vec<u32>,
/// Select how many repetitions of this benchmark should run.
#[structopt(short, long, default_value = "1")]
pub repeat: u32,
@@ -104,7 +112,14 @@ impl BenchmarkCmd {
&mut changes,
&executor,
"Benchmark_dispatch_benchmark",
&(&self.pallet, &self.extrinsic, self.steps.clone(), self.repeat).encode(),
&(
&self.pallet,
&self.extrinsic,
self.lowest_range_values.clone(),
self.highest_range_values.clone(),
self.steps.clone(),
self.repeat,
).encode(),
Default::default(),
)
.execute(strategy.into())
@@ -117,9 +132,11 @@ impl BenchmarkCmd {
Ok(results) => {
// Print benchmark metadata
println!(
"Pallet: {:?}, Extrinsic: {:?}, Steps: {:?}, Repeat: {:?}",
"Pallet: {:?}, Extrinsic: {:?}, Lowest values: {:?}, Highest values: {:?}, Steps: {:?}, Repeat: {:?}",
self.pallet,
self.extrinsic,
self.lowest_range_values,
self.highest_range_values,
self.steps,
self.repeat,
);