public interface CentralProcessor
| Modifier and Type | Interface and Description |
|---|---|
static class |
CentralProcessor.LogicalProcessor
A 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 class |
CentralProcessor.ProcessorIdentifier
A class encapsulating ghe CPU's identifier strings ,including name, vendor,
stepping, model, and family information (also called the signature of a CPU)
|
static class |
CentralProcessor.TickType
Index of CPU tick counters in the
getSystemCpuLoadTicks() and
getProcessorCpuLoadTicks() arrays. |
| Modifier and Type | Method and Description |
|---|---|
long |
getContextSwitches()
Get the number of context switches which have occurred
|
long[] |
getCurrentFreq()
Attempts to return the current frequency (in Hz), of the logical processors
on this CPU.
|
String |
getFamily()
Deprecated.
As of 4.1.0, replaced by
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getFamily() |
String |
getIdentifier()
Deprecated.
As of 4.1.0, replaced by
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getIdentifier() |
long |
getInterrupts()
Get the number of interrupts which have occurred
|
int |
getLogicalProcessorCount()
Get the number of logical CPUs available for processing.
|
CentralProcessor.LogicalProcessor[] |
getLogicalProcessors()
Returns an array of the CPU's logical processors.
|
long |
getMaxFreq()
Maximum frequeny (in Hz), of the logical processors on this CPU.
|
String |
getModel()
Deprecated.
As of 4.1.0, replaced by
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getModel() |
String |
getName()
Deprecated.
As of 4.1.0, replaced by
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getName() |
int |
getPhysicalPackageCount()
Get the number of packages/sockets in the system.
|
int |
getPhysicalProcessorCount()
Get the number of physical CPUs/cores available for processing.
|
double[] |
getProcessorCpuLoadBetweenTicks(long[][] oldTicks)
Returns the "recent cpu usage" for all logical processors by counting ticks
from
getProcessorCpuLoadTicks() between the user-provided value from
a previous call. |
long[][] |
getProcessorCpuLoadTicks()
Get Processor CPU Load tick counters.
|
String |
getProcessorID()
Deprecated.
As of 4.1.0, replaced by
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getProcessorID() |
CentralProcessor.ProcessorIdentifier |
getProcessorIdentifier()
The CPU's identifier strings ,including name, vendor, stepping, model, and
family information (also called the signature of a CPU)
|
String |
getStepping()
Deprecated.
As of 4.1.0, replaced by
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getStepping() |
double |
getSystemCpuLoadBetweenTicks(long[] oldTicks)
Returns the "recent cpu usage" for the whole system by counting ticks from
getSystemCpuLoadTicks() between the user-provided value from a
previous call. |
long[] |
getSystemCpuLoadTicks()
Get System-wide CPU Load tick counters.
|
double[] |
getSystemLoadAverage(int nelem)
Returns the system load average for the number of elements specified, up to
3, representing 1, 5, and 15 minutes.
|
String |
getVendor()
Deprecated.
As of 4.1.0, replaced by
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getVendor() |
long |
getVendorFreq()
Deprecated.
As of 4.1.0, replaced by
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getVendorFreq() |
boolean |
isCpu64bit()
Deprecated.
As of 4.1.0, replaced by
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.isCpu64bit() |
CentralProcessor.ProcessorIdentifier getProcessorIdentifier()
CentralProcessor.ProcessorIdentifier object encapsulating CPU identifier
information.@Deprecated String getVendor()
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getVendor()@Deprecated String getName()
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getName()@Deprecated String getFamily()
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getFamily()@Deprecated String getModel()
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getModel()@Deprecated String getStepping()
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getStepping()@Deprecated String getProcessorID()
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getProcessorID()getIdentifier() . The remaining four bytes are the contents of the
EDX register, containing feature flags.
For processors that do not support the CPUID opcode this field is populated with a comparable hex string. For example, ARM Processors will fill the first 32 bytes with the MIDR.
NOTE: The order of returned bytes is platform and software dependent. Values may be in either Big Endian or Little Endian order.
NOTE: If OSHI is unable to determine the ProcessorID from native sources, it will attempt to reconstruct one from available information in the processor identifier.
@Deprecated String getIdentifier()
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getIdentifier()@Deprecated boolean isCpu64bit()
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.isCpu64bit()@Deprecated long getVendorFreq()
getProcessorIdentifier().CentralProcessor.ProcessorIdentifier.getVendorFreq()long getMaxFreq()
long[] getCurrentFreq()
May not be implemented on all Operating Systems.
On Windows, returns an estimate based on the percent of maximum frequency. On Windows systems with more than 64 logical processors, may only return frequencies for the current processor group in the first portion of the array.
getLogicalProcessors() to correlate these
frequencies with physical packages and processors.CentralProcessor.LogicalProcessor[] getLogicalProcessors()
double getSystemCpuLoadBetweenTicks(long[] oldTicks)
getSystemCpuLoadTicks() between the user-provided value from a
previous call.oldTicks - A tick array from a previous call to
getSystemCpuLoadTicks()long[] getSystemCpuLoadTicks()
CentralProcessor.TickType.getIndex() to retrieve the
appropriate index. By measuring the difference between ticks across a time
interval, CPU load over that interval may be calculated.
Note that while tick counters are in units of milliseconds, they may advance in larger increments along with (platform dependent) clock ticks. For example, by default Windows clock ticks are 1/64 of a second (about 15 or 16 milliseconds) and Linux ticks are distribution and configuration dependent but usually 1/100 of a second (10 milliseconds).
Nice and IOWait information is not available on Windows, and IOwait and IRQ information is not available on macOS, so these ticks will always be zero.
To calculate overall Idle time using this method, include both Idle and IOWait ticks. Similarly, IRQ, SoftIRQ, and Steal ticks should be added to the System value to get the total. System ticks also include time executing other virtual hosts (steal).
double[] getSystemLoadAverage(int nelem)
The load average may be unavailable on some platforms (e.g., Windows) where it is expensive to implement this method.
nelem - Number of elements to return.double[] getProcessorCpuLoadBetweenTicks(long[][] oldTicks)
getProcessorCpuLoadTicks() between the user-provided value from
a previous call.oldTicks - A tick array from a previous call to
getProcessorCpuLoadTicks()long[][] getProcessorCpuLoadTicks()
getLogicalProcessorCount() arrays, each containing seven elements
representing milliseconds spent in User (0), Nice (1), System (2), Idle (3),
IOwait (4), Hardware interrupts (IRQ) (5), Software interrupts/DPC (SoftIRQ)
(6), or Steal (7) states. Use
CentralProcessor.TickType.getIndex() to retrieve the
appropriate index. By measuring the difference between ticks across a time
interval, CPU load over that interval may be calculated.
Note that while tick counters are in units of milliseconds, they may advance in larger increments along with (platform dependent) clock ticks. For example, by default Windows clock ticks are 1/64 of a second (about 15 or 16 milliseconds) and Linux ticks are distribution and configuration dependent but usually 1/100 of a second (10 milliseconds).
Nice and IOwait per processor information is not available on Windows, and IOwait and IRQ information is not available on macOS, so these ticks will always be zero.
To calculate overall Idle time using this method, include both Idle and IOWait ticks. Similarly, IRQ, SoftIRQ and Steal ticks should be added to the System value to get the total. System ticks also include time executing other virtual hosts (steal).
int getLogicalProcessorCount()
int getPhysicalProcessorCount()
int getPhysicalPackageCount()
long getContextSwitches()
long getInterrupts()
Copyright © 2019. All rights reserved.