45 Bash.process("exec \"$POLYML_EXE\" -q --use src/Pure/ML/ml_statistics.ML --eval " + |
45 Bash.process("exec \"$POLYML_EXE\" -q --use src/Pure/ML/ml_statistics.ML --eval " + |
46 Bash.string("ML_Statistics.monitor " + ML_Syntax.print_long(pid) + " " + |
46 Bash.string("ML_Statistics.monitor " + ML_Syntax.print_long(pid) + " " + |
47 ML_Syntax.print_double(delay.seconds)), |
47 ML_Syntax.print_double(delay.seconds)), |
48 cwd = Path.explode("~~").file) |
48 cwd = Path.explode("~~").file) |
49 .result(progress_stdout = progress_stdout, strict = false).check |
49 .result(progress_stdout = progress_stdout, strict = false).check |
|
50 } |
|
51 |
|
52 |
|
53 /* protocol handler */ |
|
54 |
|
55 class Protocol_Handler extends Session.Protocol_Handler |
|
56 { |
|
57 private var session: Session = null |
|
58 private var monitoring: Future[Unit] = Future.value(()) |
|
59 |
|
60 override def init(init_session: Session): Unit = synchronized |
|
61 { |
|
62 session = init_session |
|
63 } |
|
64 |
|
65 override def exit(): Unit = synchronized |
|
66 { |
|
67 session = null |
|
68 monitoring.cancel |
|
69 } |
|
70 |
|
71 private def consume(props: Properties.T): Unit = synchronized |
|
72 { |
|
73 if (session != null && session.session_options.bool("ML_statistics")) { |
|
74 session.runtime_statistics.post(Session.Runtime_Statistics(props)) |
|
75 } |
|
76 } |
|
77 |
|
78 private def ml_pid(msg: Prover.Protocol_Output): Boolean = synchronized |
|
79 { |
|
80 msg.properties match { |
|
81 case Markup.ML_Pid(pid) => |
|
82 monitoring = Future.thread("ML_statistics") { monitor(pid, consume = consume) } |
|
83 true |
|
84 case _ => false |
|
85 } |
|
86 } |
|
87 |
|
88 val functions = List(Markup.ML_Pid.name -> ml_pid) |
50 } |
89 } |
51 |
90 |
52 |
91 |
53 /* memory fields (mega bytes) */ |
92 /* memory fields (mega bytes) */ |
54 |
93 |