Skip to content

Commit e764a7a

Browse files
authored
display metrics for clickbench (#2682)
1 parent 8532c47 commit e764a7a

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

bench-vortex/src/bin/clickbench.rs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::time::{Duration, Instant};
44
use bench_vortex::clickbench::{self, Flavor, HITS_SCHEMA, clickbench_queries};
55
use bench_vortex::display::{DisplayFormat, RatioMode, print_measurements_json, render_table};
66
use bench_vortex::measurements::QueryMeasurement;
7-
use bench_vortex::metrics::export_plan_spans;
7+
use bench_vortex::metrics::{MetricsSetExt, export_plan_spans};
88
use bench_vortex::{
99
Format, IdempotentPath as _, default_env_filter, execute_physical_plan,
1010
feature_flagged_allocator, get_session_with_cache, physical_plan,
@@ -18,6 +18,7 @@ use tokio::runtime::Builder;
1818
use tracing::info_span;
1919
use tracing_futures::Instrument;
2020
use vortex::error::vortex_panic;
21+
use vortex_datafusion::persistent::metrics::VortexMetricsFinder;
2122

2223
feature_flagged_allocator!();
2324

@@ -112,6 +113,7 @@ fn main() -> anyhow::Result<()> {
112113

113114
let mut all_measurements = Vec::default();
114115

116+
let mut metrics = Vec::new();
115117
for format in &args.formats {
116118
let session_context = get_session_with_cache(args.emulate_object_store);
117119
let context = session_context.clone();
@@ -177,8 +179,8 @@ fn main() -> anyhow::Result<()> {
177179
}
178180
progress_bar.inc(1);
179181

182+
let plan = last_plan.expect("must have at least one iteration");
180183
if args.emit_plan {
181-
let plan = last_plan.expect("must have at least one iteration");
182184
fs::write(
183185
format!("clickbench_{format}_q{query_idx:02}.plan",),
184186
format!("{:#?}", plan),
@@ -197,7 +199,11 @@ fn main() -> anyhow::Result<()> {
197199
)
198200
.expect("Unable to write file");
199201
}
200-
202+
metrics.push((
203+
query_idx,
204+
format,
205+
VortexMetricsFinder::find_all(plan.as_ref()),
206+
));
201207
all_measurements.push(QueryMeasurement {
202208
query_idx,
203209
storage: "nvme".to_string(),
@@ -216,6 +222,21 @@ fn main() -> anyhow::Result<()> {
216222

217223
match args.display_format {
218224
DisplayFormat::Table => {
225+
for (query, format, metric_sets) in metrics {
226+
println!();
227+
println!("metrics for query={query}, {format}:");
228+
for (idx, metric_set) in metric_sets.into_iter().enumerate() {
229+
println!("scan[{idx}]:");
230+
for m in metric_set
231+
.timestamps_removed()
232+
.aggregate()
233+
.sorted_for_display()
234+
.iter()
235+
{
236+
println!("{}", m);
237+
}
238+
}
239+
}
219240
render_table(all_measurements, &args.formats, RatioMode::Time).unwrap()
220241
}
221242
DisplayFormat::GhJson => print_measurements_json(all_measurements).unwrap(),

0 commit comments

Comments
 (0)