src/Pure/Build/build_schedule.scala
changeset 79897 661fb7db57ca
parent 79896 2c9c5ae99a09
child 79898 db9a45e05b5b
equal deleted inserted replaced
79896:2c9c5ae99a09 79897:661fb7db57ca
   500   ) {
   500   ) {
   501     def next_serial: Long = Build_Process.State.inc_serial(serial)
   501     def next_serial: Long = Build_Process.State.inc_serial(serial)
   502 
   502 
   503     def end: Date =
   503     def end: Date =
   504       if (graph.is_empty) start
   504       if (graph.is_empty) start
   505       else graph.maximals.map(graph.get_node).map(_.end).maxBy(_.unix_epoch)
   505       else graph.maximals.map(graph.get_node).map(_.end).max(Date.Ordering)
   506 
   506 
   507     def duration: Time = end - start
   507     def duration: Time = end - start
   508     def message: String = "Estimated " + duration.message_hms + " build time with " + generator
   508     def message: String = "Estimated " + duration.message_hms + " build time with " + generator
   509 
   509 
   510     def deviation(other: Schedule): Time = Time.ms((end - other.end).ms.abs)
   510     def deviation(other: Schedule): Time = Time.ms((end - other.end).ms.abs)
   534       val start1 = Date.now()
   534       val start1 = Date.now()
   535 
   535 
   536       def shift_elapsed(graph: Schedule.Graph, name: String): Schedule.Graph =
   536       def shift_elapsed(graph: Schedule.Graph, name: String): Schedule.Graph =
   537         graph.map_node(name, { node =>
   537         graph.map_node(name, { node =>
   538           val elapsed = start1 - state.running(name).start_date
   538           val elapsed = start1 - state.running(name).start_date
   539           node.copy(duration = node.duration - elapsed)
   539           node.copy(duration = (node.duration - elapsed).max(Time.zero))
   540         })
   540         })
   541 
   541 
   542       def shift_starts(graph: Schedule.Graph, name: String): Schedule.Graph =
   542       def shift_starts(graph: Schedule.Graph, name: String): Schedule.Graph =
   543         graph.map_node(name, { node =>
   543         graph.map_node(name, { node =>
   544           val starts = start1 :: graph.imm_preds(node.job_name).toList.map(graph.get_node(_).end)
   544           val starts = start1 :: graph.imm_preds(node.job_name).toList.map(graph.get_node(_).end)