< prev index next >
src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemController.java
Print this page
@ rev 57446 : Review changes
|
o rev 57445 : 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
~
*** 39,51 ****
* Cgroup version agnostic controller logic
*
*/
public interface CgroupSubsystemController {
- public static final long RETVAL_UNLIMITED = -1;
- public static final long RETVAL_NOT_SUPPORTED = -2;
- public static final long RETVAL_ERROR = -3;
public static final String EMPTY_STR = "";
public String path();
/**
--- 39,48 ----
*** 73,83 ****
public static long getLongValueMatchingLine(CgroupSubsystemController controller,
String param,
String match,
Function<String, Long> conversion) {
! long retval = CgroupSubsystemController.RETVAL_UNLIMITED;
try {
Path filePath = Paths.get(controller.path(), param);
List<String> lines = CgroupUtil.readAllLinesPrivileged(filePath);
for (String line : lines) {
if (line.startsWith(match)) {
--- 70,80 ----
public static long getLongValueMatchingLine(CgroupSubsystemController controller,
String param,
String match,
Function<String, Long> conversion) {
! long retval = Metrics.LONG_RETVAL_UNLIMITED;
try {
Path filePath = Paths.get(controller.path(), param);
List<String> lines = CgroupUtil.readAllLinesPrivileged(filePath);
for (String line : lines) {
if (line.startsWith(match)) {
*** 147,160 ****
*
* @param range
* @return int[] containing a sorted list of processors or memory nodes
*/
public static int[] stringRangeToIntArray(String range) {
! int[] ints = new int[0];
!
! if (range == null || EMPTY_STR.equals(range)) return ints;
ArrayList<Integer> results = new ArrayList<>();
String strs[] = range.split(",");
for (String str : strs) {
if (str.contains("-")) {
String lohi[] = str.split("-");
--- 144,156 ----
*
* @param range
* @return int[] containing a sorted list of processors or memory nodes
*/
public static int[] stringRangeToIntArray(String range) {
! if (range == null || EMPTY_STR.equals(range)) return null;
+ int[] ints = new int[0];
ArrayList<Integer> results = new ArrayList<>();
String strs[] = range.split(",");
for (String str : strs) {
if (str.contains("-")) {
String lohi[] = str.split("-");
< prev index next >