Class CpuUsageResolver

java.lang.Object
eu.cloudnetservice.utils.base.resource.CpuUsageResolver

public final class CpuUsageResolver extends Object
A utility class to resolve the usage of the host system CPU.
Since:
4.0
  • Field Details

  • Constructor Details

    • CpuUsageResolver

      private CpuUsageResolver()
  • Method Details

    • systemCpuLoad

      public static @Range(from=-1L,to=100L) double systemCpuLoad()
      Reads the current system cpu usage and converts the returned value into a percentage. Note: in case that the value is not available, this method returns -1.
      Returns:
      the current system cpu load formatted to a percentage or -1 if not available.
    • processCpuLoad

      public static @Range(from=-1L,to=100L) double processCpuLoad()
      Reads the process cpu usage for the current jvm process and converts the returned value into a percentage. Note: in case that the value is not available, this method returns -1.
      Returns:
      the current process cpu load formatted to a percentage or -1 if not available.