Loads all benchmark files in the `sql_benchmarks` directory. For each file ending with `.benchmark` it creates a new `SqlBenchmark` instance.
(
args: &EnvParser,
ctx: &SessionContext,
path: &str,
)
| 262 | /// For each file ending with `.benchmark` it creates a new |
| 263 | /// `SqlBenchmark` instance. |
| 264 | async fn load_benchmarks( |
| 265 | args: &EnvParser, |
| 266 | ctx: &SessionContext, |
| 267 | path: &str, |
| 268 | ) -> Result<BTreeMap<String, Vec<SqlBenchmark>>> { |
| 269 | let mut benches = BTreeMap::new(); |
| 270 | let mut paths = Vec::new(); |
| 271 | |
| 272 | list_files(path, &mut |path: &str| { |
| 273 | if path.ends_with(".benchmark") { |
| 274 | paths.push(path.to_string()); |
| 275 | } |
| 276 | }); |
| 277 | |
| 278 | for path in paths { |
| 279 | debug!("Loading benchmark from {path}"); |
| 280 | |
| 281 | let benchmark = SqlBenchmark::new(ctx, &path, &*SQL_BENCHMARK_DIRECTORY).await?; |
| 282 | let entries = benches |
| 283 | .entry(benchmark.group().to_string()) |
| 284 | .or_insert(vec![]); |
| 285 | |
| 286 | entries.push(benchmark); |
| 287 | } |
| 288 | |
| 289 | benches = filter_benchmarks(args, benches); |
| 290 | benches.iter_mut().for_each(|(_, benchmarks)| { |
| 291 | benchmarks.sort_by(|b1, b2| b1.name().cmp(b2.name())) |
| 292 | }); |
| 293 | |
| 294 | Ok(benches) |
| 295 | } |
| 296 | |
| 297 | fn filter_benchmarks( |
| 298 | args: &EnvParser, |
no test coverage detected
searching dependent graphs…