merge
This commit is contained in:
parent
83cba874f2
commit
711a352d7f
|
@ -0,0 +1,15 @@
|
|||
package com.baeldung.reactive.util;
|
||||
|
||||
import com.sun.management.OperatingSystemMXBean;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
|
||||
public class CpuUtils {
|
||||
|
||||
private static OperatingSystemMXBean operatingSystemMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
|
||||
|
||||
static Double getUsage() {
|
||||
return (operatingSystemMXBean.getSystemCpuLoad() / operatingSystemMXBean.getAvailableProcessors()) * 100;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue