assert allServices.size() > 0;
}
@Test(enabled = ENABLED)
public void testNativeMemory() throws Exception {
Sigar sigar = new Sigar();
try {
Mem allMemory = sigar.getMem();
Swap allSwap = sigar.getSwap();
NumberFormat nf = NumberFormat.getNumberInstance();
System.out.println("All Memory:" + "\nActualFreeMem=" + nf.format(allMemory.getActualFree())
+ "\nActualUsedMem=" + nf.format(allMemory.getActualUsed()) + "\n RamMem="
+ nf.format(allMemory.getRam()) + "\n FreeMem=" + nf.format(allMemory.getFree())
+ "\n UsedMem=" + nf.format(allMemory.getUsed()) + "\n TotalMem="
+ nf.format(allMemory.getTotal()) + "\n FreeSwap=" + nf.format(allSwap.getFree())
+ "\n UsedSwap=" + nf.format(allSwap.getUsed()) + "\n TotalSwap="
+ nf.format(allSwap.getTotal()));
assert allMemory.getActualFree() > 0 : allMemory.getActualFree();
assert allMemory.getFree() > 0 : allMemory.getFree();
assert allMemory.getTotal() > 1000000 : allMemory.getTotal();
if (allSwap.getTotal()>0) {
assert allSwap.getTotal() > 1000000 : allSwap.getTotal();
assert allSwap.getFree() > 0 : allSwap.getFree();
}
ProcMem processMemory = sigar.getProcMem(sigar.getPid());
System.out.println("Process Memory:" + "\n MinorFaults=" + nf.format(processMemory.getMinorFaults())
+ "\n MajorFaults=" + nf.format(processMemory.getMajorFaults()) + "\n PageFaults="
+ nf.format(processMemory.getPageFaults()) + "\n Resident="
+ nf.format(processMemory.getResident()) + "\n Share=" + nf.format(processMemory.getShare())
+ "\n Size=" + nf.format(processMemory.getSize()));
assert processMemory.getResident() > 0 : processMemory.getResident();
assert processMemory.getSize() > 0 : processMemory.getSize();
} finally {
sigar.close();
}
}