< prev index next >

src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1Subsystem.java

Print this page
@  rev 57586 : Review changes
|
o  rev 57585 : 8231111: Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy
|  Reviewed-by: bobv
~
o  rev 56863 : 8231111: Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy
|  Reviewed-by: bobv
~

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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.  Oracle designates this

@@ -31,10 +31,11 @@
 import java.util.stream.Stream;
 
 import jdk.internal.platform.CgroupSubsystem;
 import jdk.internal.platform.CgroupSubsystemController;
 import jdk.internal.platform.CgroupUtil;
+import jdk.internal.platform.Metrics;
 
 public class CgroupV1Subsystem implements CgroupSubsystem {
     private CgroupV1MemorySubSystemController memory;
     private CgroupV1SubsystemController cpu;
     private CgroupV1SubsystemController cpuacct;

@@ -281,11 +282,11 @@
     }
 
     public long[] getPerCpuUsage() {
         String usagelist = CgroupSubsystemController.getStringValue(cpuacct, "cpuacct.usage_percpu");
         if (usagelist == null) {
-            return new long[0];
+            return null;
         }
 
         String list[] = usagelist.split(" ");
         long percpu[] = new long[list.length];
         for (int i = 0; i < list.length; i++) {

@@ -317,11 +318,11 @@
     }
 
     public long getCpuShares() {
         long retval = getLongValue(cpu, "cpu.shares");
         if (retval == 0 || retval == 1024)
-            return -1;
+            return Metrics.LONG_RETVAL_UNLIMITED;
         else
             return retval;
     }
 
     public long getCpuNumPeriods() {

@@ -363,11 +364,11 @@
 
     public double getCpuSetMemoryPressure() {
         return CgroupSubsystemController.getDoubleValue(cpuset, "cpuset.memory_pressure");
     }
 
-    public boolean isCpuSetMemoryPressureEnabled() {
+    public Boolean isCpuSetMemoryPressureEnabled() {
         long val = getLongValue(cpuset, "cpuset.memory_pressure_enabled");
         return (val == 1);
     }
 
 

@@ -471,11 +472,11 @@
 
     public long getMemoryAndSwapUsage() {
         return getLongValue(memory, "memory.memsw.usage_in_bytes");
     }
 
-    public boolean isMemoryOOMKillEnabled() {
+    public Boolean isMemoryOOMKillEnabled() {
         long val = CgroupSubsystemController.getLongEntry(memory, "memory.oom_control", "oom_kill_disable");
         return (val == 0);
     }
 
     public long getMemorySoftLimit() {
< prev index next >