@@ -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 ) ]
@@ -562,19 +565,8 @@ struct BenchRustcOption {
562565enum Commands {
563566 /// Benchmarks the performance of programs generated by a local rustc
564567 BenchRuntimeLocal {
565- /// The path to the local rustc to measure
566- rustc : String ,
567- /// Identifier to associate benchmark results with
568- #[ clap( long) ]
569- id : Option < String > ,
570-
571- /// Exclude all benchmarks matching a prefix in this comma-separated list
572- #[ clap( long) ]
573- exclude : Option < String > ,
574-
575- /// Include only benchmarks matching a prefix in this comma-separated list
576- #[ clap( long) ]
577- include : Option < String > ,
568+ #[ clap( flatten) ]
569+ local : LocalOptions ,
578570
579571 /// How many iterations of each benchmark should be executed.
580572 #[ clap( long, default_value = "5" ) ]
@@ -585,6 +577,9 @@ enum Commands {
585577 #[ clap( flatten) ]
586578 local : LocalOptions ,
587579
580+ #[ clap( flatten) ]
581+ opts : CompileTimeOptions ,
582+
588583 #[ clap( flatten) ]
589584 db : DbOption ,
590585
@@ -632,6 +627,9 @@ enum Commands {
632627 #[ clap( flatten) ]
633628 local : LocalOptions ,
634629
630+ #[ clap( flatten) ]
631+ opts : CompileTimeOptions ,
632+
635633 /// Output directory
636634 #[ clap( long = "out-dir" , default_value = "results/" ) ]
637635 out_dir : PathBuf ,
@@ -705,38 +703,33 @@ fn main_result() -> anyhow::Result<i32> {
705703 let target_triple = format ! ( "{}-unknown-linux-gnu" , std:: env:: consts:: ARCH ) ;
706704
707705 match args. command {
708- Commands :: BenchRuntimeLocal {
709- rustc,
710- id,
711- exclude,
712- include,
713- iterations,
714- } => {
706+ Commands :: BenchRuntimeLocal { local, iterations } => {
715707 bench_runtime (
716- & rustc,
717- id. as_deref ( ) ,
718- BenchmarkFilter :: new ( exclude, include) ,
708+ & local . rustc ,
709+ local . id . as_deref ( ) ,
710+ BenchmarkFilter :: new ( local . exclude , local . include ) ,
719711 runtime_benchmark_dir,
720712 iterations,
721713 ) ?;
722714 Ok ( 0 )
723715 }
724716 Commands :: BenchLocal {
725717 local,
718+ opts,
726719 db,
727720 bench_rustc,
728721 iterations,
729722 self_profile,
730723 } => {
731- let profiles = & local . profiles . 0 ;
732- let scenarios = & local . scenarios . 0 ;
724+ let profiles = & opts . profiles . 0 ;
725+ let scenarios = & opts . scenarios . 0 ;
733726
734727 let pool = database:: Pool :: open ( & db. db ) ;
735728
736729 let toolchain = get_local_toolchain (
737730 & profiles,
738731 & local. rustc ,
739- local . rustdoc . as_deref ( ) ,
732+ opts . rustdoc . as_deref ( ) ,
740733 local. cargo . as_deref ( ) ,
741734 local. id . as_deref ( ) ,
742735 "" ,
@@ -852,6 +845,7 @@ fn main_result() -> anyhow::Result<i32> {
852845 Commands :: ProfileLocal {
853846 profiler,
854847 local,
848+ opts,
855849 out_dir,
856850 rustc2,
857851 jobs,
@@ -864,8 +858,8 @@ fn main_result() -> anyhow::Result<i32> {
864858 ) ;
865859 }
866860
867- let profiles = & local . profiles . 0 ;
868- let scenarios = & local . scenarios . 0 ;
861+ let profiles = & opts . profiles . 0 ;
862+ let scenarios = & opts . scenarios . 0 ;
869863
870864 let mut benchmarks = get_compile_benchmarks (
871865 & compile_benchmark_dir,
@@ -887,7 +881,7 @@ fn main_result() -> anyhow::Result<i32> {
887881 let toolchain = get_local_toolchain (
888882 & profiles,
889883 & rustc,
890- local . rustdoc . as_deref ( ) ,
884+ opts . rustdoc . as_deref ( ) ,
891885 local. cargo . as_deref ( ) ,
892886 local. id . as_deref ( ) ,
893887 suffix,
0 commit comments