Interface ProcessCpuSampler

All Known Implementing Classes:
JavaProcessCpuSampler, OshiProcessCpuSampler

public interface ProcessCpuSampler
Since:
15.5.1
Author:
Niv Ingberg
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    CPU utilization is expressed as a fraction of 100% (dividing by the number of CPU cores), even though some vendors scale to N*100% if multiple CPUs (N CPUs) exist.
    static final long
    Indicates sample is not available.
  • Method Summary

    Modifier and Type
    Method
    Description
    default double
    getCpuLoadCumulative(long totalCpuTime, long upTime)
    Gets CPU utilization of this process as a fraction of 100%.
    long
    Gets the number of milliseconds the process has executed in kernel or user mode.
  • Field Details

    • NA

      static final long NA
      Indicates sample is not available.
      See Also:
    • cores

      static final int cores
      CPU utilization is expressed as a fraction of 100% (dividing by the number of CPU cores), even though some vendors scale to N*100% if multiple CPUs (N CPUs) exist.

      The default behavior is to divide the CPU utilization by the number of cores. To show the raw utilization reported by the underline CPU probe set the following System property com.gs.process.cpu.utilization.divideByCores with false.
  • Method Details

    • sampleTotalCpuTime

      long sampleTotalCpuTime()
      Gets the number of milliseconds the process has executed in kernel or user mode.
    • getCpuLoadCumulative

      default double getCpuLoadCumulative(long totalCpuTime, long upTime)
      Gets CPU utilization of this process as a fraction of 100%.

      This calculation sums CPU ticks across all processors and may exceed 100% for multi-threaded processes. This is consistent with the cumulative CPU presented by the "top" command on Linux/Unix machines. This value is divided by the cores to return a fraction of 100%.

      Returns:
      The proportion of up time that the process was executing in kernel or user mode.