src/Pure/Tools/task_statistics.scala
changeset 64041 fd454d9e97c4
parent 57612 990ffb84489b
child 64045 c6160d0b0337
equal deleted inserted replaced
64040:84f283385091 64041:fd454d9e97c4
    15 import org.jfree.chart.renderer.xy.{XYBarRenderer, StandardXYBarPainter}
    15 import org.jfree.chart.renderer.xy.{XYBarRenderer, StandardXYBarPainter}
    16 
    16 
    17 
    17 
    18 object Task_Statistics
    18 object Task_Statistics
    19 {
    19 {
    20   def apply(name: String, tasks: List[Properties.T]): Task_Statistics =
    20   def apply(session_name: String, task_statistics: List[Properties.T]): Task_Statistics =
    21     new Task_Statistics(name, tasks)
    21     new Task_Statistics(session_name, task_statistics)
    22 
    22 
    23   def apply(info: Build.Log_Info): Task_Statistics =
    23   def apply(info: Build.Session_Log_Info): Task_Statistics =
    24     apply(info.name, info.tasks)
    24     apply(info.session_name, info.task_statistics)
    25 }
    25 }
    26 
    26 
    27 final class Task_Statistics private(val name: String, val tasks: List[Properties.T])
    27 final class Task_Statistics private(
       
    28   val session_name: String, val task_statistics: List[Properties.T])
    28 {
    29 {
    29   private val Task_Name = new Properties.String("task_name")
    30   private val Task_Name = new Properties.String("task_name")
    30   private val Run = new Properties.Int("run")
    31   private val Run = new Properties.Int("run")
    31 
    32 
    32   def chart(bins: Int = 100): JFreeChart =
    33   def chart(bins: Int = 100): JFreeChart =
    33   {
    34   {
    34     val values = new Array[Double](tasks.length)
    35     val values = new Array[Double](task_statistics.length)
    35     for ((Run(x), i) <- tasks.iterator.zipWithIndex)
    36     for ((Run(x), i) <- task_statistics.iterator.zipWithIndex)
    36       values(i) = java.lang.Math.log10((x max 1).toDouble / 1000000)
    37       values(i) = java.lang.Math.log10((x max 1).toDouble / 1000000)
    37 
    38 
    38     val data = new HistogramDataset
    39     val data = new HistogramDataset
    39     data.addSeries("tasks", values, bins)
    40     data.addSeries("tasks", values, bins)
    40 
    41 
    52 
    53 
    53   def show_frame(bins: Int = 100): Unit =
    54   def show_frame(bins: Int = 100): Unit =
    54     GUI_Thread.later {
    55     GUI_Thread.later {
    55       new Frame {
    56       new Frame {
    56         iconImage = GUI.isabelle_image()
    57         iconImage = GUI.isabelle_image()
    57         title = name
    58         title = session_name
    58         contents = Component.wrap(new ChartPanel(chart(bins)))
    59         contents = Component.wrap(new ChartPanel(chart(bins)))
    59         visible = true
    60         visible = true
    60       }
    61       }
    61     }
    62     }
    62 }
    63 }