()
| 54 | |
| 55 | #[tokio::main] |
| 56 | pub async fn main() -> Result<()> { |
| 57 | // 1. Parse args and check which benchmarks should be run |
| 58 | let cli = Cli::parse(); |
| 59 | let profile = cli.bench_profile; |
| 60 | let query_range = match cli.command { |
| 61 | Options::Clickbench(opt) => { |
| 62 | let entries = std::fs::read_dir(&opt.queries_path)? |
| 63 | .filter_map(Result::ok) |
| 64 | .filter(|e| { |
| 65 | let path = e.path(); |
| 66 | path.extension().map(|ext| ext == "sql").unwrap_or(false) |
| 67 | }) |
| 68 | .collect::<Vec<_>>(); |
| 69 | |
| 70 | let max_query_id = entries.len().saturating_sub(1); |
| 71 | match opt.query { |
| 72 | Some(query_id) => query_id..=query_id, |
| 73 | None => 0..=max_query_id, |
| 74 | } |
| 75 | } |
| 76 | Options::H2o(opt) => { |
| 77 | let queries = AllQueries::try_new(&opt.queries_path)?; |
| 78 | match opt.query { |
| 79 | Some(query_id) => query_id..=query_id, |
| 80 | None => queries.min_query_id()..=queries.max_query_id(), |
| 81 | } |
| 82 | } |
| 83 | Options::Imdb(opt) => match opt.query { |
| 84 | Some(query_id) => query_id..=query_id, |
| 85 | None => imdb::IMDB_QUERY_START_ID..=imdb::IMDB_QUERY_END_ID, |
| 86 | }, |
| 87 | Options::SortTpch(opt) => match opt.query { |
| 88 | Some(query_id) => query_id..=query_id, |
| 89 | None => { |
| 90 | sort_tpch::SORT_TPCH_QUERY_START_ID..=sort_tpch::SORT_TPCH_QUERY_END_ID |
| 91 | } |
| 92 | }, |
| 93 | Options::Tpch(opt) => match opt.query { |
| 94 | Some(query_id) => query_id..=query_id, |
| 95 | None => tpch::TPCH_QUERY_START_ID..=tpch::TPCH_QUERY_END_ID, |
| 96 | }, |
| 97 | }; |
| 98 | |
| 99 | // 2. Prebuild dfbench binary so that memory does not blow up due to build process |
| 100 | println!("Pre-building benchmark binary..."); |
| 101 | let status = Command::new("cargo") |
| 102 | .args([ |
| 103 | "build", |
| 104 | "--profile", |
| 105 | &profile, |
| 106 | "--features", |
| 107 | "mimalloc_extended", |
| 108 | "--bin", |
| 109 | "dfbench", |
| 110 | ]) |
| 111 | .status() |
| 112 | .expect("Failed to build dfbench"); |
| 113 | assert!(status.success()); |
nothing calls this directly
no test coverage detected
searching dependent graphs…