Class CpuStatusProvider

java.lang.Object
com.github.jpmsilva.jsystemd.CpuStatusProvider
All Implemented Interfaces:
StatusProvider

public class CpuStatusProvider extends Object implements StatusProvider
Implementation of StatusProvider that provides the CPU usage, such as CPU: 12.5% process; 40.1% system; load 1.20: the share of the available processors the process used since the status was last read, or since this provider was created, the recent CPU usage of the whole system, and the system load average over the last minute.

Unlike the CPU time shown by systemctl status, which adds up all the time since the service started, this shows how busy the process is now. The available processors are those the JVM can use, which take into account the CPU quota of the service unit, set by systemd with CPUQuota.

What the operating system does not provide is left out, such as the load average, which is not available on Windows.

Author:
Joao Silva
  • Constructor Details

    • CpuStatusProvider

      public CpuStatusProvider()
      Create a new CpuStatusProvider, which reports the CPU usage of the process since it was created on the first read.
  • Method Details

    • status

      public String status()
      Description copied from interface: StatusProvider
      Exposes status information to send to systemd.
      Specified by:
      status in interface StatusProvider
      Returns:
      the string message to add to the service status