Skip to content


Browse files Browse the repository at this point in the history
8284977: MetricsTesterCgroupV2.getLongValueEntryFromFile fails when n…
…amed value doesn't exist

Backport-of: 444a0d98ac06ab043e3b11281234fd515abff302
  • Loading branch information
Jonathan Dowland committed Sep 29, 2022
1 parent 5944581 commit 378b516
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -121,6 +121,11 @@ private long getLongValueEntryFromFile(String file, String metric) {
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
String[] keyValues = strVal.split("\\s+");
String value = keyValues[1];
return convertStringToLong(value);
Expand Down

1 comment on commit 378b516

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.