Reputation: 205
I want to know the usage percentage used by each CPU on my machine. Is there a Java code or a Windows command to allow me to know this information?
Upvotes: 0
Views: 339
Reputation: 16056
Take a look at Sigar. The getCpuPercList method in the Sigar class will give you usage stats on each core.
Upvotes: 1
Reputation: 41281
There is a nice MX bean for this:
OperatingSystemMXBean.getSystemLoadAverage()
that gets the overall load average. You can then divide this by the number of CPUs for the average per-CPU load.
Upvotes: 2