Search in sources :

Example 1 with VMStatistics64

use of com.sun.jna.platform.mac.SystemB.VMStatistics64 in project jna by java-native-access.

the class SystemBTest method testVMInfo.

public void testVMInfo() {
    int machPort = SystemB.INSTANCE.mach_host_self();
    assertTrue(machPort > 0);
    VMStatistics vmStats = new VMStatistics();
    int ret = SystemB.INSTANCE.host_statistics(machPort, SystemB.HOST_VM_INFO, vmStats, new IntByReference(vmStats.size() / SystemB.INT_SIZE));
    assertEquals(ret, 0);
    // Nonnegative
    assertTrue(vmStats.free_count >= 0);
    if (Platform.is64Bit()) {
        VMStatistics64 vmStats64 = new VMStatistics64();
        ret = SystemB.INSTANCE.host_statistics64(machPort, SystemB.HOST_VM_INFO, vmStats64, new IntByReference(vmStats64.size() / SystemB.INT_SIZE));
        assertEquals(ret, 0);
        // Nonnegative
        assertTrue(vmStats64.free_count >= 0);
    }
}
Also used : IntByReference(com.sun.jna.ptr.IntByReference) VMStatistics64(com.sun.jna.platform.mac.SystemB.VMStatistics64) VMStatistics(com.sun.jna.platform.mac.SystemB.VMStatistics)

Aggregations

VMStatistics (com.sun.jna.platform.mac.SystemB.VMStatistics)1 VMStatistics64 (com.sun.jna.platform.mac.SystemB.VMStatistics64)1 IntByReference (com.sun.jna.ptr.IntByReference)1