@@ -40,6 +40,7 @@ use collector::compile::benchmark::scenario::Scenario;
40
40
use collector:: compile:: benchmark:: target:: Target ;
41
41
use collector:: compile:: benchmark:: {
42
42
compile_benchmark_dir, get_compile_benchmarks, ArtifactType , Benchmark , BenchmarkName ,
43
+ CompileBenchmarkFilter ,
43
44
} ;
44
45
use collector:: compile:: execute:: bencher:: BenchProcessor ;
45
46
use collector:: compile:: execute:: profiler:: { ProfileProcessor , Profiler } ;
@@ -337,6 +338,16 @@ struct LocalOptions {
337
338
#[ arg( long, value_delimiter = ',' ) ]
338
339
include : Vec < String > ,
339
340
341
+ /// Include only benchmarks in this comma-separated list
342
+ #[ arg(
343
+ long,
344
+ value_delimiter = ',' ,
345
+ conflicts_with( "include" ) ,
346
+ conflicts_with( "exclude" ) ,
347
+ conflicts_with( "exclude_suffix" )
348
+ ) ]
349
+ exact_match : Vec < String > ,
350
+
340
351
/// Include only benchmarks belonging to the given categories.
341
352
#[ arg( long, value_parser = EnumArgParser :: <Category >:: default ( ) , default_value = "Primary,Secondary" ) ]
342
353
category : MultiEnumValue < Category > ,
@@ -688,6 +699,25 @@ enum DownloadSubcommand {
688
699
} ,
689
700
}
690
701
702
+ impl < ' a > From < & ' a LocalOptions > for CompileBenchmarkFilter < ' a > {
703
+ fn from ( value : & ' a LocalOptions ) -> Self {
704
+ if !value. exact_match . is_empty ( ) {
705
+ Self :: Exact ( & value. exact_match )
706
+ } else if !value. include . is_empty ( )
707
+ || !value. exclude . is_empty ( )
708
+ || !value. exclude_suffix . is_empty ( )
709
+ {
710
+ Self :: Fuzzy {
711
+ include : & value. include ,
712
+ exclude : & value. exclude ,
713
+ exclude_suffix : & value. exclude_suffix ,
714
+ }
715
+ } else {
716
+ Self :: All
717
+ }
718
+ }
719
+ }
720
+
691
721
fn main_result ( ) -> anyhow:: Result < i32 > {
692
722
env_logger:: init ( ) ;
693
723
@@ -884,12 +914,7 @@ fn main_result() -> anyhow::Result<i32> {
884
914
target_triple,
885
915
) ?;
886
916
887
- let mut benchmarks = get_compile_benchmarks (
888
- & compile_benchmark_dir,
889
- & local. include ,
890
- & local. exclude ,
891
- & local. exclude_suffix ,
892
- ) ?;
917
+ let mut benchmarks = get_compile_benchmarks ( & compile_benchmark_dir, ( & local) . into ( ) ) ?;
893
918
benchmarks. retain ( |b| local. category . 0 . contains ( & b. category ( ) ) ) ;
894
919
895
920
let artifact_id = ArtifactId :: Commit ( Commit {
@@ -1006,9 +1031,11 @@ fn main_result() -> anyhow::Result<i32> {
1006
1031
1007
1032
let mut benchmarks = get_compile_benchmarks (
1008
1033
& compile_benchmark_dir,
1009
- & split_args ( include) ,
1010
- & split_args ( exclude) ,
1011
- & [ ] ,
1034
+ CompileBenchmarkFilter :: Fuzzy {
1035
+ include : & split_args ( include) ,
1036
+ exclude : & split_args ( exclude) ,
1037
+ exclude_suffix : & [ ] ,
1038
+ } ,
1012
1039
) ?;
1013
1040
benchmarks. retain ( |b| b. category ( ) . is_primary_or_secondary ( ) ) ;
1014
1041
@@ -1102,12 +1129,7 @@ fn main_result() -> anyhow::Result<i32> {
1102
1129
let scenarios = & opts. scenarios . 0 ;
1103
1130
let backends = & opts. codegen_backends . 0 ;
1104
1131
1105
- let mut benchmarks = get_compile_benchmarks (
1106
- & compile_benchmark_dir,
1107
- & local. include ,
1108
- & local. exclude ,
1109
- & local. exclude_suffix ,
1110
- ) ?;
1132
+ let mut benchmarks = get_compile_benchmarks ( & compile_benchmark_dir, ( & local) . into ( ) ) ?;
1111
1133
benchmarks. retain ( |b| local. category . 0 . contains ( & b. category ( ) ) ) ;
1112
1134
1113
1135
let mut errors = BenchmarkErrors :: new ( ) ;
@@ -1315,12 +1337,7 @@ fn binary_stats_compile(
1315
1337
Profile :: Opt => CargoProfile :: Release ,
1316
1338
_ => return Err ( anyhow:: anyhow!( "Only Debug and Opt profiles are supported" ) ) ,
1317
1339
} ;
1318
- let benchmarks = get_compile_benchmarks (
1319
- & compile_benchmark_dir ( ) ,
1320
- & local. include ,
1321
- & local. exclude ,
1322
- & local. exclude_suffix ,
1323
- ) ?;
1340
+ let benchmarks = get_compile_benchmarks ( & compile_benchmark_dir ( ) , ( & local) . into ( ) ) ?;
1324
1341
for benchmark in benchmarks {
1325
1342
println ! ( "Stats for benchmark `{}`" , benchmark. name) ;
1326
1343
println ! ( "{}" , "-" . repeat( 20 ) ) ;
@@ -1713,7 +1730,7 @@ fn bench_published_artifact(
1713
1730
} ;
1714
1731
1715
1732
// Exclude benchmarks that don't work with a stable compiler.
1716
- let mut compile_benchmarks = get_compile_benchmarks ( dirs. compile , & [ ] , & [ ] , & [ ] ) ?;
1733
+ let mut compile_benchmarks = get_compile_benchmarks ( dirs. compile , CompileBenchmarkFilter :: All ) ?;
1717
1734
compile_benchmarks. retain ( |b| b. category ( ) . is_stable ( ) ) ;
1718
1735
1719
1736
let runtime_suite = rt. block_on ( load_runtime_benchmarks (
0 commit comments