summaryrefslogtreecommitdiff
path: root/NET/worlds/core/SystemInfo.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/core/SystemInfo.java
downloadworlds.jar-main.tar.xz
worlds.jar-main.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/core/SystemInfo.java')
-rw-r--r--NET/worlds/core/SystemInfo.java161
1 files changed, 161 insertions, 0 deletions
diff --git a/NET/worlds/core/SystemInfo.java b/NET/worlds/core/SystemInfo.java
new file mode 100644
index 0000000..dc77784
--- /dev/null
+++ b/NET/worlds/core/SystemInfo.java
@@ -0,0 +1,161 @@
+/* */ package NET.worlds.core;
+/* */
+/* */ import NET.worlds.console.Main;
+/* */ import NET.worlds.console.MainCallback;
+/* */ import NET.worlds.console.MainTerminalCallback;
+/* */ import java.io.PrintStream;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class SystemInfo
+/* */ implements MainCallback, MainTerminalCallback
+/* */ {
+/* 23 */ private static SystemInfo instance = new SystemInfo();
+/* 24 */ private long _lastFrame = 0L; private long _lastReport = 0L;
+/* 25 */ private long _min; private long _max; private long _avg; private long _avgCount = 0L;
+/* */
+/* */ private SystemInfo() {
+/* 28 */ Main.register(this);
+/* */ }
+/* */
+/* */ public void mainCallback() {
+/* 32 */ long curTime = Std.getFastTime();
+/* 33 */ long frameTime = curTime - this._lastFrame;
+/* */
+/* 35 */ if (frameTime < this._min)
+/* 36 */ this._min = frameTime;
+/* 37 */ if (frameTime > this._max)
+/* 38 */ this._max = frameTime;
+/* 39 */ this._avg += frameTime;
+/* 40 */ this._avgCount += 1L;
+/* */
+/* 42 */ if (curTime - this._lastReport > 300000L)
+/* */ {
+/* 44 */ if (this._lastFrame != 0L) {
+/* 45 */ System.out.println(logTime() + "Frame rate report:" + this._min +
+/* 46 */ "/" + this._avg / this._avgCount + "/" + this._max);
+/* */ }
+/* 48 */ this._min = 10000L;
+/* 49 */ this._max = 0L;
+/* 50 */ this._avg = 0L;
+/* 51 */ this._avgCount = 0L;
+/* 52 */ this._lastReport = curTime;
+/* */ }
+/* 54 */ this._lastFrame = curTime;
+/* */ }
+/* */
+/* */ public void terminalCallback() {
+/* 58 */ Main.unregister(this);
+/* 59 */ if (this._avgCount != 0L) {
+/* 60 */ System.out.println(logTime() + "Frame rate report:" + this._min + "/" +
+/* 61 */ this._avg / this._avgCount + "/" + this._max);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static void Record(PrintStream out)
+/* */ {
+/* 71 */ out.println("DISK REPORT:");
+/* 72 */ recordPath(out, "Windows SYSTEM path", GetSystemDirectory());
+/* 73 */ recordPath(out, "Current Working Directory", GetCurrentDirectory());
+/* */
+/* */
+/* 76 */ out.println("");
+/* 77 */ out.println("JAVA MEMORY:");
+/* 78 */ out.println(logTime() + "\t Free memory: " +
+/* 79 */ Runtime.getRuntime().freeMemory());
+/* 80 */ out.println(logTime() + "\tTotal memory: " +
+/* 81 */ Runtime.getRuntime().totalMemory());
+/* */
+/* */
+/* 84 */ out.println("");
+/* 85 */ out.println("WINDOWS MEMORY:");
+/* 86 */ out.println(logTime() + "\tTotal Physical Memory: " +
+/* 87 */ GetTotalPhysicalMemory());
+/* 88 */ out.println(logTime() + "\tAvail Physical Memory: " +
+/* 89 */ GetAvailPhysicalMemory());
+/* 90 */ out.println(logTime() + "\t Total Paged Memory: " +
+/* 91 */ GetTotalPagedMemory());
+/* 92 */ out.println(logTime() + "\t Avail Paged Memory: " +
+/* 93 */ GetAvailPagedMemory());
+/* */
+/* */
+/* 96 */ out.println("");
+/* 97 */ out.println(logTime() + "Java Properties: " + System.getProperties());
+/* 98 */ out.println(logTime() + "Number of CPUs: " + GetNumberOfProcessors());
+/* 99 */ out.println(logTime() + "Processor Type: " + GetProcessorType());
+/* 100 */ out.println(logTime() + "Platform Type: " + GetPlatformID());
+/* */ }
+/* */
+/* */
+/* */
+/* */ private static void recordPath(PrintStream out, String comment, String path)
+/* */ {
+/* 107 */ out.println(logTime() + comment + ": " + path);
+/* 108 */ if (path != null)
+/* */ {
+/* 110 */ String drive = path.substring(0, 2);
+/* 111 */ out.println(logTime() + "\tFree disk space (" + drive + "): " +
+/* 112 */ GetDiskFreeSpace(new StringBuilder(String.valueOf(drive)).append("\\").toString()) + " KB");
+/* */ }
+/* */ }
+/* */
+/* */ public static String logTime() {
+/* 117 */ return "[" + Std.getRealTime() + "] ";
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static native int GetDiskFreeSpace(String paramString);
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static int GetDiskFreeSpace()
+/* */ {
+/* 135 */ return GetDiskFreeSpace(null);
+/* */ }
+/* */
+/* */ public static native String GetSystemDirectory();
+/* */
+/* */ public static native String GetCurrentDirectory();
+/* */
+/* */ public static native int GetTotalPhysicalMemory();
+/* */
+/* */ public static native int GetAvailPhysicalMemory();
+/* */
+/* */ public static native int GetTotalPagedMemory();
+/* */
+/* */ public static native int GetAvailPagedMemory();
+/* */
+/* */ public static native String GetPlatformID();
+/* */
+/* */ public static native int GetNumberOfProcessors();
+/* */
+/* */ public static native String GetProcessorType();
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\core\SystemInfo.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file