@@ -640,28 +640,24 @@ fn main_result() -> anyhow::Result<i32> {
640
640
} else {
641
641
CargoIsolationMode :: Isolated
642
642
} ;
643
- let suite = runtime:: prepare_runtime_benchmark_suite (
643
+ let runtime_suite = runtime:: prepare_runtime_benchmark_suite (
644
644
& toolchain,
645
645
& runtime_benchmark_dir,
646
646
isolation_mode,
647
647
) ?;
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 ) ,
662
657
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) ) ?;
665
661
Ok ( 0 )
666
662
}
667
663
Commands :: BenchLocal {
@@ -696,7 +692,7 @@ fn main_result() -> anyhow::Result<i32> {
696
692
benchmarks. retain ( |b| b. category ( ) . is_primary_or_secondary ( ) ) ;
697
693
698
694
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 ( ) ) ;
700
696
let shared = SharedBenchmarkConfig {
701
697
toolchain,
702
698
artifact_id,
@@ -709,10 +705,8 @@ fn main_result() -> anyhow::Result<i32> {
709
705
is_self_profile : self_profile. self_profile ,
710
706
bench_rustc : bench_rustc. bench_rustc ,
711
707
} ;
712
- let collector =
713
- rt. block_on ( init_collection ( conn. as_mut ( ) , & shared, Some ( & config) , None ) ) ;
714
708
715
- bench_compile ( & mut rt, conn. as_mut ( ) , & shared, config, & collector ) . fail_if_nonzero ( ) ?;
709
+ run_benchmarks ( & mut rt, conn, shared, Some ( config) , None ) ?;
716
710
Ok ( 0 )
717
711
}
718
712
@@ -771,7 +765,7 @@ fn main_result() -> anyhow::Result<i32> {
771
765
benchmarks. retain ( |b| b. category ( ) . is_primary_or_secondary ( ) ) ;
772
766
773
767
let artifact_id = ArtifactId :: Commit ( commit) ;
774
- let mut conn = rt. block_on ( pool. connection ( ) ) ;
768
+ let conn = rt. block_on ( pool. connection ( ) ) ;
775
769
let toolchain = Toolchain :: from_sysroot ( & sysroot, sha) ;
776
770
777
771
let shared = SharedBenchmarkConfig {
@@ -787,13 +781,11 @@ fn main_result() -> anyhow::Result<i32> {
787
781
bench_rustc : bench_rustc. bench_rustc ,
788
782
} ;
789
783
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 ) ;
793
785
794
786
client. post ( format ! ( "{}/perf/onpush" , site_url) ) . send ( ) ?;
795
787
796
- res. fail_if_nonzero ( ) ?;
788
+ res?;
797
789
}
798
790
}
799
791
@@ -972,8 +964,8 @@ async fn init_collection(
972
964
973
965
/// Execute all benchmarks specified by the given configurations.
974
966
fn run_benchmarks (
975
- mut connection : Box < dyn Connection > ,
976
967
rt : & mut Runtime ,
968
+ mut connection : Box < dyn Connection > ,
977
969
shared : SharedBenchmarkConfig ,
978
970
compile : Option < CompileBenchmarkConfig > ,
979
971
runtime : Option < RuntimeBenchmarkConfig > ,
@@ -985,6 +977,8 @@ fn run_benchmarks(
985
977
runtime. as_ref ( ) ,
986
978
) ) ;
987
979
980
+ let start = Instant :: now ( ) ;
981
+
988
982
// Compile benchmarks
989
983
let compile_result = if let Some ( compile) = compile {
990
984
let errors = bench_compile ( rt, connection. as_mut ( ) , & shared, compile, & collector) ;
@@ -998,7 +992,7 @@ fn run_benchmarks(
998
992
// Runtime benchmarks
999
993
let runtime_result = if let Some ( runtime) = runtime {
1000
994
rt. block_on ( bench_runtime (
1001
- connection,
995
+ connection. as_mut ( ) ,
1002
996
runtime. runtime_suite ,
1003
997
& collector,
1004
998
runtime. filter ,
@@ -1009,6 +1003,9 @@ fn run_benchmarks(
1009
1003
Ok ( ( ) )
1010
1004
} ;
1011
1005
1006
+ let end = start. elapsed ( ) ;
1007
+ rt. block_on ( connection. record_duration ( collector. artifact_row_id , end) ) ;
1008
+
1012
1009
compile_result. or ( runtime_result)
1013
1010
}
1014
1011
@@ -1047,8 +1044,8 @@ fn bench_published_artifact(
1047
1044
toolchain,
1048
1045
} ;
1049
1046
run_benchmarks (
1050
- connection,
1051
1047
rt,
1048
+ connection,
1052
1049
shared,
1053
1050
Some ( CompileBenchmarkConfig {
1054
1051
benchmarks : compile_benchmarks,
@@ -1089,7 +1086,6 @@ fn bench_compile(
1089
1086
let bench_rustc = config. bench_rustc ;
1090
1087
1091
1088
let start = Instant :: now ( ) ;
1092
- let mut skipped = false ;
1093
1089
1094
1090
let mut measure_and_record =
1095
1091
|benchmark_name : & BenchmarkName ,
@@ -1098,7 +1094,6 @@ fn bench_compile(
1098
1094
measure : & dyn Fn ( & mut BenchProcessor ) -> anyhow:: Result < ( ) > | {
1099
1095
let is_fresh = rt. block_on ( collector. start_compile_step ( conn, benchmark_name) ) ;
1100
1096
if !is_fresh {
1101
- skipped = true ;
1102
1097
eprintln ! ( "skipping {} -- already benchmarked" , benchmark_name) ;
1103
1098
return ;
1104
1099
}
@@ -1180,12 +1175,6 @@ fn bench_compile(
1180
1175
end, errors. 0
1181
1176
) ;
1182
1177
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
-
1189
1178
rt. block_on ( async move {
1190
1179
// This ensures that we're good to go with the just updated data.
1191
1180
conn. maybe_create_indices ( ) . await ;
0 commit comments