diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/console/StatMemNode.java | |
| download | worlds.jar-main.tar.xz worlds.jar-main.zip | |
Diffstat (limited to 'NET/worlds/console/StatMemNode.java')
| -rw-r--r-- | NET/worlds/console/StatMemNode.java | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/NET/worlds/console/StatMemNode.java b/NET/worlds/console/StatMemNode.java new file mode 100644 index 0000000..8791053 --- /dev/null +++ b/NET/worlds/console/StatMemNode.java @@ -0,0 +1,151 @@ +/* */ package NET.worlds.console; +/* */ +/* */ import NET.worlds.core.Std; +/* */ import java.awt.List; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class StatMemNode +/* */ extends StatMan +/* */ implements MainCallback +/* */ { +/* 25 */ private static StatMemNode _singleInstance = new StatMemNode(); +/* */ private int _lastTime; +/* */ +/* 28 */ public static StatMemNode getNode() { return _singleInstance; } +/* */ +/* */ private static final int TITLE = 0; +/* */ private StatMemNode() { +/* 32 */ StatisticsRoot.getNode().addChild(this); +/* */ } +/* */ +/* */ private static final int BLANK1 = 1; +/* */ private static final int TOTMEM = 2; +/* */ static +/* */ { +/* 39 */ nativeInit(); +/* */ } +/* */ +/* */ public String toString() +/* */ { +/* 44 */ return "System Memory"; +/* */ } +/* */ +/* */ +/* */ +/* */ synchronized void grabList(List list) +/* */ { +/* 51 */ super.grabList(list); +/* 52 */ Main.register(this); +/* */ } +/* */ +/* */ +/* */ synchronized void releaseList(boolean terminalCallback) +/* */ { +/* 58 */ if (!terminalCallback) { +/* 59 */ Main.unregister(this); +/* */ } +/* 61 */ super.releaseList(terminalCallback); +/* */ } +/* */ +/* */ +/* */ public synchronized void mainCallback() +/* */ { +/* 67 */ int thisTime = Std.getFastTime(); +/* 68 */ if (thisTime - this._lastTime > 1000) { +/* 69 */ updateList(); +/* 70 */ this._lastTime = thisTime; +/* */ } +/* */ } +/* */ +/* */ public int getVMAvail() { +/* 75 */ updateMemoryStatus(); +/* 76 */ return this._availPageMem; +/* */ } +/* */ +/* */ +/* */ private static final int FREEMEM = 3; +/* */ +/* */ private static final int BLANK2 = 4; +/* */ +/* */ private static final int TOTPHYSMEM = 5; +/* */ private static final int AVAILPHYSMEM = 6; +/* */ private static final int SWAPUSED = 7; +/* */ private static final int AVAILVIRTMEM = 8; +/* */ private static final int TOTUSED = 9; +/* */ private long _lastTotMem; +/* */ public int _totPhysMem; +/* */ public int _availPhysMem; +/* */ public int _totPageMem; +/* */ public int _availPageMem; +/* */ void createList() +/* */ { +/* 96 */ this._grabbedList.add("System Memory Stats", 0); +/* 97 */ this._grabbedList.add("", 1); +/* 98 */ this._lastTotMem = Runtime.getRuntime().totalMemory(); +/* 99 */ this._grabbedList.add("Total " + Std.getProductName() + +/* 100 */ " Memory Available: " + this._lastTotMem + " bytes", 2); +/* */ +/* 102 */ updateMemoryStatus(); +/* */ +/* 104 */ this._grabbedList.add(" Free " + Std.getProductName() + +/* 105 */ " Memory Available: " + Runtime.getRuntime().freeMemory() + +/* 106 */ " bytes", 3); +/* 107 */ this._grabbedList.add("", 4); +/* 108 */ this._grabbedList.add("Total System Physical Memory: " + this._totPhysMem + +/* 109 */ " bytes", 5); +/* 110 */ this._grabbedList.add("Available System Physical Memory: " + +/* 111 */ this._availPhysMem + " bytes", 6); +/* 112 */ this._grabbedList.add("Total System Swapfile Usage: " + ( +/* 113 */ this._totPageMem - this._availPageMem) + " bytes", 7); +/* 114 */ this._grabbedList.add("Available Virtual Memory: " + this._availPageMem + +/* 115 */ " bytes", 8); +/* */ } +/* */ +/* */ void updateList() +/* */ { +/* 120 */ long thisTotMem = Runtime.getRuntime().totalMemory(); +/* 121 */ if (thisTotMem != this._lastTotMem) { +/* 122 */ this._lastTotMem = thisTotMem; +/* 123 */ this._grabbedList.replaceItem("Total " + Std.getProductName() + +/* 124 */ " Memory Available: " + this._lastTotMem + " bytes", 2); +/* */ } +/* */ +/* 127 */ updateMemoryStatus(); +/* */ +/* 129 */ this._grabbedList.replaceItem(" Free " + Std.getProductName() + +/* 130 */ " Memory Available: " + Runtime.getRuntime().freeMemory() + +/* 131 */ " bytes", 3); +/* 132 */ this._grabbedList.replaceItem("Total System Physical Memory: " + this._totPhysMem + +/* 133 */ " bytes", 5); +/* 134 */ this._grabbedList.replaceItem("Available System Physical Memory: " + +/* 135 */ this._availPhysMem + " bytes", 6); +/* 136 */ this._grabbedList.replaceItem("Total System Swapfile Usage: " + ( +/* 137 */ this._totPageMem - this._availPageMem) + " bytes", 7); +/* 138 */ this._grabbedList.replaceItem("Available Virtual Memory: " + this._availPageMem + +/* 139 */ " bytes", 8); +/* */ } +/* */ +/* */ public static native void nativeInit(); +/* */ +/* */ public native void updateMemoryStatus(); +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\StatMemNode.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |