ofloflofl
ofloflofl

Reputation: 205

Percentage usage by each processor in my machine

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

Answers (2)

Nicholas
Nicholas

Reputation: 16056

Take a look at Sigar. The getCpuPercList method in the Sigar class will give you usage stats on each core.

Upvotes: 1

nanofarad
nanofarad

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

Related Questions