179 val KEYWORD2 = "keyword2" |
179 val KEYWORD2 = "keyword2" |
180 |
180 |
181 |
181 |
182 /* timing */ |
182 /* timing */ |
183 |
183 |
|
184 val Elapsed = new Properties.Double("elapsed") |
|
185 val CPU = new Properties.Double("cpu") |
|
186 val GC = new Properties.Double("gc") |
|
187 |
|
188 object Timing_Properties |
|
189 { |
|
190 def apply(timing: isabelle.Timing): Properties.T = |
|
191 Elapsed(timing.elapsed.seconds) ::: CPU(timing.cpu.seconds) ::: GC(timing.gc.seconds) |
|
192 def unapply(props: Properties.T): Option[isabelle.Timing] = |
|
193 (props, props, props) match { |
|
194 case (Elapsed(elapsed), CPU(cpu), GC(gc)) => |
|
195 Some(new isabelle.Timing(Time.seconds(elapsed), Time.seconds(cpu), Time.seconds(gc))) |
|
196 case _ => None |
|
197 } |
|
198 } |
|
199 |
184 val TIMING = "timing" |
200 val TIMING = "timing" |
185 val ELAPSED = "elapsed" |
|
186 val CPU = "cpu" |
|
187 val GC = "gc" |
|
188 |
201 |
189 object Timing |
202 object Timing |
190 { |
203 { |
191 def apply(timing: isabelle.Timing): Markup = |
204 def apply(timing: isabelle.Timing): Markup = Markup(TIMING, Timing_Properties(timing)) |
192 Markup(TIMING, List( |
|
193 (ELAPSED, Properties.Value.Double(timing.elapsed.seconds)), |
|
194 (CPU, Properties.Value.Double(timing.cpu.seconds)), |
|
195 (GC, Properties.Value.Double(timing.gc.seconds)))) |
|
196 def unapply(markup: Markup): Option[isabelle.Timing] = |
205 def unapply(markup: Markup): Option[isabelle.Timing] = |
197 markup match { |
206 markup match { |
198 case Markup(TIMING, List( |
207 case Markup(TIMING, Timing_Properties(timing)) => Some(timing) |
199 (ELAPSED, Properties.Value.Double(elapsed)), |
|
200 (CPU, Properties.Value.Double(cpu)), |
|
201 (GC, Properties.Value.Double(gc)))) => |
|
202 Some(new isabelle.Timing(Time.seconds(elapsed), Time.seconds(cpu), Time.seconds(gc))) |
|
203 case _ => None |
208 case _ => None |
204 } |
209 } |
205 } |
210 } |
206 |
211 |
207 |
212 |