@@ -6,7 +6,7 @@ extern crate clap;
6
6
use anyhow:: { bail, Context } ;
7
7
use collector:: api:: collected;
8
8
use database:: { pool:: Connection , ArtifactId , Commit } ;
9
- use log:: { debug, error } ;
9
+ use log:: debug;
10
10
use std:: collections:: HashSet ;
11
11
use std:: fs;
12
12
use std:: io:: { stderr, Write } ;
@@ -162,54 +162,6 @@ where
162
162
Ok ( v)
163
163
}
164
164
165
- fn bench_next (
166
- rt : & mut Runtime ,
167
- site_url : & str ,
168
- pool : & database:: Pool ,
169
- benchmarks : & [ Benchmark ] ,
170
- self_profile : bool ,
171
- ) -> anyhow:: Result < ( ) > {
172
- println ! ( "processing commits" ) ;
173
- let client = reqwest:: blocking:: Client :: new ( ) ;
174
- let response: collector:: api:: next_commit:: Response = client
175
- . get ( & format ! ( "{}/perf/next_commit" , site_url) )
176
- . send ( ) ?
177
- . json ( ) ?;
178
- let commit = if let Some ( c) = response. commit {
179
- c
180
- } else {
181
- println ! ( "no commit to benchmark" ) ;
182
- // no missing commits
183
- return Ok ( ( ) ) ;
184
- } ;
185
-
186
- let commit = get_commit_or_fake_it ( & commit) ?;
187
- match Sysroot :: install ( commit. sha . to_string ( ) , "x86_64-unknown-linux-gnu" ) {
188
- Ok ( sysroot) => {
189
- let conn = rt. block_on ( pool. connection ( ) ) ;
190
- bench (
191
- rt,
192
- conn,
193
- & ArtifactId :: Commit ( commit) ,
194
- & BuildKind :: all ( ) ,
195
- & RunKind :: all ( ) ,
196
- Compiler :: from_sysroot ( & sysroot) ,
197
- & benchmarks,
198
- 3 ,
199
- /* call_home */ true ,
200
- self_profile,
201
- ) ;
202
- }
203
- Err ( err) => {
204
- error ! ( "failed to install sysroot for {:?}: {:?}" , commit, err) ;
205
- }
206
- }
207
-
208
- client. post ( & format ! ( "{}/perf/onpush" , site_url) ) . send ( ) ?;
209
-
210
- Ok ( ( ) )
211
- }
212
-
213
165
fn n_benchmarks_remaining ( n : usize ) -> String {
214
166
let suffix = if n == 1 { "" } else { "s" } ;
215
167
format ! ( "{} benchmark{} remaining" , n, suffix)
@@ -616,11 +568,44 @@ fn main_result() -> anyhow::Result<i32> {
616
568
let db = sub_m. value_of ( "DB" ) . unwrap_or ( default_db) ;
617
569
let self_profile = sub_m. is_present ( "SELF_PROFILE" ) ;
618
570
571
+ println ! ( "processing commits" ) ;
572
+ let client = reqwest:: blocking:: Client :: new ( ) ;
573
+ let response: collector:: api:: next_commit:: Response = client
574
+ . get ( & format ! ( "{}/perf/next_commit" , site_url) )
575
+ . send ( ) ?
576
+ . json ( ) ?;
577
+ let commit = if let Some ( c) = response. commit {
578
+ c
579
+ } else {
580
+ println ! ( "no commit to benchmark" ) ;
581
+ // no missing commits
582
+ return Ok ( 0 ) ;
583
+ } ;
584
+ let commit = get_commit_or_fake_it ( & commit) ?;
585
+
619
586
let pool = database:: Pool :: open ( db) ;
587
+ let conn = rt. block_on ( pool. connection ( ) ) ;
588
+
589
+ let sysroot = Sysroot :: install ( commit. sha . to_string ( ) , "x86_64-unknown-linux-gnu" )
590
+ . with_context ( || format ! ( "failed to install sysroot for {:?}" , commit) ) ?;
620
591
621
592
let benchmarks = get_benchmarks ( & benchmark_dir, None , None ) ?;
622
593
623
- bench_next ( & mut rt, & site_url, & pool, & benchmarks, self_profile) ?;
594
+ bench (
595
+ & mut rt,
596
+ conn,
597
+ & ArtifactId :: Commit ( commit) ,
598
+ & BuildKind :: all ( ) ,
599
+ & RunKind :: all ( ) ,
600
+ Compiler :: from_sysroot ( & sysroot) ,
601
+ & benchmarks,
602
+ 3 ,
603
+ /* call_home */ true ,
604
+ self_profile,
605
+ ) ;
606
+
607
+ client. post ( & format ! ( "{}/perf/onpush" , site_url) ) . send ( ) ?;
608
+
624
609
Ok ( 0 )
625
610
}
626
611
0 commit comments