< prev index next >
test/jdk/jdk/internal/platform/docker/MetricsCpuTester.java
Print this page
o rev 57733 : 8231111: Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy
| Reviewed-by: bobv, mchung
~
o rev 56862 : 8231111: Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy
| Reviewed-by: bobv
~
@@ -141,10 +141,15 @@
System.out.println("TEST PASSED!!!");
}
private static void testCpuShares(long shares) {
Metrics metrics = Metrics.systemMetrics();
+ if ("cgroupv2".equals(metrics.getProvider()) && shares < 1024) {
+ // Adjust input shares for < 1024 cpu shares as the
+ // impl. rounds up to the next multiple of 1024
+ shares = 1024;
+ }
long newShares = metrics.getCpuShares();
if (newShares != shares) {
throw new RuntimeException("CPU shares not equal, expected : ["
+ shares + "]" + ", got : " + "[" + newShares + "]");
}
< prev index next >