/** * Returns the HTML representation of the space. */ public String toHtml(NativeSystemMemory usage) { if(usage.getAvailableSwapSpace() == -1) return "N/A"; long free = usage.getAvailableSwapSpace(); free/=1024L; // convert to KB free/=1024L; // convert to MB if(free>256 || usage.getTotalSwapSpace() < usage.getAvailableSwapSpace() * 5) return free+"MB"; // if we have more than 256MB free or less than 80% filled up, it's OK // Otherwise considered dangerously low. return Util.wrapToErrorSpan(free+"MB"); }
public long toMB(NativeSystemMemory usage) { if(usage.getAvailableSwapSpace() == -1) return -1; long free = usage.getAvailableSwapSpace(); free/=1024L; // convert to KB free/=1024L; // convert to MB return free; }
/** * Total number of swap space in bytes. */ @Exported public long getTotalSwapSpace() { return systemMemory.getTotalSwapSpace(); }
/** * Total physical memory of the system, in bytes. */ @Exported public long getTotalPhysicalMemory() { return systemMemory.getTotalPhysicalMemory(); }
/** * Of the total physical memory of the system, available bytes. */ @Exported public long getAvailablePhysicalMemory() { return systemMemory.getAvailablePhysicalMemory(); }
/** * Available swap space in bytes. */ @Exported public long getAvailableSwapSpace() { return systemMemory.getAvailableSwapSpace(); } }