diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-01-05 15:28:33 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-01-05 15:28:33 +0000 |
commit | 5701859650fc77f4a5832eddb7c045caf4571017 (patch) | |
tree | e2e6421be7d0fd3bed0e5251e7a72e988ff992c8 /src/bin/obnam-benchmark.rs | |
parent | b6c4e5e0301158ac821e876aa0255168ed4043dc (diff) | |
parent | 3a635e26d57573828163cafcc5240fa8c670203d (diff) | |
download | obnam-benchmark-5701859650fc77f4a5832eddb7c045caf4571017.tar.gz |
Merge branch 'reporting' into 'main'
feat: add report generation
Closes #3
See merge request obnam/obnam-benchmark!8
Diffstat (limited to 'src/bin/obnam-benchmark.rs')
-rw-r--r-- | src/bin/obnam-benchmark.rs | 24 |
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(()) + } +} |