@@ -40,6 +40,7 @@ use collector::compile::benchmark::scenario::Scenario;
4040use collector:: compile:: benchmark:: target:: Target ;
4141use collector:: compile:: benchmark:: {
4242 compile_benchmark_dir, get_compile_benchmarks, ArtifactType , Benchmark , BenchmarkName ,
43+ CompileBenchmarkFilter ,
4344} ;
4445use collector:: compile:: execute:: bencher:: BenchProcessor ;
4546use collector:: compile:: execute:: profiler:: { ProfileProcessor , Profiler } ;
@@ -337,6 +338,16 @@ struct LocalOptions {
337338 #[ arg( long, value_delimiter = ',' ) ]
338339 include : Vec < String > ,
339340
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+
340351 /// Include only benchmarks belonging to the given categories.
341352 #[ arg( long, value_parser = EnumArgParser :: <Category >:: default ( ) , default_value = "Primary,Secondary" ) ]
342353 category : MultiEnumValue < Category > ,
@@ -688,6 +699,25 @@ enum DownloadSubcommand {
688699 } ,
689700}
690701
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+
691721fn main_result ( ) -> anyhow:: Result < i32 > {
692722 env_logger:: init ( ) ;
693723
@@ -884,12 +914,7 @@ fn main_result() -> anyhow::Result<i32> {
884914 target_triple,
885915 ) ?;
886916
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 ( ) ) ?;
893918 benchmarks. retain ( |b| local. category . 0 . contains ( & b. category ( ) ) ) ;
894919
895920 let artifact_id = ArtifactId :: Commit ( Commit {
@@ -1006,9 +1031,11 @@ fn main_result() -> anyhow::Result<i32> {
10061031
10071032 let mut benchmarks = get_compile_benchmarks (
10081033 & 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+ } ,
10121039 ) ?;
10131040 benchmarks. retain ( |b| b. category ( ) . is_primary_or_secondary ( ) ) ;
10141041
@@ -1102,12 +1129,7 @@ fn main_result() -> anyhow::Result<i32> {
11021129 let scenarios = & opts. scenarios . 0 ;
11031130 let backends = & opts. codegen_backends . 0 ;
11041131
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 ( ) ) ?;
11111133 benchmarks. retain ( |b| local. category . 0 . contains ( & b. category ( ) ) ) ;
11121134
11131135 let mut errors = BenchmarkErrors :: new ( ) ;
@@ -1315,12 +1337,7 @@ fn binary_stats_compile(
13151337 Profile :: Opt => CargoProfile :: Release ,
13161338 _ => return Err ( anyhow:: anyhow!( "Only Debug and Opt profiles are supported" ) ) ,
13171339 } ;
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 ( ) ) ?;
13241341 for benchmark in benchmarks {
13251342 println ! ( "Stats for benchmark `{}`" , benchmark. name) ;
13261343 println ! ( "{}" , "-" . repeat( 20 ) ) ;
@@ -1713,7 +1730,7 @@ fn bench_published_artifact(
17131730 } ;
17141731
17151732 // 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 ) ?;
17171734 compile_benchmarks. retain ( |b| b. category ( ) . is_stable ( ) ) ;
17181735
17191736 let runtime_suite = rt. block_on ( load_runtime_benchmarks (
0 commit comments