diff options
Diffstat (limited to 'NET/worlds/console/StatMemNode.java')
| -rw-r--r-- | NET/worlds/console/StatMemNode.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/NET/worlds/console/StatMemNode.java b/NET/worlds/console/StatMemNode.java index b5031dd..903bf0d 100644 --- a/NET/worlds/console/StatMemNode.java +++ b/NET/worlds/console/StatMemNode.java @@ -5,6 +5,8 @@ import java.awt.List; public class StatMemNode extends StatMan implements MainCallback { private static StatMemNode _singleInstance = new StatMemNode(); + private static final com.sun.management.OperatingSystemMXBean operatingSystemMXBean = + (com.sun.management.OperatingSystemMXBean) java.lang.management.ManagementFactory.getOperatingSystemMXBean(); private int _lastTime; private static final int TITLE = 0; private static final int BLANK1 = 1; @@ -103,11 +105,9 @@ public class StatMemNode extends StatMan implements MainCallback { } public void updateMemoryStatus() { - Runtime runtime = Runtime.getRuntime(); - - this._totPhysMem = (int)runtime.maxMemory(); - this._availPhysMem = (int)runtime.freeMemory(); - this._totPageMem = (int)runtime.totalMemory(); - this._availPageMem = (int)(runtime.maxMemory() - (runtime.totalMemory() - runtime.freeMemory())); + this._totPhysMem = (int)operatingSystemMXBean.getTotalPhysicalMemorySize(); + this._availPhysMem = (int)operatingSystemMXBean.getFreePhysicalMemorySize(); + this._totPageMem = (int)operatingSystemMXBean.getTotalSwapSpaceSize(); + this._availPageMem = (int)operatingSystemMXBean.getFreeSwapSpaceSize(); } } |