Class OpenBsdCentralProcessor
- java.lang.Object
-
- oshi.hardware.common.AbstractCentralProcessor
-
- oshi.hardware.platform.unix.openbsd.OpenBsdCentralProcessor
-
- All Implemented Interfaces:
CentralProcessor
@ThreadSafe public class OpenBsdCentralProcessor extends AbstractCentralProcessor
OpenBSD Central Processor implementation
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface oshi.hardware.CentralProcessor
CentralProcessor.LogicalProcessor, CentralProcessor.PhysicalProcessor, CentralProcessor.ProcessorCache, CentralProcessor.ProcessorIdentifier, CentralProcessor.TickType
-
-
Constructor Summary
Constructors Constructor Description OpenBsdCentralProcessor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static long[]
cpTimeToTicks(com.sun.jna.Memory m, boolean force64bit)
Parse memory buffer returned from sysctl kern.cptime or kern.cptime2 to an array of 5 or 6 longs depending on version.private static Triplet<java.lang.Integer,java.lang.Integer,java.lang.Integer>
cpuidToFamilyModelStepping(int cpuid)
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 Quartet<java.util.List<CentralProcessor.LogicalProcessor>,java.util.List<CentralProcessor.PhysicalProcessor>,java.util.List<CentralProcessor.ProcessorCache>,java.util.List<java.lang.String>>
initProcessorCounts()
Initializes logical and physical processor lists and feature flags.private CentralProcessor.ProcessorCache
parseCacheStr(java.lang.String cacheStr)
protected long
queryContextSwitches()
Get number of context switchesprotected long[]
queryCurrentFreq()
Get processor current frequency.protected long
queryInterrupts()
Get number of interruptsprotected long[][]
queryProcessorCpuLoadTicks()
Get the processor CPU load ticksprotected CentralProcessor.ProcessorIdentifier
queryProcessorId()
Updates logical and physical processor counts and arraysprotected long[]
querySystemCpuLoadTicks()
Get the system CPU load ticksprivate static Pair<java.lang.Long,java.lang.Long>
queryVmStats()
-
Methods inherited from class oshi.hardware.common.AbstractCentralProcessor
createProcessorID, createProcListFromDmesg, getContextSwitches, getCurrentFreq, getFeatureFlags, getInterrupts, getLogicalProcessorCount, getLogicalProcessors, getMaxFreq, getPhysicalPackageCount, getPhysicalProcessorCount, getPhysicalProcessors, getProcessorCaches, getProcessorCpuLoadBetweenTicks, getProcessorCpuLoadTicks, getProcessorIdentifier, getSystemCpuLoadBetweenTicks, getSystemCpuLoadTicks, orderedProcCaches, queryMaxFreq, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface oshi.hardware.CentralProcessor
getProcessorCpuLoad, getSystemCpuLoad
-
-
-
-
Field Detail
-
vmStats
private final java.util.function.Supplier<Pair<java.lang.Long,java.lang.Long>> vmStats
-
DMESG_CPU
private static final java.util.regex.Pattern DMESG_CPU
-
-
Method Detail
-
queryProcessorId
protected CentralProcessor.ProcessorIdentifier queryProcessorId()
Description copied from class:AbstractCentralProcessor
Updates logical and physical processor counts and arrays- Specified by:
queryProcessorId
in classAbstractCentralProcessor
- Returns:
- An array of initialized Logical Processors
-
cpuidToFamilyModelStepping
private static Triplet<java.lang.Integer,java.lang.Integer,java.lang.Integer> cpuidToFamilyModelStepping(int cpuid)
-
queryCurrentFreq
protected long[] queryCurrentFreq()
Description copied from class:AbstractCentralProcessor
Get processor current frequency.- Specified by:
queryCurrentFreq
in classAbstractCentralProcessor
- Returns:
- The current frequency.
-
initProcessorCounts
protected Quartet<java.util.List<CentralProcessor.LogicalProcessor>,java.util.List<CentralProcessor.PhysicalProcessor>,java.util.List<CentralProcessor.ProcessorCache>,java.util.List<java.lang.String>> initProcessorCounts()
Description copied from class:AbstractCentralProcessor
Initializes logical and physical processor lists and feature flags.- Specified by:
initProcessorCounts
in classAbstractCentralProcessor
- Returns:
- Lists of initialized Logical Processors, Physical Processors, Processor Caches, and Feature Flags.
-
parseCacheStr
private CentralProcessor.ProcessorCache parseCacheStr(java.lang.String cacheStr)
-
queryContextSwitches
protected long queryContextSwitches()
Get number of context switches- Specified by:
queryContextSwitches
in classAbstractCentralProcessor
- Returns:
- The context switches
-
queryInterrupts
protected long queryInterrupts()
Get number of interrupts- Specified by:
queryInterrupts
in classAbstractCentralProcessor
- Returns:
- The interrupts
-
queryVmStats
private static Pair<java.lang.Long,java.lang.Long> queryVmStats()
-
querySystemCpuLoadTicks
protected long[] querySystemCpuLoadTicks()
Get the system CPU load ticks- Specified by:
querySystemCpuLoadTicks
in classAbstractCentralProcessor
- Returns:
- The system CPU load ticks
-
queryProcessorCpuLoadTicks
protected long[][] queryProcessorCpuLoadTicks()
Get the processor CPU load ticks- Specified by:
queryProcessorCpuLoadTicks
in classAbstractCentralProcessor
- Returns:
- The processor CPU load ticks
-
cpTimeToTicks
private static long[] cpTimeToTicks(com.sun.jna.Memory m, boolean force64bit)
Parse memory buffer returned from sysctl kern.cptime or kern.cptime2 to an array of 5 or 6 longs depending on version.Versions 6.4 and later have a 6-element array while earlier versions have only 5 elements. Additionally kern.cptime uses a native-sized long (32- or 64-bit) value while kern.cptime2 is always a 64-bit value.
- Parameters:
m
- A buffer containing the array.force64bit
- True if the buffer is filled with 64-bit longs, false if native long sized values- Returns:
- The array
-
getSystemLoadAverage
public double[] getSystemLoadAverage(int nelem)
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. 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.
-
-