mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Export intermediate results after each benchmark command
This commit is contained in:
1 parent
4fa16852cf
commit
d7e6fa6dfb
2 files changed
+10
-10
No files matched your search
@@ -69,7 +69,7 @@ impl ExportManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Write the given results to all Exporters contained within this manager
|
/// Write the given results to all Exporters contained within this manager
|
||||||
pub fn write_results(&self, results: Vec<BenchmarkResult>, unit: Option<Unit>) -> Result<()> {
|
pub fn write_results(&self, results: &[BenchmarkResult], unit: Option<Unit>) -> Result<()> {
|
||||||
for e in &self.exporters {
|
for e in &self.exporters {
|
||||||
let file_content = e.exporter.serialize(&results, unit)?;
|
let file_content = e.exporter.serialize(&results, unit)?;
|
||||||
write_to_file(&e.filename, &file_content)?;
|
write_to_file(&e.filename, &file_content)?;
|
||||||
|
|||||||
+9
-9
@@ -49,6 +49,15 @@ fn run(
|
|||||||
// Run the benchmarks
|
// Run the benchmarks
|
||||||
for (num, cmd) in commands.iter().enumerate() {
|
for (num, cmd) in commands.iter().enumerate() {
|
||||||
timing_results.push(run_benchmark(num, cmd, shell_spawning_time, options)?);
|
timing_results.push(run_benchmark(num, cmd, shell_spawning_time, options)?);
|
||||||
|
|
||||||
|
// Export (intermediate) results
|
||||||
|
let ans = export_manager.write_results(&timing_results, options.time_unit);
|
||||||
|
if let Err(e) = ans {
|
||||||
|
error(&format!(
|
||||||
|
"The following error occurred while exporting: {}",
|
||||||
|
e
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print relative speed comparison
|
// Print relative speed comparison
|
||||||
@@ -56,15 +65,6 @@ fn run(
|
|||||||
write_benchmark_comparison(&timing_results);
|
write_benchmark_comparison(&timing_results);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export results
|
|
||||||
let ans = export_manager.write_results(timing_results, options.time_unit);
|
|
||||||
if let Err(e) = ans {
|
|
||||||
error(&format!(
|
|
||||||
"The following error occurred while exporting: {}",
|
|
||||||
e
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user