About the perfInit() method in LinuxOperatingSystem.c

Aleksey Shipilev shade at redhat.com
Tue Feb 8 07:44:12 UTC 2022


On 2/8/22 10:26, Poison wrote:
> In JDK8 com.sun.management.OperatingSystemMXBean#getSystemCpuLoad, when the operating system 
> isLinux, the perfInit() method will be called for initialization, but will the initialized 
> variable cause the code in the if block to not be executed?
Yes, but that problem was fixed as part of:
   8226575: OperatingSystemMXBean should be made container aware

...which was backported to 8u272.

Here it is in 8u tip:
 
https://github.com/openjdk/jdk8u/blob/8d5c7386c619a2602d9731c4adbbb1b01aeb449f/jdk/src/solaris/native/sun/management/LinuxOperatingSystem.c#L202-L204

-- 
Thanks,
-Aleksey



More information about the jdk8u-dev mailing list