'Difference in CPU usage statistics

Machine: MacBook

Java 1.8

➜  [~] sysctl hw.physicalcpu hw.logicalcpu
hw.physicalcpu: 6
hw.logicalcpu: 12

I was debugging a java application using VisualVM and was unable to figure out the following. VisualVM reported a usage of 7.8% at one point. During the same time I checked the Mac Activity Monitor and over there a 147% usage was displayed. What's the difference?

The fans on my laptop were causing a lot of noise! enter image description here



Solution 1:[1]

I'm just speculating here because normally I don't use VisualVM and do not use MacBooks. Perhaps the 7.8% is the load per CPU. And 147% is the sum of loads of all CPUs. If you would determine the load per CPU you would get 147/12=12.25% which is pretty close to the 7.8%.

It could also be you have other processes running on your system.

I would definitely look at a more reliable profiler like async-profiler.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 pveentjer