SteamWar/BauSystem2.0
Archiviert
12
0

Add some debug infos

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-06-17 11:47:12 +02:00
Ursprung 8f1fa7c2d6
Commit c8fb4ffde1

Datei anzeigen

@ -28,16 +28,28 @@ public class RamUsage {
private File meminfo = new File("/proc/meminfo"); private File meminfo = new File("/proc/meminfo");
private double usageSelf = 0D;
private double usage = 0D; private double usage = 0D;
private double load = 0D; private double load = 0D;
public static void init() {
}
static { static {
Thread thread = new Thread(() -> { Thread thread = new Thread(() -> {
while (true) { while (true) {
long maxMemory = Runtime.getRuntime().maxMemory();
long totalMemory = Runtime.getRuntime().totalMemory();
long freeMemory = Runtime.getRuntime().freeMemory();
long usedMemory = totalMemory - freeMemory;
usageSelf = usedMemory / (double) totalMemory;
double usageSelfByMax = usedMemory / (double) maxMemory;
System.out.println("Self: " + usageSelf + "/" + usageSelfByMax + /* " " + maxMemory + " " + totalMemory + " " + freeMemory + " " + usedMemory + */ " Ram: " + usage + " CPU: " + load);
usage = _getUsage(); usage = _getUsage();
load = _getLoad(); load = _getLoad();
try { try {
Thread.sleep(1000); Thread.sleep(2000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }