Class OpenBsdCentralProcessor
java.lang.Object
oshi.hardware.common.AbstractCentralProcessor
oshi.hardware.common.platform.unix.BsdCentralProcessor
oshi.hardware.common.platform.unix.openbsd.OpenBsdCentralProcessor
- All Implemented Interfaces:
CentralProcessor
Shared OpenBSD CentralProcessor logic. The processor identification, frequency, and
vmstat parsing are common
to the JNA and FFM backends; subclasses supply only the sysctl reads (mib- and name-based) and the native CPU-tick
and load-average calls.-
Nested Class Summary
Nested classes/interfaces inherited from interface CentralProcessor
CentralProcessor.LogicalProcessor, CentralProcessor.PhysicalProcessor, CentralProcessor.ProcessorCache, CentralProcessor.ProcessorIdentifier, CentralProcessor.TickTypeModifier and TypeInterfaceDescriptionstatic classA class representing a Logical Processor and its replationship to physical processors, physical packages, and logical groupings such as NUMA Nodes and Processor groups, useful for identifying processor topology.static classA class representing a Physical Processor (a core) providing per-core statistics that may vary, particularly in hybrid/modular processors.static classA class representing CPU Cache Memory.static final classA class encapsulating ghe CPU's identifier strings ,including name, vendor, stepping, model, and family information (also called the signature of a CPU)static enumIndex of CPU tick counters in theCentralProcessor.getSystemCpuLoadTicks()andCentralProcessor.getProcessorCpuLoadTicks()arrays. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected long[]Get processor current frequency.protected CentralProcessor.ProcessorIdentifierUpdates logical and physical processor counts and arraysReads the number of context switches and interrupts fromvmstat.protected abstract intsysctl(int[] mib, int def) Reads an integer sysctl value addressed by a Management Information Base (MIB) array.protected abstract StringReads a string sysctl value addressed by a Management Information Base (MIB) array.protected abstract StringReads a string sysctl value by name.Methods inherited from class BsdCentralProcessor
initProcessorCounts, queryContextSwitches, queryInterrupts, sysctlModifier and TypeMethodDescriptionprotected Quartet<List<CentralProcessor.LogicalProcessor>, List<CentralProcessor.PhysicalProcessor>, List<CentralProcessor.ProcessorCache>, List<String>> Initializes logical and physical processor lists and feature flags.protected longGet number of context switchesprotected longGet number of interruptsprotected abstract intReads an integer sysctl value by name.Methods inherited from class AbstractCentralProcessor
createProcessorID, createProcessorID, createProcListFromDmesg, getContextSwitches, getCurrentFreq, getFeatureFlags, getInterrupts, getLogicalProcessorCount, getLogicalProcessors, getMaxFreq, getPhysicalPackageCount, getPhysicalProcessorCount, getPhysicalProcessors, getProcessorCaches, getProcessorCpuLoadBetweenTicks, getProcessorCpuLoadBetweenTicks, getProcessorCpuLoadTicks, getProcessorIdentifier, getSystemCpuLoadBetweenTicks, getSystemCpuLoadBetweenTicks, getSystemCpuLoadTicks, orderedProcCaches, queryMaxFreq, queryProcessorCpuLoadTicks, querySystemCpuLoadTicks, toStringModifier and TypeMethodDescriptionprotected static StringcreateProcessorID(String stepping, String model, String family, String[] flags) Creates a Processor ID by encoding the stepping, model, family, and feature flags.protected static StringcreateProcessorID(String stepping, String model, String family, String[] flags, long hwcap) Creates a Processor ID by encoding the stepping, model, family, and feature flags.protected List<CentralProcessor.PhysicalProcessor> createProcListFromDmesg(List<CentralProcessor.LogicalProcessor> logProcs, Map<Integer, String> dmesg) Creates a list of physical processors from dmesg output.longGet the number of system-wide context switches which have occurred.long[]Attempts to return the current frequency (in Hz), of the logical processors on this CPU.Returns a list of platform-specific strings which identify CPU Feature Flags.longGet the number of system-wide interrupts which have occurred.intGet the number of logical CPUs available for processing.Returns anUnmodifiableListof the CPU's logical processors.longMaximum frequeny (in Hz), of the logical processors on this CPU.intGet the number of packages/sockets in the system.intGet the number of physical CPUs/cores available for processing.Returns anUnmodifiableListof the CPU's physical processors.Makes a best-effort attempt to identify the CPU's processor caches.double[]getProcessorCpuLoadBetweenTicks(long[][] oldTicks) Returns the "recent cpu usage" for all logical processors by counting ticks fromCentralProcessor.getProcessorCpuLoadTicks()between the user-provided value from a previous call.double[]getProcessorCpuLoadBetweenTicks(long[][] oldTicks, long[][] ticks) Returns the "recent cpu usage" for all logical processors by counting ticks fromCentralProcessor.getProcessorCpuLoadTicks()between the user-provided value from a previous call.long[][]Get Processor CPU Load tick counters.The CPU's identifier strings ,including name, vendor, stepping, model, and family information (also called the signature of a CPU).doublegetSystemCpuLoadBetweenTicks(long[] oldTicks) Returns the "recent cpu usage" for the whole system by counting ticks fromCentralProcessor.getSystemCpuLoadTicks()between the user-provided value from a previous call.doublegetSystemCpuLoadBetweenTicks(long[] oldTicks, long[] ticks) Returns the "recent cpu usage" for the whole system by counting ticks between two user-provided values, retrieved fromCentralProcessor.getSystemCpuLoadTicks()at different points in time.long[]Get System-wide CPU Load tick counters.static List<CentralProcessor.ProcessorCache> Filters a set of processor caches to an ordered listprotected longGet processor max frequency.protected abstract long[][]Get the processor CPU load ticksprotected abstract long[]Get the system CPU load tickstoString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface CentralProcessor
getProcessorCpuLoad, getSystemCpuLoad, getSystemLoadAverageModifier and TypeMethodDescriptiondefault double[]getProcessorCpuLoad(long delay) This is a convenience method which collects an initial set of ticks usingCentralProcessor.getProcessorCpuLoadTicks()and passes that result toCentralProcessor.getProcessorCpuLoadBetweenTicks(long[][])after the specified delay.default doublegetSystemCpuLoad(long delay) This is a convenience method which collects an initial set of ticks usingCentralProcessor.getSystemCpuLoadTicks()and passes that result toCentralProcessor.getSystemCpuLoadBetweenTicks(long[])after the specified delay.double[]getSystemLoadAverage(int nelem) Returns the system load average for the number of elements specified, up to 3, representing 1, 5, and 15 minutes.
-
Constructor Details
-
OpenBsdCentralProcessor
public OpenBsdCentralProcessor()
-
-
Method Details
-
sysctl
-
sysctl
-
sysctl
protected abstract int sysctl(int[] mib, int def) Reads an integer sysctl value addressed by a Management Information Base (MIB) array.- Parameters:
mib- the sysctl MIBdef- the default value- Returns:
- the sysctl integer value or the default
-
queryProcessorId
Description copied from class:AbstractCentralProcessorUpdates logical and physical processor counts and arrays- Specified by:
queryProcessorIdin classAbstractCentralProcessor- Returns:
- An array of initialized Logical Processors
-
queryCurrentFreq
protected long[] queryCurrentFreq()Description copied from class:AbstractCentralProcessorGet processor current frequency.- Specified by:
queryCurrentFreqin classAbstractCentralProcessor- Returns:
- The current frequency.
-
queryVmStats
Description copied from class:BsdCentralProcessorReads the number of context switches and interrupts fromvmstat. The label text and parsing differ between OpenBSD and NetBSD, so each subclass supplies its own implementation.- Specified by:
queryVmStatsin classBsdCentralProcessor- Returns:
- a
Pairof (context switches, interrupts)
-