From ceed1b4a33a9b8d0580bd35493f34102ae59d184 Mon Sep 17 00:00:00 2001 From: Kamen Mladenov Date: Mon, 10 Feb 2025 10:52:35 +0200 Subject: feat(zkvms_host_io): Allow appending to metric_output file --- zkvms_host_io/input_macros/src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'zkvms_host_io/input_macros') diff --git a/zkvms_host_io/input_macros/src/lib.rs b/zkvms_host_io/input_macros/src/lib.rs index 8d7c2fc..e2982ca 100644 --- a/zkvms_host_io/input_macros/src/lib.rs +++ b/zkvms_host_io/input_macros/src/lib.rs @@ -114,7 +114,7 @@ pub fn benchmarkable(item: TokenStream) -> TokenStream { format!(r#" {{ use std::time::Instant; - use std::fs::File; + use std::fs::OpenOptions; use std::io::Write; let mut starts = Vec::new(); @@ -148,7 +148,12 @@ pub fn benchmarkable(item: TokenStream) -> TokenStream { output += &format!("repeats,{{}}\naverage,{{average}}\n", run_info.repeats); if let Some(file) = run_info.output_file {{ - let mut outfile = File::create(file).unwrap(); + let mut outfile = OpenOptions::new() + .write(true) + .create(true) + .append(run_info.append) + .open(file) + .unwrap(); write!(outfile, "{{}}", output); }} else {{ -- cgit v1.2.3