Add some debug infos
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
8f1fa7c2d6
Commit
c8fb4ffde1
@ -28,16 +28,28 @@ public class RamUsage {
|
||||
|
||||
private File meminfo = new File("/proc/meminfo");
|
||||
|
||||
private double usageSelf = 0D;
|
||||
private double usage = 0D;
|
||||
private double load = 0D;
|
||||
|
||||
public static void init() {
|
||||
}
|
||||
|
||||
static {
|
||||
Thread thread = new Thread(() -> {
|
||||
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();
|
||||
load = _getLoad();
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren