Skip to content

Commit d6d292d

Browse files
committed
Extract compile time options out of LocalOptions in collector
1 parent baa4ce2 commit d6d292d

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

collector/src/bin/collector.rs

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -496,16 +496,6 @@ struct LocalOptions {
496496
#[clap(long)]
497497
id: Option<String>,
498498

499-
/// Measure the build profiles in this comma-separated list
500-
#[clap(
501-
long = "profiles",
502-
alias = "builds", // the old name, for backward compatibility
503-
value_parser = ProfileArgParser,
504-
// Don't run rustdoc by default
505-
default_value = "Check,Debug,Opt",
506-
)]
507-
profiles: ProfileArg,
508-
509499
/// The path to the local Cargo to use
510500
#[clap(long, parse(from_os_str))]
511501
cargo: Option<PathBuf>,
@@ -517,10 +507,19 @@ struct LocalOptions {
517507
/// Include only benchmarks matching a prefix in this comma-separated list
518508
#[clap(long)]
519509
include: Option<String>,
510+
}
520511

521-
/// The path to the local rustdoc to measure
522-
#[clap(long, parse(from_os_str))]
523-
rustdoc: Option<PathBuf>,
512+
#[derive(Debug, clap::Args)]
513+
struct CompileTimeOptions {
514+
/// Measure the build profiles in this comma-separated list
515+
#[clap(
516+
long = "profiles",
517+
alias = "builds", // the old name, for backward compatibility
518+
value_parser = ProfileArgParser,
519+
// Don't run rustdoc by default
520+
default_value = "Check,Debug,Opt",
521+
)]
522+
profiles: ProfileArg,
524523

525524
/// Measure the scenarios in this comma-separated list
526525
#[clap(
@@ -530,6 +529,10 @@ struct LocalOptions {
530529
default_value = "All"
531530
)]
532531
scenarios: ScenarioArg,
532+
533+
/// The path to the local rustdoc to measure
534+
#[clap(long, parse(from_os_str))]
535+
rustdoc: Option<PathBuf>,
533536
}
534537

535538
#[derive(Debug, clap::Args)]
@@ -585,6 +588,9 @@ enum Commands {
585588
#[clap(flatten)]
586589
local: LocalOptions,
587590

591+
#[clap(flatten)]
592+
opts: CompileTimeOptions,
593+
588594
#[clap(flatten)]
589595
db: DbOption,
590596

@@ -632,6 +638,9 @@ enum Commands {
632638
#[clap(flatten)]
633639
local: LocalOptions,
634640

641+
#[clap(flatten)]
642+
opts: CompileTimeOptions,
643+
635644
/// Output directory
636645
#[clap(long = "out-dir", default_value = "results/")]
637646
out_dir: PathBuf,
@@ -723,20 +732,21 @@ fn main_result() -> anyhow::Result<i32> {
723732
}
724733
Commands::BenchLocal {
725734
local,
735+
opts,
726736
db,
727737
bench_rustc,
728738
iterations,
729739
self_profile,
730740
} => {
731-
let profiles = &local.profiles.0;
732-
let scenarios = &local.scenarios.0;
741+
let profiles = &opts.profiles.0;
742+
let scenarios = &opts.scenarios.0;
733743

734744
let pool = database::Pool::open(&db.db);
735745

736746
let toolchain = get_local_toolchain(
737747
&profiles,
738748
&local.rustc,
739-
local.rustdoc.as_deref(),
749+
opts.rustdoc.as_deref(),
740750
local.cargo.as_deref(),
741751
local.id.as_deref(),
742752
"",
@@ -852,6 +862,7 @@ fn main_result() -> anyhow::Result<i32> {
852862
Commands::ProfileLocal {
853863
profiler,
854864
local,
865+
opts,
855866
out_dir,
856867
rustc2,
857868
jobs,
@@ -864,8 +875,8 @@ fn main_result() -> anyhow::Result<i32> {
864875
);
865876
}
866877

867-
let profiles = &local.profiles.0;
868-
let scenarios = &local.scenarios.0;
878+
let profiles = &opts.profiles.0;
879+
let scenarios = &opts.scenarios.0;
869880

870881
let mut benchmarks = get_compile_benchmarks(
871882
&compile_benchmark_dir,
@@ -887,7 +898,7 @@ fn main_result() -> anyhow::Result<i32> {
887898
let toolchain = get_local_toolchain(
888899
&profiles,
889900
&rustc,
890-
local.rustdoc.as_deref(),
901+
opts.rustdoc.as_deref(),
891902
local.cargo.as_deref(),
892903
local.id.as_deref(),
893904
suffix,

0 commit comments

Comments
 (0)