protected long getMemory() { OperatingSystemMXBean osmxb = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); return osmxb.getTotalPhysicalMemorySize(); }
protected String getOsType() { String osName = System.getProperty("os.name"); if (osName.startsWith("Linux")) return "Linux"; if (osName.startsWith("Windows")) return "Windows"; if ((osName.contains("SunOS")) || (osName.contains("Solaris"))) return "Solaris"; if (osName.contains("Mac")) return "Mac"; if (osName.contains("FreeBSD")) { return "FreeBSD"; } return "Other"; }
protected int getCpuCores() { return Runtime.getRuntime().availableProcessors(); }
getPid() { String name = ManagementFactory.getRuntimeMXBean().getName(); int indexOf = name.indexOf(64); if (indexOf > 0) { name = name.substring(0, indexOf); } return Long.parseLong(name); }