CentralProcessorImpl

class CentralProcessorImpl(val centralProcessorInfo: CentralProcessor) : CentralProcessor

CentralProcessorImpl provides an implementation of the CentralProcessor interface. This class retrieves information about the system's central processing unit (CPU), including its features, load, and performance metrics, leveraging the OSHI library.

Author

N7ghtm4r3

Parameters

centralProcessorInfo

The oshi.hardware.CentralProcessor instance used to fetch CPU details.

See also

Constructors

Link copied to clipboard
constructor(centralProcessorInfo: CentralProcessor)

Properties

Link copied to clipboard
private val centralProcessorInfo: CentralProcessor
Link copied to clipboard
open override val contextSwitches: Long

contextSwitches contains the total number of context switches that have occurred.

Link copied to clipboard
open override val currentFreq: LongArray

currentFreq contains an array of current frequencies for each logical processor in hertz.

Link copied to clipboard
open override val featureFlags: List<String>

featureFlags lists the CPU's supported features, such as instruction sets and extensions.

Link copied to clipboard
open override val interrupts: Long

interrupts contains the total number of interrupts that have occurred.

Link copied to clipboard
open override val logicalProcessorCount: Int

logicalProcessorCount provides the number of logical processors in the system.

Link copied to clipboard

logicalProcessors returns a list of logical processors, each representing a core or a thread.

Link copied to clipboard
open override val maxFreq: Long

maxFreq represents the maximum frequency of the processor in hertz.

Link copied to clipboard
open override val physicalPackageCount: Int

physicalPackageCount returns the number of physical processor packages in the system.

Link copied to clipboard
open override val physicalProcessorCount: Int

physicalProcessorCount provides the number of physical processors (cores) in the system.

Link copied to clipboard

physicalProcessors provides a list of physical processors, representing the physical cores in the system.

Link copied to clipboard
open override val processorCaches: List<ProcessorCache>

processorCaches returns a list of processor caches, detailing cache levels, sizes, and types.

Link copied to clipboard

processorCpuLoadTicks contains an array of tick counters for each logical processor, representing the CPU load distribution.

Link copied to clipboard

processorIdentifier provides detailed information about the processor, such as vendor, name, stepping, and model.

Link copied to clipboard
open override val systemCpuLoadTicks: LongArray

systemCpuLoadTicks contains an array of tick counters representing system-wide CPU load.

Functions

Link copied to clipboard

getProcessorCpuLoadBetweenTicks calculates the CPU load for each logical processor, based on the difference between old and current tick counters.

Link copied to clipboard
open override fun getSystemCpuLoad(delay: Long): Double

getSystemCpuLoad calculates the CPU load for the system over a specified delay.

Link copied to clipboard
open override fun getSystemCpuLoadBetweenTicks(oldTickets: LongArray): Double

getSystemCpuLoadBetweenTicks calculates the system's CPU load as a percentage, based on the difference between old and current tick counters.

Link copied to clipboard
open override fun getSystemLoadAverage(nelem: Int): DoubleArray

getSystemLoadAverage retrieves the system's load average over a specified number of intervals.

Link copied to clipboard
private fun loadLogicalProcessors(sourceList: List<CentralProcessor.LogicalProcessor>): List<LogicalProcessor>

Loads a list of logical processors with their detailed attributes.

Link copied to clipboard
private fun loadPhysicalProcessors(sourceList: List<CentralProcessor.PhysicalProcessor>): List<PhysicalProcessor>

Loads a list of physical processors with their detailed attributes.

Link copied to clipboard
private fun loadProcessorCache(sourceList: List<CentralProcessor.ProcessorCache>): List<ProcessorCache>

Loads a list of processor caches with their attributes such as size and type.