@@ -640,28 +640,24 @@ fn main_result() -> anyhow::Result<i32> {
640640 } else {
641641 CargoIsolationMode :: Isolated
642642 } ;
643- let suite = runtime:: prepare_runtime_benchmark_suite (
643+ let runtime_suite = runtime:: prepare_runtime_benchmark_suite (
644644 & toolchain,
645645 & runtime_benchmark_dir,
646646 isolation_mode,
647647 ) ?;
648- let artifact_id = ArtifactId :: Tag ( toolchain. id ) ;
649- let ( conn, collector) = rt. block_on ( async {
650- let mut conn = pool. connection ( ) . await ;
651- let collector = CollectorStepBuilder :: default ( )
652- . record_runtime_benchmarks ( & suite)
653- . start_collection ( conn. as_mut ( ) , & artifact_id)
654- . await ;
655- ( conn, collector)
656- } ) ;
657- let fut = bench_runtime (
658- conn,
659- suite,
660- & collector,
661- BenchmarkFilter :: new ( local. exclude , local. include ) ,
648+ let artifact_id = ArtifactId :: Tag ( toolchain. id . clone ( ) ) ;
649+
650+ let shared = SharedBenchmarkConfig {
651+ artifact_id,
652+ toolchain,
653+ } ;
654+ let config = RuntimeBenchmarkConfig {
655+ runtime_suite,
656+ filter : BenchmarkFilter :: new ( local. exclude , local. include ) ,
662657 iterations,
663- ) ;
664- rt. block_on ( fut) ?;
658+ } ;
659+ let conn = rt. block_on ( pool. connection ( ) ) ;
660+ run_benchmarks ( & mut rt, conn, shared, None , Some ( config) ) ?;
665661 Ok ( 0 )
666662 }
667663 Commands :: BenchLocal {
@@ -696,7 +692,7 @@ fn main_result() -> anyhow::Result<i32> {
696692 benchmarks. retain ( |b| b. category ( ) . is_primary_or_secondary ( ) ) ;
697693
698694 let artifact_id = ArtifactId :: Tag ( toolchain. id . clone ( ) ) ;
699- let mut conn = rt. block_on ( pool. connection ( ) ) ;
695+ let conn = rt. block_on ( pool. connection ( ) ) ;
700696 let shared = SharedBenchmarkConfig {
701697 toolchain,
702698 artifact_id,
@@ -709,10 +705,8 @@ fn main_result() -> anyhow::Result<i32> {
709705 is_self_profile : self_profile. self_profile ,
710706 bench_rustc : bench_rustc. bench_rustc ,
711707 } ;
712- let collector =
713- rt. block_on ( init_collection ( conn. as_mut ( ) , & shared, Some ( & config) , None ) ) ;
714708
715- bench_compile ( & mut rt, conn. as_mut ( ) , & shared, config, & collector ) . fail_if_nonzero ( ) ?;
709+ run_benchmarks ( & mut rt, conn, shared, Some ( config) , None ) ?;
716710 Ok ( 0 )
717711 }
718712
@@ -771,7 +765,7 @@ fn main_result() -> anyhow::Result<i32> {
771765 benchmarks. retain ( |b| b. category ( ) . is_primary_or_secondary ( ) ) ;
772766
773767 let artifact_id = ArtifactId :: Commit ( commit) ;
774- let mut conn = rt. block_on ( pool. connection ( ) ) ;
768+ let conn = rt. block_on ( pool. connection ( ) ) ;
775769 let toolchain = Toolchain :: from_sysroot ( & sysroot, sha) ;
776770
777771 let shared = SharedBenchmarkConfig {
@@ -787,13 +781,11 @@ fn main_result() -> anyhow::Result<i32> {
787781 bench_rustc : bench_rustc. bench_rustc ,
788782 } ;
789783
790- let collector =
791- rt. block_on ( init_collection ( conn. as_mut ( ) , & shared, Some ( & config) , None ) ) ;
792- let res = bench_compile ( & mut rt, conn. as_mut ( ) , & shared, config, & collector) ;
784+ let res = run_benchmarks ( & mut rt, conn, shared, Some ( config) , None ) ;
793785
794786 client. post ( format ! ( "{}/perf/onpush" , site_url) ) . send ( ) ?;
795787
796- res. fail_if_nonzero ( ) ?;
788+ res?;
797789 }
798790 }
799791
@@ -972,8 +964,8 @@ async fn init_collection(
972964
973965/// Execute all benchmarks specified by the given configurations.
974966fn run_benchmarks (
975- mut connection : Box < dyn Connection > ,
976967 rt : & mut Runtime ,
968+ mut connection : Box < dyn Connection > ,
977969 shared : SharedBenchmarkConfig ,
978970 compile : Option < CompileBenchmarkConfig > ,
979971 runtime : Option < RuntimeBenchmarkConfig > ,
@@ -985,6 +977,8 @@ fn run_benchmarks(
985977 runtime. as_ref ( ) ,
986978 ) ) ;
987979
980+ let start = Instant :: now ( ) ;
981+
988982 // Compile benchmarks
989983 let compile_result = if let Some ( compile) = compile {
990984 let errors = bench_compile ( rt, connection. as_mut ( ) , & shared, compile, & collector) ;
@@ -998,7 +992,7 @@ fn run_benchmarks(
998992 // Runtime benchmarks
999993 let runtime_result = if let Some ( runtime) = runtime {
1000994 rt. block_on ( bench_runtime (
1001- connection,
995+ connection. as_mut ( ) ,
1002996 runtime. runtime_suite ,
1003997 & collector,
1004998 runtime. filter ,
@@ -1009,6 +1003,9 @@ fn run_benchmarks(
10091003 Ok ( ( ) )
10101004 } ;
10111005
1006+ let end = start. elapsed ( ) ;
1007+ rt. block_on ( connection. record_duration ( collector. artifact_row_id , end) ) ;
1008+
10121009 compile_result. or ( runtime_result)
10131010}
10141011
@@ -1047,8 +1044,8 @@ fn bench_published_artifact(
10471044 toolchain,
10481045 } ;
10491046 run_benchmarks (
1050- connection,
10511047 rt,
1048+ connection,
10521049 shared,
10531050 Some ( CompileBenchmarkConfig {
10541051 benchmarks : compile_benchmarks,
@@ -1089,7 +1086,6 @@ fn bench_compile(
10891086 let bench_rustc = config. bench_rustc ;
10901087
10911088 let start = Instant :: now ( ) ;
1092- let mut skipped = false ;
10931089
10941090 let mut measure_and_record =
10951091 |benchmark_name : & BenchmarkName ,
@@ -1098,7 +1094,6 @@ fn bench_compile(
10981094 measure : & dyn Fn ( & mut BenchProcessor ) -> anyhow:: Result < ( ) > | {
10991095 let is_fresh = rt. block_on ( collector. start_compile_step ( conn, benchmark_name) ) ;
11001096 if !is_fresh {
1101- skipped = true ;
11021097 eprintln ! ( "skipping {} -- already benchmarked" , benchmark_name) ;
11031098 return ;
11041099 }
@@ -1180,12 +1175,6 @@ fn bench_compile(
11801175 end, errors. 0
11811176 ) ;
11821177
1183- if skipped {
1184- log:: info!( "skipping duration record -- skipped parts of run" ) ;
1185- } else {
1186- rt. block_on ( conn. record_duration ( collector. artifact_row_id , end) ) ;
1187- }
1188-
11891178 rt. block_on ( async move {
11901179 // This ensures that we're good to go with the just updated data.
11911180 conn. maybe_create_indices ( ) . await ;
0 commit comments