Class WindowsCentralProcessor

    • Field Detail

      • LOG

        private static final org.slf4j.Logger LOG
      • numaNodeProcToLogicalProcMap

        private java.util.Map<java.lang.String,​java.lang.Integer> numaNodeProcToLogicalProcMap
      • USE_LEGACY_SYSTEM_COUNTERS

        private static final boolean USE_LEGACY_SYSTEM_COUNTERS
      • USE_LOAD_AVERAGE

        private static final boolean USE_LOAD_AVERAGE
      • USE_CPU_UTILITY

        private static final boolean USE_CPU_UTILITY
      • utilityBaseMultiplier

        private java.lang.Long utilityBaseMultiplier
    • Constructor Detail

      • WindowsCentralProcessor

        WindowsCentralProcessor()
    • Method Detail

      • parseIdentifier

        private static java.lang.String parseIdentifier​(java.lang.String identifier,
                                                        java.lang.String key)
        Parses identifier string
        Parameters:
        identifier - the full identifier string
        key - the key to retrieve
        Returns:
        the string following id
      • queryNTPower

        private long[] queryNTPower​(int fieldIndex)
        Call CallNTPowerInformation for Processor information and return an array of the specified index
        Parameters:
        fieldIndex - The field, in order as defined in the PowrProf#PROCESSOR_INFORMATION structure.
        Returns:
        The array of values.
      • getSystemLoadAverage

        public double[] getSystemLoadAverage​(int nelem)
        Description copied from interface: CentralProcessor
        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.

        This method is designed to provide a hint about the system load and may be queried frequently.

        The way in which the load average is calculated is operating system specific but is typically a damped time-dependent average. Linux includes processes waiting for system resources such as disks, while macOS and Unix consider only processes waiting for CPU.

        Windows does not provide a load average. Users may set the configuration property oshi.os.windows.loadaverage to true to start a daemon thread which will provide a similar metric.

        The load average may be unavailable on some platforms (e.g., Windows without the above configuration). If the load average is not available, a negative value is returned.

        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.
      • lazilyCalculateMultiplier

        private 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