@@ -18,7 +18,7 @@ use tokio::runtime::Runtime;
1818mod execute;
1919mod sysroot;
2020
21- use execute:: { Benchmark , Profiler } ;
21+ use execute:: { BenchProcessor , Benchmark , BenchmarkName , ProfileProcessor , Profiler } ;
2222use sysroot:: Sysroot ;
2323
2424#[ derive( Debug , Copy , Clone ) ]
@@ -254,52 +254,52 @@ fn bench(
254254 let start = Instant :: now ( ) ;
255255 let mut skipped = false ;
256256
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) ) ,
289273 ) ;
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,
292281 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" ) ;
296302 } ;
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- } ;
303303
304304 // Normal benchmarks.
305305 for ( nth_benchmark, benchmark) in benchmarks. iter ( ) . enumerate ( ) {
@@ -327,7 +327,7 @@ fn bench(
327327 // The special rustc benchmark, if requested.
328328 if bench_rustc {
329329 measure_and_record (
330- & execute :: BenchmarkName ( "rustc" . to_string ( ) ) ,
330+ & BenchmarkName ( "rustc" . to_string ( ) ) ,
331331 /* supports_stable */ false ,
332332 & || eprintln ! ( "Special benchmark commencing (due to `--bench-rustc`)" ) ,
333333 & |processor| processor. measure_rustc ( compiler) . context ( "measure rustc" ) ,
@@ -717,7 +717,7 @@ fn profile(
717717 }
718718 for ( i, benchmark) in benchmarks. iter ( ) . enumerate ( ) {
719719 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) ;
721721 let result = benchmark. measure (
722722 & mut processor,
723723 & profile_kinds,
0 commit comments