summaryrefslogtreecommitdiff
path: root/src/bin/obnam-benchmark.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/obnam-benchmark.rs')
-rw-r--r--src/bin/obnam-benchmark.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/bin/obnam-benchmark.rs b/src/bin/obnam-benchmark.rs
index 41118cb..4ac3e4d 100644
--- a/src/bin/obnam-benchmark.rs
+++ b/src/bin/obnam-benchmark.rs
@@ -1,5 +1,6 @@
use log::{debug, error, info};
use obnam_benchmark::junk::junk;
+use obnam_benchmark::report::Reporter;
use obnam_benchmark::result::SuiteMeasurements;
use obnam_benchmark::specification::Specification;
use obnam_benchmark::suite::Suite;
@@ -30,6 +31,7 @@ fn real_main() -> anyhow::Result<()> {
Command::Run(x) => x.run()?,
Command::Spec(x) => x.run()?,
Command::Steps(x) => x.run()?,
+ Command::Report(x) => x.run()?,
}
Ok(())
@@ -54,6 +56,9 @@ enum Command {
/// Show the steps for running a benchmark.
Steps(Steps),
+
+ /// Report results for several benchmarks.
+ Report(Report),
}
#[derive(Debug, StructOpt)]
@@ -166,3 +171,22 @@ impl Steps {
Ok(())
}
}
+
+#[derive(Debug, StructOpt)]
+struct Report {
+ /// Names of the results file for which to produce a report.
+ #[structopt(parse(from_os_str))]
+ filenames: Vec<PathBuf>,
+}
+
+impl Report {
+ fn run(&self) -> anyhow::Result<()> {
+ info!("Reporting results");
+ let mut report = Reporter::default();
+ for filename in self.filenames.iter() {
+ report.push(SuiteMeasurements::from_file(filename)?);
+ }
+ report.write(&mut std::io::stdout())?;
+ Ok(())
+ }
+}