@@ -18,7 +18,7 @@ use tokio::runtime::Runtime;
18
18
mod execute;
19
19
mod sysroot;
20
20
21
- use execute:: { Benchmark , Profiler } ;
21
+ use execute:: { BenchProcessor , Benchmark , BenchmarkName , ProfileProcessor , Profiler } ;
22
22
use sysroot:: Sysroot ;
23
23
24
24
#[ derive( Debug , Copy , Clone ) ]
@@ -254,52 +254,52 @@ fn bench(
254
254
let start = Instant :: now ( ) ;
255
255
let mut skipped = false ;
256
256
257
- let mut measure_and_record = |benchmark_name : & execute:: BenchmarkName ,
258
- benchmark_supports_stable : bool ,
259
- print_intro : & dyn Fn ( ) ,
260
- measure : & dyn Fn (
261
- & mut execute:: BenchProcessor ,
262
- ) -> Result < ( ) , anyhow:: Error > | {
263
- let is_fresh = rt. block_on ( conn. collector_start_step ( artifact_row_id, & benchmark_name. 0 ) ) ;
264
- if !is_fresh {
265
- skipped = true ;
266
- eprintln ! ( "skipping {} -- already benchmarked" , benchmark_name) ;
267
- return ;
268
- }
269
- let mut tx = rt. block_on ( conn. transaction ( ) ) ;
270
- rt. block_on (
271
- tx. conn ( )
272
- . record_benchmark ( & benchmark_name. 0 , Some ( benchmark_supports_stable) ) ,
273
- ) ;
274
- print_intro ( ) ;
275
-
276
- let mut processor = execute:: BenchProcessor :: new (
277
- rt,
278
- tx. conn ( ) ,
279
- benchmark_name,
280
- & artifact_id,
281
- artifact_row_id,
282
- is_self_profile,
283
- ) ;
284
- let result = measure ( & mut processor) ;
285
- if let Err ( s) = result {
286
- eprintln ! (
287
- "collector error: Failed to benchmark '{}', recorded: {:#}" ,
288
- benchmark_name, s
257
+ let mut measure_and_record =
258
+ |benchmark_name : & BenchmarkName ,
259
+ benchmark_supports_stable : bool ,
260
+ print_intro : & dyn Fn ( ) ,
261
+ measure : & dyn Fn ( & mut BenchProcessor ) -> anyhow:: Result < ( ) > | {
262
+ let is_fresh =
263
+ rt. block_on ( conn. collector_start_step ( artifact_row_id, & benchmark_name. 0 ) ) ;
264
+ if !is_fresh {
265
+ skipped = true ;
266
+ eprintln ! ( "skipping {} -- already benchmarked" , benchmark_name) ;
267
+ return ;
268
+ }
269
+ let mut tx = rt. block_on ( conn. transaction ( ) ) ;
270
+ rt. block_on (
271
+ tx. conn ( )
272
+ . record_benchmark ( & benchmark_name. 0 , Some ( benchmark_supports_stable) ) ,
289
273
) ;
290
- errors. incr ( ) ;
291
- rt. block_on ( tx. conn ( ) . record_error (
274
+ print_intro ( ) ;
275
+
276
+ let mut processor = BenchProcessor :: new (
277
+ rt,
278
+ tx. conn ( ) ,
279
+ benchmark_name,
280
+ & artifact_id,
292
281
artifact_row_id,
293
- & benchmark_name. 0 ,
294
- & format ! ( "{:?}" , s) ,
295
- ) ) ;
282
+ is_self_profile,
283
+ ) ;
284
+ let result = measure ( & mut processor) ;
285
+ if let Err ( s) = result {
286
+ eprintln ! (
287
+ "collector error: Failed to benchmark '{}', recorded: {:#}" ,
288
+ benchmark_name, s
289
+ ) ;
290
+ errors. incr ( ) ;
291
+ rt. block_on ( tx. conn ( ) . record_error (
292
+ artifact_row_id,
293
+ & benchmark_name. 0 ,
294
+ & format ! ( "{:?}" , s) ,
295
+ ) ) ;
296
+ } ;
297
+ rt. block_on (
298
+ tx. conn ( )
299
+ . collector_end_step ( artifact_row_id, & benchmark_name. 0 ) ,
300
+ ) ;
301
+ rt. block_on ( tx. commit ( ) ) . expect ( "committed" ) ;
296
302
} ;
297
- rt. block_on (
298
- tx. conn ( )
299
- . collector_end_step ( artifact_row_id, & benchmark_name. 0 ) ,
300
- ) ;
301
- rt. block_on ( tx. commit ( ) ) . expect ( "committed" ) ;
302
- } ;
303
303
304
304
// Normal benchmarks.
305
305
for ( nth_benchmark, benchmark) in benchmarks. iter ( ) . enumerate ( ) {
@@ -327,7 +327,7 @@ fn bench(
327
327
// The special rustc benchmark, if requested.
328
328
if bench_rustc {
329
329
measure_and_record (
330
- & execute :: BenchmarkName ( "rustc" . to_string ( ) ) ,
330
+ & BenchmarkName ( "rustc" . to_string ( ) ) ,
331
331
/* supports_stable */ false ,
332
332
& || eprintln ! ( "Special benchmark commencing (due to `--bench-rustc`)" ) ,
333
333
& |processor| processor. measure_rustc ( compiler) . context ( "measure rustc" ) ,
@@ -717,7 +717,7 @@ fn profile(
717
717
}
718
718
for ( i, benchmark) in benchmarks. iter ( ) . enumerate ( ) {
719
719
eprintln ! ( "{}" , n_normal_benchmarks_remaining( benchmarks. len( ) - i) ) ;
720
- let mut processor = execute :: ProfileProcessor :: new ( profiler, out_dir, id) ;
720
+ let mut processor = ProfileProcessor :: new ( profiler, out_dir, id) ;
721
721
let result = benchmark. measure (
722
722
& mut processor,
723
723
& profile_kinds,
0 commit comments