Warning: session_start(): open(/var/lib/php/sessions/sess_cssdua1k62at4ujobdhlg882rt, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
// only from machines that run #1020927 with postToServer=true
cmodule ServerLoadsTrayIcon > DynPrintLog {
int size = goodSystemTrayIconSize().x; // icon width+height
transient double expiryTime = 10.0;
transient TrayIcon trayIcon;
transient Map loads = expiringMap(expiryTime);
transient LS colors = ll("FF0000", "00FF00", "0000FF");
srecord Load(int cores, double percent) {}
start {
ownResource(tempTrayIcon(trayIcon = installTrayIcon(whiteImage(size, size), "Server CPUs", rThread dm_activateOSAndModule)));
doEvery(1.0, r updateIcon);
dm_onRemoteSystemStatusPosted((computerID, msg) -> {
LS l = regexpFirstGroupsIC([[System CPU: (\d+)% \((\d+) core]], msg);
if (l == null) ret;
status.put(computerID, new Load(parseInt(second(l)), parseInt(first(l))));
});
}
void updateIcon enter {
Map map = cloneMap(loads);
int cores = 0;
for (Load l : values(map)) cores += l.cores;
BufferedImage img;
if (cores == 0) img = whiteImage(1, 1);
else {
img = whiteImage(cores, size);
int x = 0, i = 0;
// go alphabetical in computer IDs
for (Load l : valuesSortedByKeys(map)) {
Color color = colorFromHex(colors.get((i++) % l(colors)));
int h = iround(l.percent/l.cores/100*size);
fillRect(img, x, size-h, l.cores, h, color);
x += l.cores;
}
}
trayIcon.setImage(resizeImage(img, size, size));
}
}