aios_cli/benchmark_next_app/
report.rs1use std::fs::File;
4use std::io::BufWriter;
5use std::path::Path;
6
7use anyhow::{Context, Result};
8
9use super::types::BenchmarkReport;
10
11pub const SCHEMA_VERSION: &str = "dipecs.next_app_benchmark.v2";
12
13pub fn write_report(report: &BenchmarkReport, path: &Path) -> Result<()> {
14 let file = File::create(path).with_context(|| format!("creating output {}", path.display()))?;
15 let writer = BufWriter::new(file);
16 serde_json::to_writer_pretty(writer, report)
17 .with_context(|| format!("serializing report to {}", path.display()))?;
18 Ok(())
19}