@@ -645,15 +645,6 @@ fn main_result() -> anyhow::Result<i32> {
645
645
runtime : & runtime_benchmark_dir,
646
646
} ;
647
647
648
- let mut builder = tokio:: runtime:: Builder :: new_multi_thread ( ) ;
649
- // We want to minimize noise from the runtime
650
- builder
651
- . worker_threads ( 1 )
652
- . max_blocking_threads ( 1 )
653
- . enable_time ( )
654
- . enable_io ( ) ;
655
- let mut rt = builder. build ( ) . expect ( "built runtime" ) ;
656
-
657
648
// XXX: This doesn't necessarily work for all archs
658
649
let target_triple = format ! ( "{}-unknown-linux-gnu" , std:: env:: consts:: ARCH ) ;
659
650
@@ -765,6 +756,7 @@ fn main_result() -> anyhow::Result<i32> {
765
756
CargoIsolationMode :: Isolated
766
757
} ;
767
758
759
+ let mut rt = build_async_runtime ( ) ;
768
760
let mut conn = rt. block_on ( pool. connection ( ) ) ;
769
761
let artifact_id = ArtifactId :: Tag ( toolchain. id . clone ( ) ) ;
770
762
rt. block_on ( purge_old_data ( conn. as_mut ( ) , & artifact_id, purge. purge ) ) ;
@@ -916,6 +908,7 @@ fn main_result() -> anyhow::Result<i32> {
916
908
benchmarks. retain ( |b| local. category . 0 . contains ( & b. category ( ) ) ) ;
917
909
918
910
let artifact_id = ArtifactId :: Tag ( toolchain. id . clone ( ) ) ;
911
+ let mut rt = build_async_runtime ( ) ;
919
912
let mut conn = rt. block_on ( pool. connection ( ) ) ;
920
913
rt. block_on ( purge_old_data ( conn. as_mut ( ) , & artifact_id, purge. purge ) ) ;
921
914
@@ -965,6 +958,7 @@ fn main_result() -> anyhow::Result<i32> {
965
958
} ;
966
959
967
960
let pool = database:: Pool :: open ( & db. db ) ;
961
+ let mut rt = build_async_runtime ( ) ;
968
962
969
963
let res = match next {
970
964
NextArtifact :: Release ( tag) => {
@@ -1047,6 +1041,7 @@ fn main_result() -> anyhow::Result<i32> {
1047
1041
Commands :: BenchPublished { toolchain, db } => {
1048
1042
log_db ( & db) ;
1049
1043
let pool = database:: Pool :: open ( & db. db ) ;
1044
+ let mut rt = build_async_runtime ( ) ;
1050
1045
let conn = rt. block_on ( pool. connection ( ) ) ;
1051
1046
let toolchain = create_toolchain_from_published_version ( & toolchain, & target_triple) ?;
1052
1047
bench_published_artifact ( conn, & mut rt, toolchain, & benchmark_dirs) ?;
@@ -1204,6 +1199,7 @@ Make sure to modify `{dir}/perf-config.json` if the category/artifact don't matc
1204
1199
}
1205
1200
Commands :: PurgeArtifact { name, db } => {
1206
1201
let pool = Pool :: open ( & db. db ) ;
1202
+ let rt = build_async_runtime ( ) ;
1207
1203
let conn = rt. block_on ( pool. connection ( ) ) ;
1208
1204
rt. block_on ( conn. purge_artifact ( & ArtifactId :: Tag ( name. clone ( ) ) ) ) ;
1209
1205
@@ -1213,6 +1209,17 @@ Make sure to modify `{dir}/perf-config.json` if the category/artifact don't matc
1213
1209
}
1214
1210
}
1215
1211
1212
+ fn build_async_runtime ( ) -> Runtime {
1213
+ let mut builder = tokio:: runtime:: Builder :: new_multi_thread ( ) ;
1214
+ // We want to minimize noise from the runtime
1215
+ builder
1216
+ . worker_threads ( 1 )
1217
+ . max_blocking_threads ( 1 )
1218
+ . enable_time ( )
1219
+ . enable_io ( ) ;
1220
+ builder. build ( ) . expect ( "built runtime" )
1221
+ }
1222
+
1216
1223
fn print_binary_stats (
1217
1224
name_header : & str ,
1218
1225
items : HashMap < String , u64 > ,
0 commit comments