test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Cdiff test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java

test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java

Print this page

        

*** 148,158 **** private static String getFileContents(SubSystem subSystem, String fileName) { String fname = subSystemPaths.get(subSystem.value())[0] + File.separator + fileName; try { return new Scanner(new File(fname)).useDelimiter("\\Z").next(); } catch (FileNotFoundException e) { ! System.err.println("Unale to open : " + fname); return ""; } } private static long getLongValueFromFile(SubSystem subSystem, String fileName) { --- 148,158 ---- private static String getFileContents(SubSystem subSystem, String fileName) { String fname = subSystemPaths.get(subSystem.value())[0] + File.separator + fileName; try { return new Scanner(new File(fname)).useDelimiter("\\Z").next(); } catch (FileNotFoundException e) { ! System.err.println("Unable to open : " + fname); return ""; } } private static long getLongValueFromFile(SubSystem subSystem, String fileName) {
*** 428,439 **** Arrays.toString(newVal)); } oldVal = Arrays.stream(metrics.getEffectiveCpuSetCpus()).boxed().toArray(Integer[]::new); - Arrays.sort(oldVal); cpusstr = getFileContents(SubSystem.CPUSET, "cpuset.effective_cpus"); newVal = Stream.of(cpusstr.split(",")).flatMap(a -> { if (a.contains("-")) { String[] range = a.split("-"); return IntStream.rangeClosed(Integer.parseInt(range[0]), --- 428,441 ---- Arrays.toString(newVal)); } oldVal = Arrays.stream(metrics.getEffectiveCpuSetCpus()).boxed().toArray(Integer[]::new); + // Check to see if this metric is supported on this platform + if (oldVal.length != 0) { + Arrays.sort(oldVal); cpusstr = getFileContents(SubSystem.CPUSET, "cpuset.effective_cpus"); newVal = Stream.of(cpusstr.split(",")).flatMap(a -> { if (a.contains("-")) { String[] range = a.split("-"); return IntStream.rangeClosed(Integer.parseInt(range[0]),
*** 445,454 **** --- 447,457 ---- Arrays.sort(newVal); if (Arrays.compare(oldVal, newVal) != 0) { fail(SubSystem.CPUSET, "cpuset.effective_cpus", Arrays.toString(oldVal), Arrays.toString(newVal)); } + } oldVal = Arrays.stream(metrics.getCpuSetMems()).boxed().toArray(Integer[]::new); Arrays.sort(oldVal); cpusstr = getFileContents(SubSystem.CPUSET, "cpuset.mems"); newVal = Stream.of(cpusstr.split(",")).flatMap(a -> {
*** 465,474 **** --- 468,480 ---- fail(SubSystem.CPUSET, "cpuset.mems", Arrays.toString(oldVal), Arrays.toString(newVal)); } oldVal = Arrays.stream(metrics.getEffectiveCpuSetMems()).boxed().toArray(Integer[]::new); + + // Check to see if this metric is supported on this platform + if (oldVal.length != 0) { Arrays.sort(oldVal); cpusstr = getFileContents(SubSystem.CPUSET, "cpuset.effective_mems"); newVal = Stream.of(cpusstr.split(",")).flatMap(a -> { if (a.contains("-")) { String[] range = a.split("-");
*** 481,490 **** --- 487,497 ---- Arrays.sort(newVal); if (Arrays.compare(oldVal, newVal) != 0) { fail(SubSystem.CPUSET, "cpuset.effective_mems", Arrays.toString(oldVal), Arrays.toString(newVal)); } + } double oldValue = metrics.getCpuSetMemoryPressure(); double newValue = getDoubleValueFromFile(SubSystem.CPUSET, "cpuset.memory_pressure"); if (!compareWithErrorMargin(oldValue, newValue)) { fail(SubSystem.CPUSET, "cpuset.memory_pressure", oldValue, newValue);
test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File