Skip to content

Commit

Permalink
Show storage info in the raw benchmark output. (paritytech#9588)
Browse files Browse the repository at this point in the history
  • Loading branch information
kianenigma authored Aug 20, 2021
1 parent 7e44628 commit bd2e5f3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
16 changes: 16 additions & 0 deletions utils/frame/benchmarking-cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,20 @@ impl BenchmarkCmd {
println!();
}

if !self.no_storage_info {
let mut comments: Vec<String> = Default::default();
crate::writer::add_storage_comments(
&mut comments,
&batch.db_results,
&storage_info,
);
println!("Raw Storage Info\n========");
for comment in comments {
println!("{}", comment);
}
println!("");
}

// Conduct analysis.
if !self.no_median_slopes {
println!("Median Slopes Analysis\n========");
Expand All @@ -425,6 +439,7 @@ impl BenchmarkCmd {
{
println!("Writes = {:?}", analysis);
}
println!("");
}
if !self.no_min_squares {
println!("Min Squares Analysis\n========");
Expand All @@ -443,6 +458,7 @@ impl BenchmarkCmd {
{
println!("Writes = {:?}", analysis);
}
println!("");
}
}

Expand Down
7 changes: 7 additions & 0 deletions utils/frame/benchmarking-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,11 @@ pub struct BenchmarkCmd {
/// When nothing is provided, we list all benchmarks.
#[structopt(long)]
pub list: bool,

/// If enabled, the storage info is not displayed in the output next to the analysis.
///
/// This is independent of the storage info appearing in the *output file*. Use a Handlebar
/// template for that purpose.
#[structopt(long)]
pub no_storage_info: bool,
}
2 changes: 1 addition & 1 deletion utils/frame/benchmarking-cli/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ pub fn write_results(
// This function looks at the keys touched during the benchmark, and the storage info we collected
// from the pallets, and creates comments with information about the storage keys touched during
// each benchmark.
fn add_storage_comments(
pub(crate) fn add_storage_comments(
comments: &mut Vec<String>,
results: &[BenchmarkResult],
storage_info: &[StorageInfo],
Expand Down

0 comments on commit bd2e5f3

Please sign in to comment.