Class OpenBsdCentralProcessor

All Implemented Interfaces:
CentralProcessor

public abstract class OpenBsdCentralProcessor extends BsdCentralProcessor
Shared OpenBSD CentralProcessor logic. The processor identification, frequency, and vmstat parsing are common to the JNA and FFM backends; subclasses supply only the sysctl reads (mib- and name-based) and the native CPU-tick and load-average calls.
  • Constructor Details

    • OpenBsdCentralProcessor

      public OpenBsdCentralProcessor()
  • Method Details

    • sysctl

      protected abstract String sysctl(String name, String def)
      Reads a string sysctl value by name.
      Parameters:
      name - the sysctl name
      def - the default value
      Returns:
      the sysctl string value or the default
    • sysctl

      protected abstract String sysctl(int[] mib, String def)
      Reads a string sysctl value addressed by a Management Information Base (MIB) array.
      Parameters:
      mib - the sysctl MIB
      def - the default value
      Returns:
      the sysctl string value or the default
    • sysctl

      protected abstract int sysctl(int[] mib, int def)
      Reads an integer sysctl value addressed by a Management Information Base (MIB) array.
      Parameters:
      mib - the sysctl MIB
      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)