@@ -766,7 +766,7 @@ fn main_result() -> anyhow::Result<i32> {
766
766
CargoIsolationMode :: Isolated
767
767
} ;
768
768
769
- let mut rt = build_async_runtime ( ) ;
769
+ let rt = build_async_runtime ( ) ;
770
770
let mut conn = rt. block_on ( pool. connection ( ) ) ;
771
771
let artifact_id = ArtifactId :: Commit ( Commit {
772
772
sha : toolchain. id . clone ( ) ,
@@ -794,7 +794,7 @@ fn main_result() -> anyhow::Result<i32> {
794
794
RuntimeBenchmarkFilter :: new ( local. exclude , local. include ) ,
795
795
iterations,
796
796
) ;
797
- run_benchmarks ( & mut rt , conn, shared, None , Some ( config) ) ?;
797
+ rt . block_on ( run_benchmarks ( conn, shared, None , Some ( config) ) ) ?;
798
798
Ok ( 0 )
799
799
}
800
800
Commands :: ProfileRuntime {
@@ -923,7 +923,7 @@ fn main_result() -> anyhow::Result<i32> {
923
923
r#type : CommitType :: Master ,
924
924
} ) ;
925
925
926
- let mut rt = build_async_runtime ( ) ;
926
+ let rt = build_async_runtime ( ) ;
927
927
let mut conn = rt. block_on ( pool. connection ( ) ) ;
928
928
rt. block_on ( purge_old_data ( conn. as_mut ( ) , & artifact_id, purge. purge ) ) ;
929
929
@@ -942,7 +942,7 @@ fn main_result() -> anyhow::Result<i32> {
942
942
targets : vec ! [ Target :: default ( ) ] ,
943
943
} ;
944
944
945
- run_benchmarks ( & mut rt , conn, shared, Some ( config) , None ) ?;
945
+ rt . block_on ( run_benchmarks ( conn, shared, Some ( config) , None ) ) ?;
946
946
Ok ( 0 )
947
947
}
948
948
@@ -975,18 +975,14 @@ fn main_result() -> anyhow::Result<i32> {
975
975
976
976
let res = std:: panic:: catch_unwind ( || {
977
977
let pool = database:: Pool :: open ( & db. db ) ;
978
- let mut rt = build_async_runtime ( ) ;
978
+ let rt = build_async_runtime ( ) ;
979
979
980
980
match next {
981
981
NextArtifact :: Release ( tag) => {
982
982
let toolchain =
983
983
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) )
990
986
}
991
987
NextArtifact :: Commit {
992
988
commit,
@@ -1077,13 +1073,12 @@ fn main_result() -> anyhow::Result<i32> {
1077
1073
toolchain,
1078
1074
} ;
1079
1075
1080
- run_benchmarks (
1081
- & mut rt,
1076
+ rt. block_on ( run_benchmarks (
1082
1077
conn,
1083
1078
shared,
1084
1079
Some ( compile_config) ,
1085
1080
Some ( runtime_config) ,
1086
- )
1081
+ ) )
1087
1082
}
1088
1083
}
1089
1084
} ) ;
@@ -1102,10 +1097,10 @@ fn main_result() -> anyhow::Result<i32> {
1102
1097
Commands :: BenchPublished { toolchain, db } => {
1103
1098
log_db ( & db) ;
1104
1099
let pool = database:: Pool :: open ( & db. db ) ;
1105
- let mut rt = build_async_runtime ( ) ;
1100
+ let rt = build_async_runtime ( ) ;
1106
1101
let conn = rt. block_on ( pool. connection ( ) ) ;
1107
1102
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) ) ?;
1109
1104
Ok ( 0 )
1110
1105
}
1111
1106
@@ -1657,36 +1652,27 @@ async fn init_collection(
1657
1652
}
1658
1653
1659
1654
/// Execute all benchmarks specified by the given configurations.
1660
- fn run_benchmarks (
1661
- rt : & mut Runtime ,
1655
+ async fn run_benchmarks (
1662
1656
mut connection : Box < dyn Connection > ,
1663
1657
shared : SharedBenchmarkConfig ,
1664
1658
compile : Option < CompileBenchmarkConfig > ,
1665
1659
runtime : Option < RuntimeBenchmarkConfig > ,
1666
1660
) -> 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 ;
1672
1662
1673
- let collector = rt . block_on ( init_collection (
1663
+ let collector = init_collection (
1674
1664
connection. as_mut ( ) ,
1675
1665
& shared,
1676
1666
compile. as_ref ( ) ,
1677
1667
runtime. as_ref ( ) ,
1678
- ) ) ;
1668
+ )
1669
+ . await ;
1679
1670
1680
1671
let start = Instant :: now ( ) ;
1681
1672
1682
1673
// Compile benchmarks
1683
1674
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 ;
1690
1676
errors
1691
1677
. fail_if_nonzero ( )
1692
1678
. context ( "Compile benchmarks failed" )
@@ -1696,30 +1682,32 @@ fn run_benchmarks(
1696
1682
1697
1683
// Runtime benchmarks
1698
1684
let runtime_result = if let Some ( runtime) = runtime {
1699
- rt . block_on ( bench_runtime (
1685
+ bench_runtime (
1700
1686
connection. as_mut ( ) ,
1701
1687
runtime. runtime_suite ,
1702
1688
& collector,
1703
1689
runtime. filter ,
1704
1690
runtime. iterations ,
1705
- ) )
1691
+ )
1692
+ . await
1706
1693
. context ( "Runtime benchmarks failed" )
1707
1694
} else {
1708
1695
Ok ( ( ) )
1709
1696
} ;
1710
1697
1711
1698
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 ;
1713
1702
1714
1703
compile_result. and ( runtime_result)
1715
1704
}
1716
1705
1717
1706
/// Perform benchmarks on a published artifact.
1718
- fn bench_published_artifact (
1707
+ async fn bench_published_artifact (
1719
1708
mut connection : Box < dyn Connection > ,
1720
- rt : & mut Runtime ,
1721
1709
toolchain : Toolchain ,
1722
- dirs : & BenchmarkDirs ,
1710
+ dirs : & BenchmarkDirs < ' _ > ,
1723
1711
) -> anyhow:: Result < ( ) > {
1724
1712
let artifact_id = ArtifactId :: Tag ( toolchain. id . clone ( ) ) ;
1725
1713
@@ -1738,21 +1726,21 @@ fn bench_published_artifact(
1738
1726
let mut compile_benchmarks = get_compile_benchmarks ( dirs. compile , CompileBenchmarkFilter :: All ) ?;
1739
1727
compile_benchmarks. retain ( |b| b. category ( ) . is_stable ( ) ) ;
1740
1728
1741
- let runtime_suite = rt . block_on ( load_runtime_benchmarks (
1729
+ let runtime_suite = load_runtime_benchmarks (
1742
1730
connection. as_mut ( ) ,
1743
1731
dirs. runtime ,
1744
1732
CargoIsolationMode :: Isolated ,
1745
1733
None ,
1746
1734
& toolchain,
1747
1735
& artifact_id,
1748
- ) ) ?;
1736
+ )
1737
+ . await ?;
1749
1738
1750
1739
let shared = SharedBenchmarkConfig {
1751
1740
artifact_id,
1752
1741
toolchain,
1753
1742
} ;
1754
1743
run_benchmarks (
1755
- rt,
1756
1744
connection,
1757
1745
shared,
1758
1746
Some ( CompileBenchmarkConfig {
@@ -1771,6 +1759,7 @@ fn bench_published_artifact(
1771
1759
DEFAULT_RUNTIME_ITERATIONS ,
1772
1760
) ) ,
1773
1761
)
1762
+ . await
1774
1763
}
1775
1764
1776
1765
const COMPILE_BENCHMARK_TIMEOUT : Duration = Duration :: from_secs ( 60 * 30 ) ;
@@ -1802,6 +1791,7 @@ async fn bench_compile(
1802
1791
1803
1792
let start = Instant :: now ( ) ;
1804
1793
1794
+ #[ allow( clippy:: too_many_arguments) ]
1805
1795
async fn measure_and_record < F : AsyncFn ( & mut BenchProcessor ) -> anyhow:: Result < ( ) > > (
1806
1796
collector : & CollectorCtx ,
1807
1797
shared : & SharedBenchmarkConfig ,
@@ -1989,7 +1979,7 @@ fn get_downloaded_crate_target(benchmark_dir: &Path, cmd: &DownloadCommand) -> P
1989
1979
. trim_end_matches ( '/' )
1990
1980
. trim_end_matches ( ".git" )
1991
1981
. split ( '/' )
1992
- . last ( )
1982
+ . next_back ( )
1993
1983
. expect ( "Crate name could not be determined from git URL" )
1994
1984
. to_string ( ) ,
1995
1985
DownloadSubcommand :: Crate { krate, version } => format ! ( "{krate}-{version}" ) ,
0 commit comments