< prev index next >

test/jdk/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java

Print this page
rev 59104 : imported patch serviceability

*** 115,144 **** // -/+ buffers/cache: 5771309056 10762231808 // Swap: 15999168512 0 15999168512 String swapSizeStr = ProcessTools.executeCommand("free", "-b") .firstMatch("Swap:\\s+([0-9]+)\\s+.*", 1); return Long.parseLong(swapSizeStr); - } else if (Platform.isSolaris()) { - // swapfile dev swaplo blocks free - // /dev/dsk/c0t0d0s1 136,1 16 1638608 1600528 - OutputAnalyzer out= ProcessTools.executeCommand( - "/usr/sbin/swap", - "-l" - ); - - long swapSize = 0; - - for (String line : out.asLines()) { - if (line.contains("swapfile")) continue; - - String[] vals = line.split("\\s+"); - if (vals.length == 5) { - swapSize += Long.parseLong(vals[3]) * 512; // size is reported in 512b blocks - } - } - - return swapSize; } else if (Platform.isOSX()) { // total = 8192.00M used = 7471.11M free = 720.89M (encrypted) String swapSizeStr = ProcessTools.executeCommand( "/usr/sbin/sysctl", "-n", --- 115,124 ----
< prev index next >