// DESCRIPTION: number of processors reported by Poly/ML

object Tool extends isabelle.Isabelle_Tool.Body {
  import isabelle._

  def apply(args: List[String]): Unit =
  {
    val ml_text =
      "TextIO.output (TextIO.stdErr, Int.toString (Option.getOpt (Thread.Thread.numPhysicalProcessors (), 0)))"

    val options = Options.init()
  
    val result =
      ML_Process(options, sessions_structure = null, store = null,
        raw_ml_system = true, eval_main = ml_text).result().check
  
    Output.writeln(result.err, stdout = true)
  }
}
