Here is a first pass at an implementation of the Container Awareness JEP. This JEP adds an implementation of an internal API for the extraction of system metrics for processes running in Isolation Groups (Containers). The plan is to get the internal API integrated in JDK 11 with support for Linux x64 and then follow this work up with support for alternate platforms, the addition of a JMX MBean and Java Flight Recorder.
JEP: https://bugs.openjdk.java.net/browse/JDK-8182070 JAVADOC: http://cr.openjdk.java.net/~bobv/8182070/v01/javadoc/jdk/internal/platform/Metrics.html WEBREV: http://cr.openjdk.java.net/~bobv/8182070/v01/webrev WEBREV including a Prototype MBEAN for exposing these Metrics: This prototype will not be integrated as part of this JEP. It’s for information only. http://cr.openjdk.java.net/~bobv/8182070/v01/mbean-proto/ This feature adds a new -XshowSetting option “system” which displays the available system Metrics. % java -XshowSettings:system Operating System Metrics: Provider: cgroupv1 Effective CPU Count: 24 CPUTime per Processor: [0]: 52805305 (ns) [1]: 70799492 (ns) [2]: 27449618 (ns) [3]: 12957734 (ns) [4]: 38382720 (ns) [5]: 20325731 (ns) [6]: 36374924 (ns) [7]: 40279640 (ns) [8]: 17557347 (ns) [9]: 19056675 (ns) [10]: 66185888 (ns) [11]: 56539480 (ns) [12]: 10009386 (ns) [13]: 19139797 (ns) [14]: 2257349 (ns) [15]: 8712468 (ns) [16]: 10306911 (ns) [17]: 9814800 (ns) [18]: 3516611 (ns) [19]: 747174 (ns) [20]: 4380756 (ns) [21]: 11803118 (ns) [22]: 1076297 (ns) [23]: 8069315 (ns) CPU Usage is: 550599580 (ns) CPU User Usage is: 36 (ticks) CPU System Usage is: 10 (ticks) CPU Period: 100000 CPU Quota: -1 CPU Shares: -1 CPU Number of Periods: 0 CPU Number of Throttled Periods: 0 CPU Throttled Time: 0 CPUSet Exclusive: false CPUSet Memory Exclusive: false List of Processors, 24 total: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 List of Effective Processors, 24 total: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 List of Memory Nodes, 2 total: 0 1 List of Available Memory Nodes, 2 total: 0 1 CPUSet Memory Pressure Enabled: false CPUSet Memory Pressure: 0.0 Memory Failed Count: 0 Memory Limit: Unlimited Memory Used: 43.31M Max Memory Used: 48.82M Memory Soft Limit: Unlimited Memory & Swap Failed Count: 0.00K Memory & Swap Limit: Unlimited Memory & Swap Used: 43.93M Max Memory & Swap Used: 48.82M Kernel Memory Failed Count: 0.00K Kernel Memory Limit: Unlimited Kernel Memory Used: 0.00K Kernel Max Memory Used: 0.00K TCP Memory Failed Count: 0.00K TCP Memory Limit: Unlimited TCP Memory Used: 0.00K TCP Max Memory Used: 0.00K Out Of Memory Killer Enabled: true BLKIO: Number of I/O Operations Completed: 42 BLKIO: Bytes Transferred from disk: 4923392 Bob Vandette