@@ -11,7 +11,7 @@ use collector::compile::benchmark::{
11
11
compile_benchmark_dir, get_compile_benchmarks, Benchmark , BenchmarkName ,
12
12
} ;
13
13
use collector:: { runtime, utils, CollectorCtx , CollectorStepBuilder } ;
14
- use database:: { ArtifactId , Commit , CommitType , Connection , Pool } ;
14
+ use database:: { ArtifactId , ArtifactIdNumber , Commit , CommitType , Connection , Pool } ;
15
15
use rayon:: iter:: { IndexedParallelIterator , IntoParallelRefIterator , ParallelIterator } ;
16
16
use std:: cmp:: Ordering ;
17
17
use std:: ffi:: OsStr ;
@@ -978,6 +978,12 @@ fn run_benchmarks(
978
978
compile : Option < CompileBenchmarkConfig > ,
979
979
runtime : Option < RuntimeBenchmarkConfig > ,
980
980
) -> anyhow:: Result < ( ) > {
981
+ rt. block_on ( record_toolchain_sizes (
982
+ connection. as_mut ( ) ,
983
+ & shared. artifact_id ,
984
+ & shared. toolchain ,
985
+ ) ) ;
986
+
981
987
let collector = rt. block_on ( init_collection (
982
988
connection. as_mut ( ) ,
983
989
& shared,
@@ -1190,6 +1196,38 @@ fn bench_compile(
1190
1196
errors
1191
1197
}
1192
1198
1199
+ /// Records the sizes of individual components (rustc, libLLVM, etc.) for the given toolchain
1200
+ /// and artifact id into the database.
1201
+ async fn record_toolchain_sizes (
1202
+ conn : & mut dyn Connection ,
1203
+ artifact_id : & ArtifactId ,
1204
+ toolchain : & Toolchain ,
1205
+ ) {
1206
+ let aid = conn. artifact_id ( artifact_id) . await ;
1207
+
1208
+ async fn record (
1209
+ conn : & mut dyn Connection ,
1210
+ aid : ArtifactIdNumber ,
1211
+ component : & str ,
1212
+ path : Option < & Path > ,
1213
+ ) {
1214
+ if let Some ( path) = path {
1215
+ if let Ok ( size) = fs:: metadata ( path) . map ( |m| m. len ( ) ) {
1216
+ conn. record_artifact_size ( aid, component, size) . await ;
1217
+ }
1218
+ }
1219
+ }
1220
+
1221
+ let paths = & toolchain. components ;
1222
+ record ( conn, aid, "rustc" , Some ( & paths. rustc ) ) . await ;
1223
+ record ( conn, aid, "rustdoc" , paths. rustdoc . as_deref ( ) ) . await ;
1224
+ record ( conn, aid, "cargo" , Some ( & paths. cargo ) ) . await ;
1225
+ record ( conn, aid, "librustc_driver" , paths. lib_rustc . as_deref ( ) ) . await ;
1226
+ record ( conn, aid, "libstd" , paths. lib_std . as_deref ( ) ) . await ;
1227
+ record ( conn, aid, "libtest" , paths. lib_test . as_deref ( ) ) . await ;
1228
+ record ( conn, aid, "libLLVM" , paths. lib_llvm . as_deref ( ) ) . await ;
1229
+ }
1230
+
1193
1231
fn add_perf_config ( directory : & Path , category : Category ) {
1194
1232
let data = serde_json:: json!( {
1195
1233
"category" : category. to_string( )
0 commit comments