Search in sources :

Example 1 with MemoryInfo

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);
    }
}
Also used : MemoryInfo(net.rubygrapefruit.platform.memory.MemoryInfo) Memory(net.rubygrapefruit.platform.memory.Memory) NativeException(net.rubygrapefruit.platform.NativeException) NativeIntegrationException(org.gradle.internal.nativeintegration.NativeIntegrationException)

Aggregations

NativeException (net.rubygrapefruit.platform.NativeException)1 Memory (net.rubygrapefruit.platform.memory.Memory)1 MemoryInfo (net.rubygrapefruit.platform.memory.MemoryInfo)1 NativeIntegrationException (org.gradle.internal.nativeintegration.NativeIntegrationException)1