< 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 ****
/*
! * Copyright (c) 2018, 2019, 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
--- 1,7 ----
/*
! * 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,40 ****
--- 31,41 ----
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,291 ****
}
public long[] getPerCpuUsage() {
String usagelist = CgroupSubsystemController.getStringValue(cpuacct, "cpuacct.usage_percpu");
if (usagelist == null) {
! return new long[0];
}
String list[] = usagelist.split(" ");
long percpu[] = new long[list.length];
for (int i = 0; i < list.length; i++) {
--- 282,292 ----
}
public long[] getPerCpuUsage() {
String usagelist = CgroupSubsystemController.getStringValue(cpuacct, "cpuacct.usage_percpu");
if (usagelist == null) {
! return null;
}
String list[] = usagelist.split(" ");
long percpu[] = new long[list.length];
for (int i = 0; i < list.length; i++) {
*** 317,327 ****
}
public long getCpuShares() {
long retval = getLongValue(cpu, "cpu.shares");
if (retval == 0 || retval == 1024)
! return -1;
else
return retval;
}
public long getCpuNumPeriods() {
--- 318,328 ----
}
public long getCpuShares() {
long retval = getLongValue(cpu, "cpu.shares");
if (retval == 0 || retval == 1024)
! return Metrics.LONG_RETVAL_UNLIMITED;
else
return retval;
}
public long getCpuNumPeriods() {
*** 363,373 ****
public double getCpuSetMemoryPressure() {
return CgroupSubsystemController.getDoubleValue(cpuset, "cpuset.memory_pressure");
}
! public boolean isCpuSetMemoryPressureEnabled() {
long val = getLongValue(cpuset, "cpuset.memory_pressure_enabled");
return (val == 1);
}
--- 364,374 ----
public double getCpuSetMemoryPressure() {
return CgroupSubsystemController.getDoubleValue(cpuset, "cpuset.memory_pressure");
}
! public Boolean isCpuSetMemoryPressureEnabled() {
long val = getLongValue(cpuset, "cpuset.memory_pressure_enabled");
return (val == 1);
}
*** 471,481 ****
public long getMemoryAndSwapUsage() {
return getLongValue(memory, "memory.memsw.usage_in_bytes");
}
! public boolean isMemoryOOMKillEnabled() {
long val = CgroupSubsystemController.getLongEntry(memory, "memory.oom_control", "oom_kill_disable");
return (val == 0);
}
public long getMemorySoftLimit() {
--- 472,482 ----
public long getMemoryAndSwapUsage() {
return getLongValue(memory, "memory.memsw.usage_in_bytes");
}
! public Boolean isMemoryOOMKillEnabled() {
long val = CgroupSubsystemController.getLongEntry(memory, "memory.oom_control", "oom_kill_disable");
return (val == 0);
}
public long getMemorySoftLimit() {
< prev index next >