monitor AI remotes

This commit is contained in:
Thibault Duplessis 2013-10-01 22:37:11 +02:00
parent c288f85e9a
commit 397d29e337
5 changed files with 29 additions and 18 deletions

View file

@ -12,16 +12,16 @@ private[app] final class AiStresser(env: lila.ai.Env, system: ActorSystem) {
def apply {
(1 to 10) foreach { i
(1 to 20) foreach { i
system.scheduler.scheduleOnce((i * 97) millis) {
play(i % 8 + 1, true)
}
}
(1 to 3) foreach { i
system.scheduler.scheduleOnce((i * 131) millis) {
analyse(true)
}
}
// (1 to 3) foreach { i
// system.scheduler.scheduleOnce((i * 131) millis) {
// analyse(true)
// }
// }
}

View file

@ -14,7 +14,7 @@ object Monitor extends LilaController {
private def env = Env.monitor
def index = Action {
Ok(views.html.monitor.monitor())
Ok(views.html.monitor.monitor(Env.ai.nbStockfishRemotes))
}
def websocket = Socket[JsValue] { implicit ctx

View file

@ -1,4 +1,4 @@
@()
@(nbAi: Int)
@layout("Lichess monitor") {
<a class="back" href="@routes.Lobby.home">&lt; back to lichess</a>
@ -10,6 +10,7 @@
<a href="#" id="shutdown">Emergency reactor shutdown - DON'T CLICK</a>
</div>
<script>
var nbAi = @nbAi;
window.document.getElementById("shutdown").onclick = function() {
alert("Was worth trying. I guess.");
};

View file

@ -78,6 +78,8 @@ final class Env(
queue = stockfishQueue,
config = stockfishConfig)
def nbStockfishRemotes = StockfishRemotes.size
private lazy val stockfishQueue = system.actorOf(Props(
new stockfish.Queue(stockfishConfig, system)
) withDispatcher StockfishQueueDispatcher, name = StockfishQueueName)

View file

@ -48,7 +48,7 @@
1500,
"ease-in"
);
if (val > (this.threshold * this.maxVal)) {
if (parseInt(val) + "" == "NaN" || val > (this.threshold * this.maxVal)) {
this.elt.className = "monitor alert";
} else {
this.elt.className = "monitor";
@ -151,25 +151,28 @@
container : container
});
app.ai = new SpeedOMeter({
name : "AI LOAD",
app.mps = new SpeedOMeter({
name : "MOVES",
maxVal : 100,
threshold: 0.8,
container : container
});
app.ais = [];
for (i=1;i<=nbAi;i++) {
app.ais.push(new SpeedOMeter({
name : "AI " + i + " LOAD",
maxVal : 100,
threshold: 0.8,
container : container
}));
}
// app.lag = new SpeedOMeter({
// name : "LAG",
// maxVal : 200,
// container : container
// });
app.mps = new SpeedOMeter({
name : "MOVES",
maxVal : 100,
container : container
});
function setStatus(s) {
window.document.body.className = s;
}
@ -188,6 +191,11 @@
if (d.length == 2) {
if (typeof app[d[1]] != "undefined") {
app[d[1]].update(d[0]);
} else if (d[1] == 'ai') {
var ais = d[0].split(',');
for (i=0;i<ais.length;i++) {
app.ais[i].update(ais[i]);
}
}
}
}