src/Pure/ML/ml_statistics.scala
changeset 77121 ceee2a01322e
parent 77119 34a6b8bd7abd
child 77218 86217697863c
equal deleted inserted replaced
77120:8c14be9beb58 77121:ceee2a01322e
   106     override val functions: Session.Protocol_Functions =
   106     override val functions: Session.Protocol_Functions =
   107       List(Markup.ML_Statistics.name -> ml_statistics)
   107       List(Markup.ML_Statistics.name -> ml_statistics)
   108   }
   108   }
   109 
   109 
   110 
   110 
   111   /* memory fields (mega bytes) */
   111   /* memory fields */
   112 
       
   113   def mem_print(x: Long): Option[String] =
       
   114     if (x == 0L) None else Some(x.toString + " M")
       
   115 
       
   116   def mem_scale(x: Long): Long = x / 1024 / 1024
       
   117 
   112 
   118   val scale_MiB: Double = 1.0 / 1024 / 1024
   113   val scale_MiB: Double = 1.0 / 1024 / 1024
   119 
   114 
   120   val CODE_SIZE = "size_code"
   115   val CODE_SIZE = "size_code"
   121   val STACK_SIZE = "size_stacks"
   116   val STACK_SIZE = "size_stacks"
   233           SortedMap.empty[String, Double] ++
   228           SortedMap.empty[String, Double] ++
   234             (for {
   229             (for {
   235               (x, y) <- props.iterator ++ speeds.iterator
   230               (x, y) <- props.iterator ++ speeds.iterator
   236               if x != Now.name && domain(x)
   231               if x != Now.name && domain(x)
   237               z = java.lang.Double.parseDouble(y) if z != 0.0
   232               z = java.lang.Double.parseDouble(y) if z != 0.0
   238             } yield { (x.intern, field_scale(x, z)) })
   233             } yield { (x.intern, z) })
   239 
   234 
   240         result += ML_Statistics.Entry(time, data)
   235         result += ML_Statistics.Entry(time, data)
   241       }
   236       }
   242       result.toList
   237       result.toList
   243     }
   238     }
   283 
   278 
   284   def update_data(data: XYSeriesCollection, selected_fields: List[String]): Unit = {
   279   def update_data(data: XYSeriesCollection, selected_fields: List[String]): Unit = {
   285     data.removeAllSeries()
   280     data.removeAllSeries()
   286     for (field <- selected_fields) {
   281     for (field <- selected_fields) {
   287       val series = new XYSeries(field)
   282       val series = new XYSeries(field)
   288       content.foreach(e => series.add(e.time, e.get(field)))
   283       content.foreach(e => series.add(e.time, ML_Statistics.field_scale(field, e.get(field))))
   289       data.addSeries(series)
   284       data.addSeries(series)
   290     }
   285     }
   291   }
   286   }
   292 
   287 
   293   def chart(title: String, selected_fields: List[String]): JFreeChart = {
   288   def chart(title: String, selected_fields: List[String]): JFreeChart = {