(
queries: Option<String>,
json: bool,
path: Option<String>,
max_nodes: usize,
)
| 1158 | } |
| 1159 | |
| 1160 | pub(crate) async fn handle_bench( |
| 1161 | queries: Option<String>, |
| 1162 | json: bool, |
| 1163 | path: Option<String>, |
| 1164 | max_nodes: usize, |
| 1165 | ) -> tracedecay::errors::Result<()> { |
| 1166 | let project_path = tracedecay::config::resolve_path(path); |
| 1167 | let cg = crate::serve::ensure_initialized(&project_path).await?; |
| 1168 | |
| 1169 | let opts = tracedecay::bench::BenchOptions { |
| 1170 | format: if json { |
| 1171 | tracedecay::bench::OutputFormat::Json |
| 1172 | } else { |
| 1173 | tracedecay::bench::OutputFormat::Markdown |
| 1174 | }, |
| 1175 | max_nodes, |
| 1176 | }; |
| 1177 | |
| 1178 | let report = match queries { |
| 1179 | Some(path) => tracedecay::bench::run_bench(&cg, std::path::Path::new(&path), opts).await?, |
| 1180 | None => { |
| 1181 | tracedecay::bench::run_bench_with_toml( |
| 1182 | &cg, |
| 1183 | tracedecay::bench::DEFAULT_QUERIES_TOML, |
| 1184 | opts, |
| 1185 | ) |
| 1186 | .await? |
| 1187 | } |
| 1188 | }; |
| 1189 | |
| 1190 | if json { |
| 1191 | println!("{}", tracedecay::bench::format_report_json(&report)); |
| 1192 | } else { |
| 1193 | print!("{}", tracedecay::bench::format_report_console(&report)); |
| 1194 | } |
| 1195 | Ok(()) |
| 1196 | } |
| 1197 | |
| 1198 | fn maybe_print_parallel_update_notice(version_handle: std::thread::JoinHandle<Option<String>>) { |
| 1199 | if let Ok(Some(latest)) = version_handle.join() { |
no test coverage detected