Package oshi.hardware.platform.linux
Class LinuxCentralProcessor
java.lang.Object
oshi.hardware.common.AbstractCentralProcessor
oshi.hardware.platform.linux.LinuxCentralProcessor
- All Implemented Interfaces:
CentralProcessor
public class LinuxCentralProcessor extends AbstractCentralProcessor
A CPU as defined in Linux /proc.
-
Nested Class Summary
Nested classes/interfaces inherited from interface oshi.hardware.CentralProcessor
CentralProcessor.LogicalProcessor, CentralProcessor.ProcessorIdentifier, CentralProcessor.TickType -
Constructor Summary
Constructors Constructor Description LinuxCentralProcessor() -
Method Summary
Modifier and Type Method Description double[]getSystemLoadAverage(int nelem)Returns the system load average for the number of elements specified, up to 3, representing 1, 5, and 15 minutes.protected CentralProcessor.LogicalProcessor[]initProcessorCounts()Updates logical and physical processor counts and arrayslongqueryContextSwitches()Get number of context switcheslong[]queryCurrentFreq()Get processor current frequency.longqueryInterrupts()Get number of interruptslongqueryMaxFreq()Get processor max frequency.long[][]queryProcessorCpuLoadTicks()Get the processor CPU load ticksprotected CentralProcessor.ProcessorIdentifierqueryProcessorId()Updates logical and physical processor counts and arrayslong[]querySystemCpuLoadTicks()Get the system CPU load ticksMethods inherited from class oshi.hardware.common.AbstractCentralProcessor
createProcessorID, getContextSwitches, getCurrentFreq, getFamily, getIdentifier, getInterrupts, getLogicalProcessorCount, getLogicalProcessors, getMaxFreq, getModel, getName, getPhysicalPackageCount, getPhysicalProcessorCount, getProcessorCpuLoadBetweenTicks, getProcessorCpuLoadTicks, getProcessorID, getProcessorIdentifier, getStepping, getSystemCpuLoadBetweenTicks, getSystemCpuLoadTicks, getVendor, getVendorFreq, isCpu64bit, toString
-
Constructor Details
-
LinuxCentralProcessor
public LinuxCentralProcessor()
-
-
Method Details
-
queryProcessorId
Description copied from class:AbstractCentralProcessorUpdates logical and physical processor counts and arrays- Specified by:
queryProcessorIdin classAbstractCentralProcessor- Returns:
- An array of initialized Logical Processors
-
initProcessorCounts
Description copied from class:AbstractCentralProcessorUpdates logical and physical processor counts and arrays- Specified by:
initProcessorCountsin classAbstractCentralProcessor- Returns:
- An array of initialized Logical Processors
-
querySystemCpuLoadTicks
public long[] querySystemCpuLoadTicks()Description copied from class:AbstractCentralProcessorGet the system CPU load ticks- Specified by:
querySystemCpuLoadTicksin classAbstractCentralProcessor- Returns:
- The system CPU load ticks
-
queryCurrentFreq
public long[] queryCurrentFreq()Description copied from class:AbstractCentralProcessorGet processor current frequency.- Specified by:
queryCurrentFreqin classAbstractCentralProcessor- Returns:
- The current frequency.
-
queryMaxFreq
public long queryMaxFreq()Description copied from class:AbstractCentralProcessorGet processor max frequency.- Specified by:
queryMaxFreqin classAbstractCentralProcessor- Returns:
- The max frequency.
-
getSystemLoadAverage
public double[] getSystemLoadAverage(int nelem)Description copied from interface:CentralProcessorReturns 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.
-
queryProcessorCpuLoadTicks
public long[][] queryProcessorCpuLoadTicks()Description copied from class:AbstractCentralProcessorGet the processor CPU load ticks- Specified by:
queryProcessorCpuLoadTicksin classAbstractCentralProcessor- Returns:
- The processor CPU load ticks
-
queryContextSwitches
public long queryContextSwitches()Description copied from class:AbstractCentralProcessorGet number of context switches- Specified by:
queryContextSwitchesin classAbstractCentralProcessor- Returns:
- The context switches
-
queryInterrupts
public long queryInterrupts()Description copied from class:AbstractCentralProcessorGet number of interrupts- Specified by:
queryInterruptsin classAbstractCentralProcessor- Returns:
- The interrupts
-