Class CPUUsageResolver
- java.lang.Object
-
- de.dytanic.cloudnet.common.unsafe.CPUUsageResolver
-
@Internal public final class CPUUsageResolver extends java.lang.ObjectThis class includes the methods to getDef the CPU load exactly from the com.sun.management.OperatingSystemMXBean class and to encapsulate the operations from the unsafe access com.sun.management.* classes- See Also:
OperatingSystemMXBean
-
-
Field Summary
Fields Modifier and Type Field Description static java.text.DecimalFormatCPU_USAGE_OUTPUT_FORMATA simple decimal format to easy display the CPU usage value.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doublegetProcessCPUUsage()For encapsulation and easy operation of the operating systemMXBean its getCpuLoad() method.static doublegetSystemCPUUsage()For encapsulation and easy operation of the operating systemMXBean its getCpuLoad() method.static longgetSystemMemory()For encapsulation and easy operation of the operating systemMXBean its getCpuLoad() method.
-
-
-
Method Detail
-
getSystemCPUUsage
public static double getSystemCPUUsage()
For encapsulation and easy operation of the operating systemMXBean its getCpuLoad() method.- Returns:
- the current system cpu usage as double value
- See Also:
OperatingSystemMXBean
-
getProcessCPUUsage
public static double getProcessCPUUsage()
For encapsulation and easy operation of the operating systemMXBean its getCpuLoad() method.- Returns:
- the cpu usage of this JVM process as double value in range from 0 to 100 % in percent
- See Also:
OperatingSystemMXBean
-
getSystemMemory
public static long getSystemMemory()
For encapsulation and easy operation of the operating systemMXBean its getCpuLoad() method.- Returns:
- the system configured memory in bytes
- See Also:
OperatingSystemMXBean
-
-