More Improvements to Benchmarking CLI + Generic WeightInfo (#7168)

* Generic WeightInfo, Output File Path

* Make `WeightInfo` generic

* Add support for header file

* fix line width

* add `--spaces` flag

* Configurable trait and struct strings

* make elections phragmen generic

* Add date to generated file

* Apply suggestions from code review

Co-authored-by: Gavin Wood <gavin@parity.io>

* fixes

* add settings metadata to output

Co-authored-by: nikvolf <nikvolf@gmail.com>
Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
Shawn Tabrizi
2020-09-23 15:56:30 +02:00
committed by GitHub
parent 313f86ec23
commit 4e5f9fb72b
25 changed files with 583 additions and 426 deletions
@@ -60,13 +60,17 @@ pub struct BenchmarkCmd {
#[structopt(long)]
pub no_min_squares: bool,
/// Output the benchmarks to a Rust file.
/// Output the benchmarks to a Rust file at the given path.
#[structopt(long)]
pub output: bool,
pub output: Option<std::path::PathBuf>,
/// Add a header file to your outputted benchmarks
#[structopt(long)]
pub header: Option<std::path::PathBuf>,
/// Output the trait definition to a Rust file.
#[structopt(long)]
pub weight_trait: bool,
pub trait_def: bool,
/// Set the heap pages while running benchmarks.
#[structopt(long)]
@@ -80,6 +84,18 @@ pub struct BenchmarkCmd {
#[structopt(long)]
pub extra: bool,
/// Output files using spaces instead of tabs.
#[structopt(long)]
pub spaces: bool,
/// Output benchmarks file using this struct name.
#[structopt(long, default_value = "WeightInfo")]
pub r#struct: String,
/// Output benchmarks file using this trait name.
#[structopt(long, default_value = "WeightInfo")]
pub r#trait: String,
#[allow(missing_docs)]
#[structopt(flatten)]
pub shared_params: sc_cli::SharedParams,