Skip to content

CAUTION: This site hosts draft documentation for the next release. For published content of the latest release, visit www.eclipse.org/openj9/docs

-XX:[+|-]CpuLoadCompatibility

This option enables or disables the OpenJDK behavior of the getProcessCpuLoad() and getCpuLoad() methods in OpenJ9.

Note: Before OpenJDK 14, the getCpuLoad() method name was getSystemCpuLoad(). Because OpenJDK 14 is no longer supported, the relevant LTS release where this change is visible is OpenJDK 17 and later.

Syntax

    -XX:[+|-]CpuLoadCompatibility
Setting Effect Default
-XX:+CpuLoadCompatibility Enable
-XX:-CpuLoadCompatibility Disable yes

Explanation

The getProcessCpuLoad() method in the com.sun.management.OperatingSystemMXBean class returns the recent CPU usage value for the Java virtual machine process, while the getCpuLoad() method returns the recent CPU usage value for the whole system. When these methods were called in OpenJ9 for the first time, these methods were returning -1 to indicate that the recent CPU usage is not available. It was difficult to identify whether the reason for the -1 value was an error or because the call was the first call and therefore, no recent CPU usage was available.

In OpenJDK, getProcessCpuLoad() returns 0 value on the first call, while getCpuLoad() collects two internal samples so that a valid CPU usage value can be returned. This 0 return value on the first call and the two internal samples make it easier to differentiate between the first call behavior and an error that needs further investigation.

The -XX:+CpuLoadCompatibility option is used to enable the OpenJDK behavior of the getProcessCpuLoad() and getCpuLoad() methods in OpenJ9.

Note: The -XX:[+|-]CpuLoadCompatibility option is applicable to all platforms except z/OS®. On z/OS, the CPU load that is reported by the getCpuLoad method is obtained directly from the system control blocks, without the need to collect samples. The -XX:[+|-]CpuLoadCompatibility option has no effect on z/OS, and a valid CPU usage value is always returned whatever be the setting of this option.

See also