Class WindowsCentralProcessor

java.lang.Object
oshi.hardware.common.AbstractCentralProcessor
oshi.hardware.common.platform.windows.WindowsCentralProcessor
All Implemented Interfaces:
CentralProcessor

@ThreadSafe public abstract class WindowsCentralProcessor extends AbstractCentralProcessor
Common non-native logic for Windows Central Processor implementations.
  • Field Details

    • USE_LEGACY_SYSTEM_COUNTERS

      protected static final boolean USE_LEGACY_SYSTEM_COUNTERS
      Whether to use legacy Processor counters rather than Processor Information counters.
    • USE_LOAD_AVERAGE

      protected static final boolean USE_LOAD_AVERAGE
      Whether to start a daemon thread to calculate load average.
    • USE_CPU_UTILITY

      protected static final boolean USE_CPU_UTILITY
      Whether to match task manager using Processor Utility ticks.
  • Constructor Details

    • WindowsCentralProcessor

      protected WindowsCentralProcessor()
      Default constructor.
  • Method Details

    • getNumaNodeProcToLogicalProcMap

      protected Map<String,Integer> getNumaNodeProcToLogicalProcMap()
      Gets the numaNodeProcToLogicalProcMap.
      Returns:
      the map
    • getInitialUtilityCounters

      protected Map<ProcessorInformation.ProcessorUtilityTickCountProperty, List<Long>> getInitialUtilityCounters()
      Gets the initial utility counters.
      Returns:
      the initial utility counters
    • setInitialUtilityCounters

      protected void setInitialUtilityCounters(Map<ProcessorInformation.ProcessorUtilityTickCountProperty, List<Long>> counters)
      Sets the initial utility counters.
      Parameters:
      counters - the counters to set
    • buildNumaNodeProcMap

      protected void buildNumaNodeProcMap(List<CentralProcessor.LogicalProcessor> logProcs)
      Builds the numaNodeProcToLogicalProcMap from the logical processor list.
      Parameters:
      logProcs - the list of logical processors
    • parseIdentifier

      protected static String parseIdentifier(String identifier, String key)
      Parses identifier string
      Parameters:
      identifier - the full identifier string
      key - the key to retrieve
      Returns:
      the string following id
    • lazilyCalculateMultiplier

      protected long lazilyCalculateMultiplier(long deltaBase, long deltaT)
      Lazily calculate the capacity tick multiplier once.
      Parameters:
      deltaBase - The difference in base ticks.
      deltaT - The difference in elapsed 100NS time
      Returns:
      The ratio of elapsed time to base ticks
    • queryProcessorUtilityCounters

      protected Map<ProcessorInformation.ProcessorUtilityTickCountProperty, List<Long>> queryProcessorUtilityCounters()
      Provides the current utility counters for re-initialization.
      Returns:
      the current processor utility counter values
    • queryProcessorCapacityCounters

      protected abstract Pair<List<String>, Map<ProcessorInformation.ProcessorUtilityTickCountProperty, List<Long>>> queryProcessorCapacityCounters()
      Subclasses query the perfmon Processor Information capacity (utility) counters via their JNA or FFM driver.
      Returns:
      the instance names and processor capacity/utility counter values
    • queryProcessorCounters

      protected abstract Pair<List<String>, Map<ProcessorInformation.ProcessorTickCountProperty, List<Long>>> queryProcessorCounters()
      Subclasses query the perfmon Processor Information tick counters via their JNA or FFM driver.
      Returns:
      the instance names and processor tick counter values
    • queryProcessorCpuLoadTicks

      public long[][] queryProcessorCpuLoadTicks()
      Description copied from class: AbstractCentralProcessor
      Get the processor CPU load ticks
      Specified by:
      queryProcessorCpuLoadTicks in class AbstractCentralProcessor
      Returns:
      The processor CPU load ticks
    • processTickData

      protected long[][] processTickData(List<String> instances, List<Long> systemList, List<Long> userList, List<Long> irqList, List<Long> softIrqList, List<Long> idleList, List<Long> baseList, List<Long> systemUtility, List<Long> processorUtility, List<Long> processorUtilityBase, List<Long> initSystemList, List<Long> initUserList, List<Long> initBase, List<Long> initSystemUtility, List<Long> initProcessorUtility, List<Long> initProcessorUtilityBase)
      Processes raw perfmon tick data into the standard tick array format. Handles both legacy and utility-based approaches.
      Parameters:
      instances - the perfmon instance names
      systemList - system (privileged) time ticks
      userList - user time ticks
      irqList - IRQ time ticks
      softIrqList - soft IRQ (DPC) time ticks
      idleList - idle time ticks
      baseList - timestamp base (for utility mode), may be null
      systemUtility - system utility ticks, may be null
      processorUtility - processor utility ticks, may be null
      processorUtilityBase - processor utility base, may be null
      initSystemList - initial system ticks (for utility mode), may be null
      initUserList - initial user ticks (for utility mode), may be null
      initBase - initial base (for utility mode), may be null
      initSystemUtility - initial system utility, may be null
      initProcessorUtility - initial processor utility, may be null
      initProcessorUtilityBase - initial processor utility base, may be null
      Returns:
      the processed tick array