RFR: 8374200: jdk/internal/platform/cgroup/TestCgroupMetrics.java fails with common prefix metrics

Jie Fu jiefu at openjdk.org
Mon Dec 22 15:38:44 UTC 2025


Hi all,

`jdk/internal/platform/cgroup/TestCgroupMetrics.java` fails on machines with common prefix metrics.

For example, the cpu.stat may be

usage_usec 5111148455
user_usec 4457755664
system_usec 653392790
core_sched.force_idle_usec 0
nr_periods 0
nr_throttled 0
throttled_usec 0
nr_burst 0
burst_usec 0
nr_throttled_bt 0
throttled_usec_bt 0


`nr_throttled` and `nr_throttled_bt` are metrics with common prefix.
In this case, the test fails since it only matches the starting metric string.

The fix just adds one more filter `.filter(l -> l.split("\\s+")[0].equals(metric))`, which would match the metric exactly.

-------------

Commit messages:
 - 8374200: jdk/internal/platform/cgroup/TestCgroupMetrics.java fails with common prefix metrics

Changes: https://git.openjdk.org/jdk/pull/28956/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28956&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8374200
  Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/28956.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28956/head:pull/28956

PR: https://git.openjdk.org/jdk/pull/28956


More information about the hotspot-runtime-dev mailing list