@@ -27,8 +27,6 @@ pub struct Timings<'a, 'cfg> {
27
27
start : Instant ,
28
28
/// A rendered string of when compilation started.
29
29
start_str : String ,
30
- /// Some information to display about rustc.
31
- rustc_info : String ,
32
30
/// A summary of the root units.
33
31
///
34
32
/// Tuples of `(package_description, target_descrptions)`.
@@ -118,7 +116,6 @@ impl<'a, 'cfg> Timings<'a, 'cfg> {
118
116
} )
119
117
. collect ( ) ;
120
118
let start_str = humantime:: format_rfc3339_seconds ( SystemTime :: now ( ) ) . to_string ( ) ;
121
- let rustc_info = render_rustc_info ( bcx) ;
122
119
let profile = if bcx. build_config . release {
123
120
"release"
124
121
} else {
@@ -134,7 +131,6 @@ impl<'a, 'cfg> Timings<'a, 'cfg> {
134
131
report_json,
135
132
start : bcx. config . creation_time ( ) ,
136
133
start_str,
137
- rustc_info,
138
134
root_targets,
139
135
profile,
140
136
total_fresh : 0 ,
@@ -290,21 +286,21 @@ impl<'a, 'cfg> Timings<'a, 'cfg> {
290
286
}
291
287
292
288
/// Call this when all units are finished.
293
- pub fn finished ( & mut self ) -> CargoResult < ( ) > {
289
+ pub fn finished ( & mut self , bcx : & BuildContext < ' _ , ' _ > ) -> CargoResult < ( ) > {
294
290
if !self . enabled {
295
291
return Ok ( ( ) ) ;
296
292
}
297
293
self . mark_concurrency ( 0 , 0 , 0 ) ;
298
294
self . unit_times
299
295
. sort_unstable_by ( |a, b| a. start . partial_cmp ( & b. start ) . unwrap ( ) ) ;
300
296
if self . report_html {
301
- self . report_html ( ) ?;
297
+ self . report_html ( bcx ) ?;
302
298
}
303
299
Ok ( ( ) )
304
300
}
305
301
306
302
/// Save HTML report to disk.
307
- fn report_html ( & self ) -> CargoResult < ( ) > {
303
+ fn report_html ( & self , bcx : & BuildContext < ' _ , ' _ > ) -> CargoResult < ( ) > {
308
304
let duration = self . start . elapsed ( ) . as_secs ( ) as u32 + 1 ;
309
305
let timestamp = self . start_str . replace ( & [ '-' , ':' ] [ ..] , "" ) ;
310
306
let filename = format ! ( "cargo-timing-{}.html" , timestamp) ;
@@ -315,7 +311,7 @@ impl<'a, 'cfg> Timings<'a, 'cfg> {
315
311
. map ( |( name, _targets) | name. as_str ( ) )
316
312
. collect ( ) ;
317
313
f. write_all ( HTML_TMPL . replace ( "{ROOTS}" , & roots. join ( ", " ) ) . as_bytes ( ) ) ?;
318
- self . write_summary_table ( & mut f, duration) ?;
314
+ self . write_summary_table ( & mut f, duration, bcx ) ?;
319
315
f. write_all ( HTML_CANVAS . as_bytes ( ) ) ?;
320
316
self . write_unit_table ( & mut f) ?;
321
317
writeln ! (
@@ -350,7 +346,12 @@ impl<'a, 'cfg> Timings<'a, 'cfg> {
350
346
}
351
347
352
348
/// Render the summary table.
353
- fn write_summary_table ( & self , f : & mut impl Write , duration : u32 ) -> CargoResult < ( ) > {
349
+ fn write_summary_table (
350
+ & self ,
351
+ f : & mut impl Write ,
352
+ duration : u32 ,
353
+ bcx : & BuildContext < ' _ , ' _ > ,
354
+ ) -> CargoResult < ( ) > {
354
355
let targets: Vec < String > = self
355
356
. root_targets
356
357
. iter ( )
@@ -364,6 +365,7 @@ impl<'a, 'cfg> Timings<'a, 'cfg> {
364
365
} ;
365
366
let total_time = format ! ( "{}s{}" , duration, time_human) ;
366
367
let max_concurrency = self . concurrency . iter ( ) . map ( |c| c. active ) . max ( ) . unwrap ( ) ;
368
+ let rustc_info = render_rustc_info ( bcx) ;
367
369
write ! (
368
370
f,
369
371
r#"
@@ -384,7 +386,7 @@ impl<'a, 'cfg> Timings<'a, 'cfg> {
384
386
<td>Total units:</td><td>{}</td>
385
387
</tr>
386
388
<tr>
387
- <td>Max concurrency:</td><td>{}</td>
389
+ <td>Max concurrency:</td><td>{} (jobs={} ncpu={}) </td>
388
390
</tr>
389
391
<tr>
390
392
<td>Build start:</td><td>{}</td>
@@ -404,9 +406,11 @@ impl<'a, 'cfg> Timings<'a, 'cfg> {
404
406
self . total_dirty,
405
407
self . total_fresh + self . total_dirty,
406
408
max_concurrency,
409
+ bcx. build_config. jobs,
410
+ num_cpus:: get( ) ,
407
411
self . start_str,
408
412
total_time,
409
- self . rustc_info,
413
+ rustc_info,
410
414
) ?;
411
415
Ok ( ( ) )
412
416
}
0 commit comments