Class CPUUsageResolver


  • @Internal
    public final class CPUUsageResolver
    extends java.lang.Object
    This 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.DecimalFormat CPU_USAGE_OUTPUT_FORMAT
      A simple decimal format to easy display the CPU usage value.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double getProcessCPUUsage()
      For encapsulation and easy operation of the operating systemMXBean its getCpuLoad() method.
      static double getSystemCPUUsage()
      For encapsulation and easy operation of the operating systemMXBean its getCpuLoad() method.
      static long getSystemMemory()
      For encapsulation and easy operation of the operating systemMXBean its getCpuLoad() method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CPU_USAGE_OUTPUT_FORMAT

        public static final java.text.DecimalFormat CPU_USAGE_OUTPUT_FORMAT
        A simple decimal format to easy display the CPU usage value.
    • 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