MCPcopy Create free account
hub / github.com/apache/datafusion / main

Function main

benchmarks/src/bin/mem_profile.rs:56–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54
55#[tokio::main]
56pub 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());

Callers

nothing calls this directly

Calls 15

read_dirFunction · 0.85
newFunction · 0.85
extensionMethod · 0.80
min_query_idMethod · 0.80
max_query_idMethod · 0.80
collectMethod · 0.80
filterMethod · 0.45
pathMethod · 0.45
mapMethod · 0.45
lenMethod · 0.45
argsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…