Show storage info in the raw benchmark output. (#9588)

This commit is contained in:
Kian Paimani
2021-08-20 12:09:04 +01:00
committed by GitHub
parent 8a00437081
commit 942d1f9826
3 changed files with 24 additions and 1 deletions
@@ -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========");
@@ -425,6 +439,7 @@ impl BenchmarkCmd {
{
println!("Writes = {:?}", analysis);
}
println!("");
}
if !self.no_min_squares {
println!("Min Squares Analysis\n========");
@@ -443,6 +458,7 @@ impl BenchmarkCmd {
{
println!("Writes = {:?}", analysis);
}
println!("");
}
}
@@ -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,
}
@@ -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],