use of net.rubygrapefruit.platform.memory.MemoryInfo in project gradle by gradle.
the class NativeOsMemoryInfo method getOsSnapshot.
@Override
public OsMemoryStatus getOsSnapshot() {
try {
Memory memory = NativeServices.getInstance().get(Memory.class);
MemoryInfo memoryInfo = memory.getMemoryInfo();
return new OsMemoryStatusSnapshot(memoryInfo.getTotalPhysicalMemory(), memoryInfo.getAvailablePhysicalMemory());
} catch (NativeException ex) {
throw new UnsupportedOperationException("Unable to get system memory", ex);
} catch (NativeIntegrationException ex) {
throw new UnsupportedOperationException("Unable to get system memory", ex);
}
}
Aggregations