message: Make timings optional.
diff: @@ -40,7 +40,7 @@ pub struct JobQueue<'a, 'cfg> {
  is_release: bool,
  progress: Progress<'cfg>,
  next_id: u32,
  - timings: Timings<'a, 'cfg>,
  + timings: Option<Timings<'a, 'cfg>>,
  }
  pub struct JobState<'a> {
  @@ -133,7 +133,10 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
  pub fn new(bcx: &BuildContext<'a, 'cfg>, root_units: &[Unit<'a>]) -> JobQueue<'a, 'cfg> {
  let (tx, rx) = channel();
  let progress = Progress::with_style("Building", ProgressStyle::Ratio, bcx.config);
  - let timings = Timings::new(bcx, root_units);
  + let timings = match bcx.config.cli_unstable().timings {
  + Some(..) => Some(Timings::new(bcx, root_units)),
  + None => None,
  + };
  JobQueue {
  queue: DependencyQueue::new(),
  tx,
  @@ -320,8 +323,9 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
  // to the jobserver itself.
  tokens.truncate(self.active.len() - 1);
  - self.timings
  - .mark_concurrency(self.active.len(), queue.len(), self.queue.len());
  + if let Some(t) = &mut self.timings {
  + t.mark_concurrency(self.active.len(), queue.len(), self.queue.len());
  + }
  // Drain all events at once to avoid displaying the progress bar
  // unnecessarily.
  @@ -340,7 +344,9 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
  .config
  .shell()
  .verbose(|c| c.status("Running", &cmd))?;
  - self.timings.unit_start(id, self.active[&id]);
  + if let Some(t) = &mut self.timings {
  + t.unit_start(id, self.active[&id]);
  + }
  }
  Message::BuildPlanMsg(module_name, cmd, filenames) => {
  plan.update(&module_name, &cmd, &filenames)?;
  @@ -432,7 +438,9 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
  if !cx.bcx.build_config.build_plan {
  cx.bcx.config.shell().status("Finished", message)?;
  }
  - self.timings.finished()?;
  + if let Some(t) = &mut self.timings {
  + t.finished()?;
  + }
  Ok(())
  } else {
  debug!("queue: {:#?}", self.queue);
  @@ -528,11 +536,15 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
  match fresh {
  Freshness::Fresh => {
  - self.timings.add_fresh();
  + if let Some(t) = &mut self.timings {
  + t.add_fresh();
  + }
  doit()
  }
  Freshness::Dirty => {
  - self.timings.add_dirty();
  + if let Some(t) = &mut self.timings {
  + t.add_dirty();
  + }
  scope.spawn(move |_| doit());
  }
  }
  @@ -579,9 +591,11 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
  self.emit_warnings(None, unit, cx)?;
  }
  let unlocked = self.queue.finish(unit, &artifact);
  + if let Some(t) = &mut self.timings {
  match artifact {
  - Artifact::All => self.timings.unit_finished(id, unlocked),
  - Artifact::Metadata => self.timings.unit_rmeta_finished(id, unlocked),
  + Artifact::All => t.unit_finished(id, unlocked),
  + Artifact::Metadata => t.unit_rmeta_finished(id, unlocked),
  + }
  }
  Ok(())
  }
  