src/Pure/PIDE/document_status.scala
changeset 69864 d594997cdcf4
parent 69863 9532d5b2e932
child 70653 f7c5b30fc432
equal deleted inserted replaced
69863:9532d5b2e932 69864:d594997cdcf4
   187 
   187 
   188     def make(
   188     def make(
   189       state: Document.State,
   189       state: Document.State,
   190       version: Document.Version,
   190       version: Document.Version,
   191       commands: Iterable[Command],
   191       commands: Iterable[Command],
   192       threshold: Double): Overall_Timing =
   192       threshold: Double = 0.0): Overall_Timing =
   193     {
   193     {
   194       var total = 0.0
   194       var total = 0.0
   195       var command_timings = Map.empty[Command, Double]
   195       var command_timings = Map.empty[Command, Double]
   196       for {
   196       for {
   197         command <- commands.iterator
   197         command <- commands.iterator
   201           (0.0 /: st.status)({
   201           (0.0 /: st.status)({
   202             case (timing, Markup.Timing(t)) => timing + t.elapsed.seconds
   202             case (timing, Markup.Timing(t)) => timing + t.elapsed.seconds
   203             case (timing, _) => timing
   203             case (timing, _) => timing
   204           })
   204           })
   205         total += command_timing
   205         total += command_timing
   206         if (command_timing >= threshold) command_timings += (command -> command_timing)
   206         if (command_timing > 0.0 && command_timing >= threshold) {
       
   207           command_timings += (command -> command_timing)
       
   208         }
   207       }
   209       }
   208       Overall_Timing(total, command_timings)
   210       Overall_Timing(total, command_timings)
   209     }
   211     }
   210   }
   212   }
   211 
   213 
   212   sealed case class Overall_Timing(total: Double, command_timings: Map[Command, Double])
   214   sealed case class Overall_Timing(total: Double, command_timings: Map[Command, Double])
       
   215   {
       
   216     def command_timing(command: Command): Double =
       
   217       command_timings.getOrElse(command, 0.0)
       
   218   }
   213 
   219 
   214 
   220 
   215   /* nodes status */
   221   /* nodes status */
   216 
   222 
   217   object Overall_Node_Status extends Enumeration
   223   object Overall_Node_Status extends Enumeration