8284977: MetricsTesterCgroupV2.getLongValueEntryFromFile fails when named value doesn't exist
Reviewed-by: sgehwolf, mdoerr
This commit is contained in:
parent
08400f18ba
commit
444a0d98ac
@ -121,6 +121,11 @@ public class MetricsTesterCgroupV2 implements CgroupMetricsTester {
|
||||
Path filePath = Paths.get(UNIFIED.getPath(), file);
|
||||
try {
|
||||
String strVal = Files.lines(filePath).filter(l -> l.startsWith(metric)).collect(Collectors.joining());
|
||||
if (strVal.isEmpty()) {
|
||||
// sometimes the match for the metric does not exist, e.g. cpu.stat's nr_periods iff the controller
|
||||
// is not enabled
|
||||
return UNLIMITED;
|
||||
}
|
||||
String[] keyValues = strVal.split("\\s+");
|
||||
String value = keyValues[1];
|
||||
return convertStringToLong(value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user