According to the VisualVM source code , processor load is actually calculated as the total processor time divided by the number of processors:
long processCpuTime = tracksProcessCpuTime ? model.getProcessCpuTime() / processorsCount : -1;
where processorCount is obtained from OperatingSystemMXBean:
OperatingSystemMXBean osbean = mxbeans.getOperatingSystemMXBean(); if (osbean != null) processorsCount = osbean.getAvailableProcessors();
There was a long-standing JVM error JDK-6515172 that the affinity for the process was not taken into account, that is, getAvailableProcessors always returned the total number of CPUs, regardless of task sets. This has been linked to Linux and BSD; worked fine on Solaris and Windows.
About a month ago, this error was finally resolved. The fix, however, is for JDK 9 only.
See this question for possible workarounds. They are somewhat ugly though.
apangin
source share