Class NetBsdCentralProcessor

All Implemented Interfaces:
CentralProcessor

@ThreadSafe public class NetBsdCentralProcessor extends BsdCentralProcessor
NetBSD Central Processor implementation. Shares the dmesg-based topology and cache parsing with the other BSDs via BsdCentralProcessor; the processor identification, frequency, CPU ticks, and load average are read from command output and name-based sysctls specific to NetBSD.
  • Constructor Details

    • NetBsdCentralProcessor

      public NetBsdCentralProcessor()
  • Method Details

    • sysctl

      protected int sysctl(String name, int def)
      Description copied from class: BsdCentralProcessor
      Reads an integer sysctl value by name.
      Specified by:
      sysctl in class BsdCentralProcessor
      Parameters:
      name - the sysctl name
      def - the default value
      Returns:
      the sysctl integer value or the default
    • queryProcessorId

      protected CentralProcessor.ProcessorIdentifier queryProcessorId()
      Description copied from class: AbstractCentralProcessor
      Updates logical and physical processor counts and arrays
      Specified by:
      queryProcessorId in class AbstractCentralProcessor
      Returns:
      An array of initialized Logical Processors
    • queryCurrentFreq

      protected long[] queryCurrentFreq()
      Description copied from class: AbstractCentralProcessor
      Get processor current frequency.
      Specified by:
      queryCurrentFreq in class AbstractCentralProcessor
      Returns:
      The current frequency.
    • queryVmStats

      protected Pair<Long,Long> queryVmStats()
      Description copied from class: BsdCentralProcessor
      Reads the number of context switches and interrupts from vmstat. The label text and parsing differ between OpenBSD and NetBSD, so each subclass supplies its own implementation.
      Specified by:
      queryVmStats in class BsdCentralProcessor
      Returns:
      a Pair of (context switches, interrupts)
    • querySystemCpuLoadTicks

      protected long[] querySystemCpuLoadTicks()
      Get the system CPU load ticks
      Specified by:
      querySystemCpuLoadTicks in class AbstractCentralProcessor
      Returns:
      The system CPU load ticks
    • queryProcessorCpuLoadTicks

      protected long[][] queryProcessorCpuLoadTicks()
      Get the processor CPU load ticks
      Specified by:
      queryProcessorCpuLoadTicks in class AbstractCentralProcessor
      Returns:
      The processor CPU load ticks
    • getSystemLoadAverage

      public double[] getSystemLoadAverage(int nelem)
      Returns the system load average for the number of elements specified, up to 3, representing 1, 5, and 15 minutes. The system load average is the sum of the number of runnable entities queued to the available processors and the number of runnable entities running on the available processors averaged over a period of time. The way in which the load average is calculated is operating system specific but is typically a damped time-dependent average. If the load average is not available, a negative value is returned. This method is designed to provide a hint about the system load and may be queried frequently.

      The load average may be unavailable on some platforms (e.g., Windows) where it is expensive to implement this method.

      Parameters:
      nelem - Number of elements to return.
      Returns:
      an array of the system load averages for 1, 5, and 15 minutes with the size of the array specified by nelem; or negative values if not available.