@@ -40,7 +40,7 @@ pub struct JobQueue<'a, 'cfg> {
40
40
is_release : bool ,
41
41
progress : Progress < ' cfg > ,
42
42
next_id : u32 ,
43
- timings : Timings < ' a , ' cfg > ,
43
+ timings : Option < Timings < ' a , ' cfg > > ,
44
44
}
45
45
46
46
pub struct JobState < ' a > {
@@ -133,7 +133,10 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
133
133
pub fn new ( bcx : & BuildContext < ' a , ' cfg > , root_units : & [ Unit < ' a > ] ) -> JobQueue < ' a , ' cfg > {
134
134
let ( tx, rx) = channel ( ) ;
135
135
let progress = Progress :: with_style ( "Building" , ProgressStyle :: Ratio , bcx. config ) ;
136
- let timings = Timings :: new ( bcx, root_units) ;
136
+ let timings = match bcx. config . cli_unstable ( ) . timings {
137
+ Some ( ..) => Some ( Timings :: new ( bcx, root_units) ) ,
138
+ None => None ,
139
+ } ;
137
140
JobQueue {
138
141
queue : DependencyQueue :: new ( ) ,
139
142
tx,
@@ -320,8 +323,9 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
320
323
// to the jobserver itself.
321
324
tokens. truncate ( self . active . len ( ) - 1 ) ;
322
325
323
- self . timings
324
- . mark_concurrency ( self . active . len ( ) , queue. len ( ) , self . queue . len ( ) ) ;
326
+ if let Some ( t) = & mut self . timings {
327
+ t. mark_concurrency ( self . active . len ( ) , queue. len ( ) , self . queue . len ( ) ) ;
328
+ }
325
329
326
330
// Drain all events at once to avoid displaying the progress bar
327
331
// unnecessarily.
@@ -340,7 +344,9 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
340
344
. config
341
345
. shell ( )
342
346
. verbose ( |c| c. status ( "Running" , & cmd) ) ?;
343
- self . timings . unit_start ( id, self . active [ & id] ) ;
347
+ if let Some ( t) = & mut self . timings {
348
+ t. unit_start ( id, self . active [ & id] ) ;
349
+ }
344
350
}
345
351
Message :: BuildPlanMsg ( module_name, cmd, filenames) => {
346
352
plan. update ( & module_name, & cmd, & filenames) ?;
@@ -432,7 +438,9 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
432
438
if !cx. bcx . build_config . build_plan {
433
439
cx. bcx . config . shell ( ) . status ( "Finished" , message) ?;
434
440
}
435
- self . timings . finished ( ) ?;
441
+ if let Some ( t) = & mut self . timings {
442
+ t. finished ( ) ?;
443
+ }
436
444
Ok ( ( ) )
437
445
} else {
438
446
debug ! ( "queue: {:#?}" , self . queue) ;
@@ -528,11 +536,15 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
528
536
529
537
match fresh {
530
538
Freshness :: Fresh => {
531
- self . timings . add_fresh ( ) ;
539
+ if let Some ( t) = & mut self . timings {
540
+ t. add_fresh ( ) ;
541
+ }
532
542
doit ( )
533
543
}
534
544
Freshness :: Dirty => {
535
- self . timings . add_dirty ( ) ;
545
+ if let Some ( t) = & mut self . timings {
546
+ t. add_dirty ( ) ;
547
+ }
536
548
scope. spawn ( move |_| doit ( ) ) ;
537
549
}
538
550
}
@@ -579,9 +591,11 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
579
591
self . emit_warnings ( None , unit, cx) ?;
580
592
}
581
593
let unlocked = self . queue . finish ( unit, & artifact) ;
582
- match artifact {
583
- Artifact :: All => self . timings . unit_finished ( id, unlocked) ,
584
- Artifact :: Metadata => self . timings . unit_rmeta_finished ( id, unlocked) ,
594
+ if let Some ( t) = & mut self . timings {
595
+ match artifact {
596
+ Artifact :: All => t. unit_finished ( id, unlocked) ,
597
+ Artifact :: Metadata => t. unit_rmeta_finished ( id, unlocked) ,
598
+ }
585
599
}
586
600
Ok ( ( ) )
587
601
}
0 commit comments