src/Pure/Admin/build_status.scala
changeset 77510 f5d6cd98b16a
parent 77381 a86e346b20d8
child 77582 93f4b9164b9f
equal deleted inserted replaced
77509:3bc49507bae5 77510:f5d6cd98b16a
    54 
    54 
    55   def build_status(options: Options,
    55   def build_status(options: Options,
    56     progress: Progress = new Progress,
    56     progress: Progress = new Progress,
    57     profiles: List[Profile] = default_profiles,
    57     profiles: List[Profile] = default_profiles,
    58     only_sessions: Set[String] = Set.empty,
    58     only_sessions: Set[String] = Set.empty,
    59     verbose: Boolean = false,
       
    60     target_dir: Path = default_target_dir,
    59     target_dir: Path = default_target_dir,
    61     ml_statistics: Boolean = false,
    60     ml_statistics: Boolean = false,
    62     image_size: (Int, Int) = default_image_size
    61     image_size: (Int, Int) = default_image_size
    63   ): Unit = {
    62   ): Unit = {
    64     val ml_statistics_domain =
    63     val ml_statistics_domain =
    65       Iterator(ML_Statistics.heap_fields, ML_Statistics.program_fields, ML_Statistics.tasks_fields,
    64       Iterator(ML_Statistics.heap_fields, ML_Statistics.program_fields, ML_Statistics.tasks_fields,
    66         ML_Statistics.workers_fields).flatMap(_._2).toSet
    65         ML_Statistics.workers_fields).flatMap(_._2).toSet
    67 
    66 
    68     val data =
    67     val data =
    69       read_data(options, progress = progress, profiles = profiles,
    68       read_data(options, progress = progress, profiles = profiles, only_sessions = only_sessions,
    70         only_sessions = only_sessions, verbose = verbose,
       
    71         ml_statistics = ml_statistics, ml_statistics_domain = ml_statistics_domain)
    69         ml_statistics = ml_statistics, ml_statistics_domain = ml_statistics_domain)
    72 
    70 
    73     present_data(data, progress = progress, target_dir = target_dir, image_size = image_size)
    71     present_data(data, progress = progress, target_dir = target_dir, image_size = image_size)
    74   }
    72   }
    75 
    73 
   211   def read_data(options: Options,
   209   def read_data(options: Options,
   212     progress: Progress = new Progress,
   210     progress: Progress = new Progress,
   213     profiles: List[Profile] = default_profiles,
   211     profiles: List[Profile] = default_profiles,
   214     only_sessions: Set[String] = Set.empty,
   212     only_sessions: Set[String] = Set.empty,
   215     ml_statistics: Boolean = false,
   213     ml_statistics: Boolean = false,
   216     ml_statistics_domain: String => Boolean = _ => true,
   214     ml_statistics_domain: String => Boolean = _ => true
   217     verbose: Boolean = false
       
   218   ): Data = {
   215   ): Data = {
   219     val date = Date.now()
   216     val date = Date.now()
   220     var data_hosts = Map.empty[String, Set[String]]
   217     var data_hosts = Map.empty[String, Set[String]]
   221     var data_stretch = Map.empty[String, Double]
   218     var data_stretch = Map.empty[String, Double]
   222     var data_entries = Map.empty[String, Map[String, Session]]
   219     var data_entries = Map.empty[String, Map[String, Session]]
   256           (if (ml_statistics) List(Build_Log.Data.ml_statistics) else Nil)
   253           (if (ml_statistics) List(Build_Log.Data.ml_statistics) else Nil)
   257 
   254 
   258         val Threads_Option = """threads\s*=\s*(\d+)""".r
   255         val Threads_Option = """threads\s*=\s*(\d+)""".r
   259 
   256 
   260         val sql = profile.select(options, columns, only_sessions)
   257         val sql = profile.select(options, columns, only_sessions)
   261         progress.echo_if(verbose, sql)
   258         progress.echo(sql, verbose = true)
   262 
   259 
   263         db.using_statement(sql) { stmt =>
   260         db.using_statement(sql) { stmt =>
   264           val res = stmt.execute_query()
   261           val res = stmt.execute_query()
   265           while (res.next()) {
   262           while (res.next()) {
   266             val session_name = res.string(Build_Log.Data.session_name)
   263             val session_name = res.string(Build_Log.Data.session_name)
   618           "v" -> (_ => verbose = true))
   615           "v" -> (_ => verbose = true))
   619 
   616 
   620         val more_args = getopts(args)
   617         val more_args = getopts(args)
   621         if (more_args.nonEmpty) getopts.usage()
   618         if (more_args.nonEmpty) getopts.usage()
   622 
   619 
   623         val progress = new Console_Progress
   620         val progress = new Console_Progress(verbose = verbose)
   624 
   621 
   625         build_status(options, progress = progress, only_sessions = only_sessions, verbose = verbose,
   622         build_status(options, progress = progress, only_sessions = only_sessions,
   626           target_dir = target_dir, ml_statistics = ml_statistics, image_size = image_size)
   623           target_dir = target_dir, ml_statistics = ml_statistics, image_size = image_size)
   627       })
   624       })
   628 }
   625 }