@@ -496,16 +496,6 @@ struct LocalOptions {
496
496
#[ clap( long) ]
497
497
id : Option < String > ,
498
498
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
-
509
499
/// The path to the local Cargo to use
510
500
#[ clap( long, parse( from_os_str) ) ]
511
501
cargo : Option < PathBuf > ,
@@ -517,10 +507,19 @@ struct LocalOptions {
517
507
/// Include only benchmarks matching a prefix in this comma-separated list
518
508
#[ clap( long) ]
519
509
include : Option < String > ,
510
+ }
520
511
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 ,
524
523
525
524
/// Measure the scenarios in this comma-separated list
526
525
#[ clap(
@@ -530,6 +529,10 @@ struct LocalOptions {
530
529
default_value = "All"
531
530
) ]
532
531
scenarios : ScenarioArg ,
532
+
533
+ /// The path to the local rustdoc to measure
534
+ #[ clap( long, parse( from_os_str) ) ]
535
+ rustdoc : Option < PathBuf > ,
533
536
}
534
537
535
538
#[ derive( Debug , clap:: Args ) ]
@@ -562,19 +565,8 @@ struct BenchRustcOption {
562
565
enum Commands {
563
566
/// Benchmarks the performance of programs generated by a local rustc
564
567
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 ,
578
570
579
571
/// How many iterations of each benchmark should be executed.
580
572
#[ clap( long, default_value = "5" ) ]
@@ -585,6 +577,9 @@ enum Commands {
585
577
#[ clap( flatten) ]
586
578
local : LocalOptions ,
587
579
580
+ #[ clap( flatten) ]
581
+ opts : CompileTimeOptions ,
582
+
588
583
#[ clap( flatten) ]
589
584
db : DbOption ,
590
585
@@ -632,6 +627,9 @@ enum Commands {
632
627
#[ clap( flatten) ]
633
628
local : LocalOptions ,
634
629
630
+ #[ clap( flatten) ]
631
+ opts : CompileTimeOptions ,
632
+
635
633
/// Output directory
636
634
#[ clap( long = "out-dir" , default_value = "results/" ) ]
637
635
out_dir : PathBuf ,
@@ -705,38 +703,33 @@ fn main_result() -> anyhow::Result<i32> {
705
703
let target_triple = format ! ( "{}-unknown-linux-gnu" , std:: env:: consts:: ARCH ) ;
706
704
707
705
match args. command {
708
- Commands :: BenchRuntimeLocal {
709
- rustc,
710
- id,
711
- exclude,
712
- include,
713
- iterations,
714
- } => {
706
+ Commands :: BenchRuntimeLocal { local, iterations } => {
715
707
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 ) ,
719
711
runtime_benchmark_dir,
720
712
iterations,
721
713
) ?;
722
714
Ok ( 0 )
723
715
}
724
716
Commands :: BenchLocal {
725
717
local,
718
+ opts,
726
719
db,
727
720
bench_rustc,
728
721
iterations,
729
722
self_profile,
730
723
} => {
731
- let profiles = & local . profiles . 0 ;
732
- let scenarios = & local . scenarios . 0 ;
724
+ let profiles = & opts . profiles . 0 ;
725
+ let scenarios = & opts . scenarios . 0 ;
733
726
734
727
let pool = database:: Pool :: open ( & db. db ) ;
735
728
736
729
let toolchain = get_local_toolchain (
737
730
& profiles,
738
731
& local. rustc ,
739
- local . rustdoc . as_deref ( ) ,
732
+ opts . rustdoc . as_deref ( ) ,
740
733
local. cargo . as_deref ( ) ,
741
734
local. id . as_deref ( ) ,
742
735
"" ,
@@ -852,6 +845,7 @@ fn main_result() -> anyhow::Result<i32> {
852
845
Commands :: ProfileLocal {
853
846
profiler,
854
847
local,
848
+ opts,
855
849
out_dir,
856
850
rustc2,
857
851
jobs,
@@ -864,8 +858,8 @@ fn main_result() -> anyhow::Result<i32> {
864
858
) ;
865
859
}
866
860
867
- let profiles = & local . profiles . 0 ;
868
- let scenarios = & local . scenarios . 0 ;
861
+ let profiles = & opts . profiles . 0 ;
862
+ let scenarios = & opts . scenarios . 0 ;
869
863
870
864
let mut benchmarks = get_compile_benchmarks (
871
865
& compile_benchmark_dir,
@@ -887,7 +881,7 @@ fn main_result() -> anyhow::Result<i32> {
887
881
let toolchain = get_local_toolchain (
888
882
& profiles,
889
883
& rustc,
890
- local . rustdoc . as_deref ( ) ,
884
+ opts . rustdoc . as_deref ( ) ,
891
885
local. cargo . as_deref ( ) ,
892
886
local. id . as_deref ( ) ,
893
887
suffix,
0 commit comments