< prev index next >

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

Print this page
rev 59383 : [mq]: final

*** 1,7 **** /* ! * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 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 >