Skip to content

Commit fde6f42

Browse files
authored
Use perfetto tracing (#4250)
This backend generates actual Perfetto protobufs, and so we get events showing up on the correct threads!! See <img width="1245" height="1044" alt="Screenshot 2025-08-15 at 10 33 14" src="https://github.com/user-attachments/assets/ad9cfcd6-5ca5-4db7-9265-a44c5fb8e978" /> Vs the old chrome: <img width="1486" height="1278" alt="Screenshot 2025-08-15 at 10 33 20" src="https://github.com/user-attachments/assets/48e5545b-eb86-42ed-8a9d-a39f9d7ae845" /> --------- Signed-off-by: Nicholas Gates <[email protected]>
1 parent c95be55 commit fde6f42

File tree

21 files changed

+125
-173
lines changed

21 files changed

+125
-173
lines changed

Cargo.lock

Lines changed: 59 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ tokio-stream = "0.1.17"
177177
tpchgen = { git = "https://github.com/clflushopt/tpchgen-rs.git", rev = "d849ff430cd52250f6891ed4d5e3adad77bb2698" }
178178
tpchgen-arrow = { git = "https://github.com/clflushopt/tpchgen-rs.git", rev = "d849ff430cd52250f6891ed4d5e3adad77bb2698" }
179179
tracing = { version = "0.1.41" }
180-
tracing-chrome = "0.7.2"
180+
tracing-perfetto = "0.1.5"
181181
tracing-subscriber = "0.3.19"
182182
url = "2.5.4"
183183
uuid = { version = "1.17", features = ["js"] }

bench-vortex/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ tokio-stream = { workspace = true }
6363
tpchgen = { workspace = true }
6464
tpchgen-arrow = { workspace = true }
6565
tracing = { workspace = true }
66-
tracing-chrome = { workspace = true }
66+
tracing-perfetto = { workspace = true }
6767
tracing-subscriber = { workspace = true, features = [
6868
"env-filter",
6969
"tracing-log",
@@ -79,6 +79,3 @@ vortex = { workspace = true, features = [
7979
vortex-datafusion = { workspace = true }
8080
vortex-duckdb = { workspace = true }
8181
xshell = { workspace = true }
82-
83-
[features]
84-
tracing = ["vortex-datafusion/tracing"]

bench-vortex/src/benchmark_driver.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ use crate::engines::{EngineCtx, benchmark_datafusion_query};
1717
use crate::measurements::{MemoryMeasurement, QueryMeasurement};
1818
use crate::memory::BenchmarkMemoryTracker;
1919
use crate::metrics::{MetricsSetExt, export_plan_spans};
20-
use crate::query_bench::{
21-
filter_queries, print_memory_usage, print_results, setup_logging_and_tracing,
22-
};
20+
use crate::query_bench::{filter_queries, print_memory_usage, print_results};
2321
use crate::utils::{new_tokio_runtime, url_scheme_to_storage};
2422
use crate::{Engine, Format, Target, df, vortex_panic};
2523

@@ -28,7 +26,6 @@ pub struct DriverConfig {
2826
pub targets: Vec<Target>,
2927
pub iterations: usize,
3028
pub threads: Option<usize>,
31-
pub verbose: bool,
3229
pub display_format: DisplayFormat,
3330
pub disable_datafusion_cache: bool,
3431
pub delete_duckdb_database: bool,
@@ -44,11 +41,6 @@ pub struct DriverConfig {
4441

4542
/// Run a benchmark using the provided implementation and configuration
4643
pub fn run_benchmark<B: Benchmark>(benchmark: B, config: DriverConfig) -> Result<()> {
47-
let _trace_guard = setup_logging_and_tracing(
48-
config.verbose,
49-
&format!("{}.trace.json", benchmark.dataset_name()),
50-
)?;
51-
5244
// Generate data for each target (idempotent)
5345
for target in &config.targets {
5446
benchmark.generate_data(target)?;

bench-vortex/src/bin/compress.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use bench_vortex::display::{DisplayFormat, print_measurements_json, render_table
1414
use bench_vortex::public_bi::PBI_DATASETS;
1515
use bench_vortex::public_bi::PBIDataset::{Arade, Bimbo, CMSprovider, Euro2016, Food, HashTags};
1616
use bench_vortex::utils::new_tokio_runtime;
17-
use bench_vortex::{Engine, Format, Target, default_env_filter, setup_logger};
17+
use bench_vortex::{Engine, Format, Target, setup_logging_and_tracing};
1818
use clap::Parser;
1919
use indicatif::ProgressBar;
2020
use itertools::Itertools;
@@ -40,13 +40,14 @@ struct Args {
4040
display_format: DisplayFormat,
4141
#[arg(short)]
4242
output_path: Option<PathBuf>,
43+
#[arg(long)]
44+
tracing: bool,
4345
}
4446

4547
fn main() -> anyhow::Result<()> {
4648
let args = Args::parse();
4749

48-
let filter = default_env_filter(args.verbose);
49-
setup_logger(filter);
50+
setup_logging_and_tracing(args.verbose, args.tracing)?;
5051

5152
let runtime = new_tokio_runtime(args.threads);
5253

bench-vortex/src/bin/public_bi.rs

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use bench_vortex::metrics::MetricsSetExt;
1212
use bench_vortex::public_bi::{FileType, PBI_DATASETS, PBIDataset};
1313
use bench_vortex::utils::constants::STORAGE_NVME;
1414
use bench_vortex::utils::new_tokio_runtime;
15-
use bench_vortex::{BenchmarkDataset, Format, Target, default_env_filter, df};
15+
use bench_vortex::{BenchmarkDataset, Format, Target, df, setup_logging_and_tracing};
1616
use clap::{Parser, value_parser};
1717
use indicatif::ProgressBar;
1818
use itertools::Itertools;
@@ -51,43 +51,14 @@ struct Args {
5151
queries: Option<Vec<usize>>,
5252
#[arg(short)]
5353
output_path: Option<PathBuf>,
54+
#[arg(long)]
55+
tracing: bool,
5456
}
5557

5658
fn main() -> anyhow::Result<()> {
5759
let args = Args::parse();
5860

59-
// Capture `RUST_LOG` configuration
60-
let filter = default_env_filter(args.verbose);
61-
62-
#[cfg(not(feature = "tracing"))]
63-
bench_vortex::setup_logger(filter);
64-
65-
// We need the guard to live to the end of the function, so can't create it in the if-block
66-
#[cfg(feature = "tracing")]
67-
let _trace_guard = {
68-
use std::io::IsTerminal;
69-
70-
use tracing_subscriber::prelude::*;
71-
72-
let (layer, _guard) = tracing_chrome::ChromeLayerBuilder::new()
73-
.include_args(true)
74-
.trace_style(tracing_chrome::TraceStyle::Async)
75-
.file("public_bi.trace.json")
76-
.build();
77-
78-
let fmt_layer = tracing_subscriber::fmt::layer()
79-
.with_writer(std::io::stderr)
80-
.with_level(true)
81-
.with_line_number(true)
82-
.with_ansi(std::io::stderr().is_terminal());
83-
84-
tracing_subscriber::registry()
85-
.with(filter)
86-
.with(layer)
87-
.with(fmt_layer)
88-
.init();
89-
_guard
90-
};
61+
setup_logging_and_tracing(args.verbose, args.tracing)?;
9162

9263
let runtime = new_tokio_runtime(args.threads);
9364

bench-vortex/src/bin/query_bench.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
use std::path::PathBuf;
55

6-
use bench_vortex::Target;
76
use bench_vortex::benchmark_driver::{DriverConfig, run_benchmark};
87
use bench_vortex::clickbench::{ClickBenchBenchmark, Flavor};
98
use bench_vortex::display::DisplayFormat;
109
use bench_vortex::tpcds::TpcDsBenchmark;
1110
use bench_vortex::tpch::tpch_benchmark::TpcHBenchmark;
11+
use bench_vortex::{Target, setup_logging_and_tracing};
1212
use clap::{Parser, Subcommand, value_parser};
1313

1414
#[derive(Parser, Debug)]
@@ -45,6 +45,9 @@ struct CommonArgs {
4545
#[arg(short, long)]
4646
verbose: bool,
4747

48+
#[arg(long)]
49+
tracing: bool,
50+
4851
#[arg(long)]
4952
export_spans: bool,
5053

@@ -170,7 +173,6 @@ fn validate_scale_factor(val: &str) -> Result<String, String> {
170173

171174
fn main() -> anyhow::Result<()> {
172175
let args = Args::parse();
173-
174176
match args.command {
175177
Commands::ClickBench(clickbench_args) => run_clickbench(clickbench_args),
176178
Commands::TpcH(tpch_args) => run_tpch(tpch_args),
@@ -179,6 +181,8 @@ fn main() -> anyhow::Result<()> {
179181
}
180182

181183
fn run_clickbench(args: ClickBenchArgs) -> anyhow::Result<()> {
184+
setup_logging_and_tracing(args.common.verbose, args.common.tracing)?;
185+
182186
// Create benchmark instance
183187
let benchmark = ClickBenchBenchmark::new(
184188
args.flavor,
@@ -191,7 +195,6 @@ fn run_clickbench(args: ClickBenchArgs) -> anyhow::Result<()> {
191195
targets: args.targets,
192196
iterations: args.common.iterations,
193197
threads: args.common.threads,
194-
verbose: args.common.verbose,
195198
display_format: args.common.display_format,
196199
disable_datafusion_cache: args.common.disable_datafusion_cache,
197200
delete_duckdb_database: args.common.delete_duckdb_database,
@@ -211,6 +214,8 @@ fn run_clickbench(args: ClickBenchArgs) -> anyhow::Result<()> {
211214
}
212215

213216
fn run_tpch(args: TpcHArgs) -> anyhow::Result<()> {
217+
setup_logging_and_tracing(args.common.verbose, args.common.tracing)?;
218+
214219
// Create benchmark instance
215220
let benchmark = TpcHBenchmark::new(args.scale_factor, args.common.use_remote_data_dir)?;
216221

@@ -219,7 +224,6 @@ fn run_tpch(args: TpcHArgs) -> anyhow::Result<()> {
219224
targets: args.targets,
220225
iterations: args.common.iterations,
221226
threads: args.common.threads,
222-
verbose: args.common.verbose,
223227
display_format: args.common.display_format,
224228
disable_datafusion_cache: args.common.disable_datafusion_cache,
225229
delete_duckdb_database: args.common.delete_duckdb_database,
@@ -240,6 +244,8 @@ fn run_tpch(args: TpcHArgs) -> anyhow::Result<()> {
240244
}
241245

242246
fn run_tpcds(args: TpcDSArgs) -> anyhow::Result<()> {
247+
setup_logging_and_tracing(args.common.verbose, args.common.tracing)?;
248+
243249
// Create benchmark instance
244250
let benchmark = TpcDsBenchmark::new(args.scale_factor, args.common.use_remote_data_dir)?;
245251

@@ -248,7 +254,6 @@ fn run_tpcds(args: TpcDSArgs) -> anyhow::Result<()> {
248254
targets: args.targets,
249255
iterations: args.common.iterations,
250256
threads: args.common.threads,
251-
verbose: args.common.verbose,
252257
display_format: args.common.display_format,
253258
disable_datafusion_cache: args.common.disable_datafusion_cache,
254259
delete_duckdb_database: args.common.delete_duckdb_database,

bench-vortex/src/bin/random_access.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use bench_vortex::measurements::TimingMeasurement;
1212
use bench_vortex::random_access::take::{take_parquet, take_vortex_tokio};
1313
use bench_vortex::utils::constants::STORAGE_NVME;
1414
use bench_vortex::utils::new_tokio_runtime;
15-
use bench_vortex::{Engine, Format, Target, default_env_filter, setup_logger};
15+
use bench_vortex::{Engine, Format, Target, setup_logging_and_tracing};
1616
use clap::Parser;
1717
use indicatif::ProgressBar;
1818
use itertools::Itertools;
@@ -34,6 +34,8 @@ struct Args {
3434
formats: Vec<Format>,
3535
#[arg(short, long)]
3636
verbose: bool,
37+
#[arg(long)]
38+
tracing: bool,
3739
#[arg(short, long, default_value_t, value_enum)]
3840
display_format: DisplayFormat,
3941
#[arg(short)]
@@ -42,6 +44,9 @@ struct Args {
4244

4345
fn main() -> anyhow::Result<()> {
4446
let args = Args::parse();
47+
48+
setup_logging_and_tracing(args.verbose, args.tracing)?;
49+
4550
let runtime = new_tokio_runtime(args.threads);
4651

4752
let indices = buffer![10u64, 11, 12, 13, 100_000, 3_000_000];
@@ -50,7 +55,6 @@ fn main() -> anyhow::Result<()> {
5055
args.iterations,
5156
args.formats,
5257
args.display_format,
53-
args.verbose,
5458
indices,
5559
&args.output_path,
5660
)
@@ -61,14 +65,9 @@ fn random_access(
6165
iterations: usize,
6266
formats: Vec<Format>,
6367
display_format: DisplayFormat,
64-
verbose: bool,
6568
indices: Buffer<u64>,
6669
output_path: &Option<PathBuf>,
6770
) -> anyhow::Result<()> {
68-
// Capture `RUST_LOG` configuration
69-
let filter = default_env_filter(verbose);
70-
setup_logger(filter);
71-
7271
let targets = formats
7372
.iter()
7473
.map(|f| Target::new(Engine::Vortex, *f))

0 commit comments

Comments
 (0)