Class LoadAverage

java.lang.Object
oshi.driver.common.windows.perfmon.LoadAverage

@ThreadSafe public abstract class LoadAverage extends Object
Utility to calculate a load average equivalent metric on Windows. Starts a daemon thread to collect the necessary counters and averages in 5-second intervals. Subclasses provide the platform-specific perfmon queries.
  • Constructor Details

    • LoadAverage

      protected LoadAverage()
      Default constructor.
  • Method Details

    • queryNonIdleTicks

      protected abstract Pair<Long,Long> queryNonIdleTicks()
      Query the non-idle ticks from performance counters.
      Returns:
      A pair of (nonIdleTicks, nonIdleBase) values
    • queryQueueLength

      protected abstract long queryQueueLength()
      Query the processor queue length from performance counters.
      Returns:
      The processor queue length
    • queryLoadAverage

      public double[] queryLoadAverage(int nelem)
      Queries the load average values.
      Parameters:
      nelem - number of elements to return (1, 2, or 3)
      Returns:
      array of load averages
    • stopDaemon

      public void stopDaemon()
      Stops the load average daemon thread.
    • startDaemon

      public void startDaemon()
      Starts the load average daemon thread.