@@ -766,7 +766,7 @@ fn main_result() -> anyhow::Result<i32> {
766766 CargoIsolationMode :: Isolated
767767 } ;
768768
769- let mut rt = build_async_runtime ( ) ;
769+ let rt = build_async_runtime ( ) ;
770770 let mut conn = rt. block_on ( pool. connection ( ) ) ;
771771 let artifact_id = ArtifactId :: Commit ( Commit {
772772 sha : toolchain. id . clone ( ) ,
@@ -794,7 +794,7 @@ fn main_result() -> anyhow::Result<i32> {
794794 RuntimeBenchmarkFilter :: new ( local. exclude , local. include ) ,
795795 iterations,
796796 ) ;
797- run_benchmarks ( & mut rt , conn, shared, None , Some ( config) ) ?;
797+ rt . block_on ( run_benchmarks ( conn, shared, None , Some ( config) ) ) ?;
798798 Ok ( 0 )
799799 }
800800 Commands :: ProfileRuntime {
@@ -923,7 +923,7 @@ fn main_result() -> anyhow::Result<i32> {
923923 r#type : CommitType :: Master ,
924924 } ) ;
925925
926- let mut rt = build_async_runtime ( ) ;
926+ let rt = build_async_runtime ( ) ;
927927 let mut conn = rt. block_on ( pool. connection ( ) ) ;
928928 rt. block_on ( purge_old_data ( conn. as_mut ( ) , & artifact_id, purge. purge ) ) ;
929929
@@ -942,7 +942,7 @@ fn main_result() -> anyhow::Result<i32> {
942942 targets : vec ! [ Target :: default ( ) ] ,
943943 } ;
944944
945- run_benchmarks ( & mut rt , conn, shared, Some ( config) , None ) ?;
945+ rt . block_on ( run_benchmarks ( conn, shared, Some ( config) , None ) ) ?;
946946 Ok ( 0 )
947947 }
948948
@@ -975,18 +975,14 @@ fn main_result() -> anyhow::Result<i32> {
975975
976976 let res = std:: panic:: catch_unwind ( || {
977977 let pool = database:: Pool :: open ( & db. db ) ;
978- let mut rt = build_async_runtime ( ) ;
978+ let rt = build_async_runtime ( ) ;
979979
980980 match next {
981981 NextArtifact :: Release ( tag) => {
982982 let toolchain =
983983 create_toolchain_from_published_version ( & tag, & target_triple) ?;
984- bench_published_artifact (
985- rt. block_on ( pool. connection ( ) ) ,
986- & mut rt,
987- toolchain,
988- & benchmark_dirs,
989- )
984+ let conn = rt. block_on ( pool. connection ( ) ) ;
985+ rt. block_on ( bench_published_artifact ( conn, toolchain, & benchmark_dirs) )
990986 }
991987 NextArtifact :: Commit {
992988 commit,
@@ -1077,13 +1073,12 @@ fn main_result() -> anyhow::Result<i32> {
10771073 toolchain,
10781074 } ;
10791075
1080- run_benchmarks (
1081- & mut rt,
1076+ rt. block_on ( run_benchmarks (
10821077 conn,
10831078 shared,
10841079 Some ( compile_config) ,
10851080 Some ( runtime_config) ,
1086- )
1081+ ) )
10871082 }
10881083 }
10891084 } ) ;
@@ -1102,10 +1097,10 @@ fn main_result() -> anyhow::Result<i32> {
11021097 Commands :: BenchPublished { toolchain, db } => {
11031098 log_db ( & db) ;
11041099 let pool = database:: Pool :: open ( & db. db ) ;
1105- let mut rt = build_async_runtime ( ) ;
1100+ let rt = build_async_runtime ( ) ;
11061101 let conn = rt. block_on ( pool. connection ( ) ) ;
11071102 let toolchain = create_toolchain_from_published_version ( & toolchain, & target_triple) ?;
1108- bench_published_artifact ( conn, & mut rt , toolchain, & benchmark_dirs) ?;
1103+ rt . block_on ( bench_published_artifact ( conn, toolchain, & benchmark_dirs) ) ?;
11091104 Ok ( 0 )
11101105 }
11111106
@@ -1657,36 +1652,27 @@ async fn init_collection(
16571652}
16581653
16591654/// Execute all benchmarks specified by the given configurations.
1660- fn run_benchmarks (
1661- rt : & mut Runtime ,
1655+ async fn run_benchmarks (
16621656 mut connection : Box < dyn Connection > ,
16631657 shared : SharedBenchmarkConfig ,
16641658 compile : Option < CompileBenchmarkConfig > ,
16651659 runtime : Option < RuntimeBenchmarkConfig > ,
16661660) -> anyhow:: Result < ( ) > {
1667- rt. block_on ( record_toolchain_sizes (
1668- connection. as_mut ( ) ,
1669- & shared. artifact_id ,
1670- & shared. toolchain ,
1671- ) ) ;
1661+ record_toolchain_sizes ( connection. as_mut ( ) , & shared. artifact_id , & shared. toolchain ) . await ;
16721662
1673- let collector = rt . block_on ( init_collection (
1663+ let collector = init_collection (
16741664 connection. as_mut ( ) ,
16751665 & shared,
16761666 compile. as_ref ( ) ,
16771667 runtime. as_ref ( ) ,
1678- ) ) ;
1668+ )
1669+ . await ;
16791670
16801671 let start = Instant :: now ( ) ;
16811672
16821673 // Compile benchmarks
16831674 let compile_result = if let Some ( compile) = compile {
1684- let errors = rt. block_on ( bench_compile (
1685- connection. as_mut ( ) ,
1686- & shared,
1687- compile,
1688- & collector,
1689- ) ) ;
1675+ let errors = bench_compile ( connection. as_mut ( ) , & shared, compile, & collector) . await ;
16901676 errors
16911677 . fail_if_nonzero ( )
16921678 . context ( "Compile benchmarks failed" )
@@ -1696,30 +1682,32 @@ fn run_benchmarks(
16961682
16971683 // Runtime benchmarks
16981684 let runtime_result = if let Some ( runtime) = runtime {
1699- rt . block_on ( bench_runtime (
1685+ bench_runtime (
17001686 connection. as_mut ( ) ,
17011687 runtime. runtime_suite ,
17021688 & collector,
17031689 runtime. filter ,
17041690 runtime. iterations ,
1705- ) )
1691+ )
1692+ . await
17061693 . context ( "Runtime benchmarks failed" )
17071694 } else {
17081695 Ok ( ( ) )
17091696 } ;
17101697
17111698 let end = start. elapsed ( ) ;
1712- rt. block_on ( connection. record_duration ( collector. artifact_row_id , end) ) ;
1699+ connection
1700+ . record_duration ( collector. artifact_row_id , end)
1701+ . await ;
17131702
17141703 compile_result. and ( runtime_result)
17151704}
17161705
17171706/// Perform benchmarks on a published artifact.
1718- fn bench_published_artifact (
1707+ async fn bench_published_artifact (
17191708 mut connection : Box < dyn Connection > ,
1720- rt : & mut Runtime ,
17211709 toolchain : Toolchain ,
1722- dirs : & BenchmarkDirs ,
1710+ dirs : & BenchmarkDirs < ' _ > ,
17231711) -> anyhow:: Result < ( ) > {
17241712 let artifact_id = ArtifactId :: Tag ( toolchain. id . clone ( ) ) ;
17251713
@@ -1738,21 +1726,21 @@ fn bench_published_artifact(
17381726 let mut compile_benchmarks = get_compile_benchmarks ( dirs. compile , CompileBenchmarkFilter :: All ) ?;
17391727 compile_benchmarks. retain ( |b| b. category ( ) . is_stable ( ) ) ;
17401728
1741- let runtime_suite = rt . block_on ( load_runtime_benchmarks (
1729+ let runtime_suite = load_runtime_benchmarks (
17421730 connection. as_mut ( ) ,
17431731 dirs. runtime ,
17441732 CargoIsolationMode :: Isolated ,
17451733 None ,
17461734 & toolchain,
17471735 & artifact_id,
1748- ) ) ?;
1736+ )
1737+ . await ?;
17491738
17501739 let shared = SharedBenchmarkConfig {
17511740 artifact_id,
17521741 toolchain,
17531742 } ;
17541743 run_benchmarks (
1755- rt,
17561744 connection,
17571745 shared,
17581746 Some ( CompileBenchmarkConfig {
@@ -1771,6 +1759,7 @@ fn bench_published_artifact(
17711759 DEFAULT_RUNTIME_ITERATIONS ,
17721760 ) ) ,
17731761 )
1762+ . await
17741763}
17751764
17761765const COMPILE_BENCHMARK_TIMEOUT : Duration = Duration :: from_secs ( 60 * 30 ) ;
0 commit comments