Please review the following RFE which adds an internal API, along with jtreg tests that provide access to Docker container configuration data and metrics. In addition to the API which we hope to take advantage of in the future with Java Flight Recorder and a JMX Mbean, I’ve added an additional option to -XshowSettings:system than dumps out the container or host cgroup confguration information. See the sample output below:
RFE: Container Metrics https://bugs.openjdk.java.net/browse/JDK-8203357 WEBREV: http://cr.openjdk.java.net/~bobv/8203357/webrev.00 This commit will also include a fix for the following bug. BUG: [TESTBUG] Test /runtime/containers/cgroup/PlainRead.java fails https://bugs.openjdk.java.net/browse/JDK-8203691 WEBREV: http://cr.openjdk.java.net/~bobv/8203357/webrev.00/test/hotspot/jtreg/runtime/containers/cgroup/PlainRead.java.sdiff.html SAMPLE USAGE and OUTPUT: docker run —memory=256m --cpuset-cpus 4-7 -it ubuntu bash ./java -XshowSettings:system Operating System Metrics: Provider: cgroupv1 Effective CPU Count: 4 CPU Period: 100000 CPU Quota: -1 CPU Shares: -1 List of Processors, 4 total: 4 5 6 7 List of Effective Processors, 4 total: 4 5 6 7 List of Memory Nodes, 2 total: 0 1 List of Available Memory Nodes, 2 total: 0 1 CPUSet Memory Pressure Enabled: false Memory Limit: 256.00M Memory Soft Limit: Unlimited Memory & Swap Limit: 512.00M Kernel Memory Limit: Unlimited TCP Memory Limit: Unlimited Out Of Memory Killer Enabled: true TEST RESULTS: testing runtime container APIs Directory "JTwork" not found: creating Passed: runtime/containers/cgroup/PlainRead.java Passed: runtime/containers/docker/DockerBasicTest.java Passed: runtime/containers/docker/TestCPUAwareness.java Passed: runtime/containers/docker/TestCPUSets.java Passed: runtime/containers/docker/TestMemoryAwareness.java Passed: runtime/containers/docker/TestMisc.java Test results: passed: 6 Results written to /export/users/bobv/jdk11/build/jtreg/JTwork testing jdk.internal.platform APIs Passed: jdk/internal/platform/cgroup/TestCgroupMetrics.java Passed: jdk/internal/platform/docker/TestDockerCpuMetrics.java Passed: jdk/internal/platform/docker/TestDockerMemoryMetrics.java Passed: jdk/internal/platform/docker/TestSystemMetrics.java Test results: passed: 4 Results written to /export/users/bobv/jdk11/build/jtreg/JTwork testing -XshowSettings:system launcher option Passed: tools/launcher/Settings.java Test results: passed: 1 Bob.