public interface CentralProcessor extends Serializable
| Modifier and Type | Interface and Description |
|---|---|
static class |
CentralProcessor.TickType
Index of CPU tick counters in the
getSystemCpuLoadTicks() and
getProcessorCpuLoadTicks() arrays. |
| Modifier and Type | Method and Description |
|---|---|
String |
getFamily() |
String |
getIdentifier()
Identifier, eg.
|
int |
getLogicalProcessorCount()
Get the number of logical CPUs available for processing.
|
String |
getModel() |
String |
getName()
Name, eg.
|
int |
getPhysicalProcessorCount()
Get the number of physical CPUs/cores available for processing.
|
double[] |
getProcessorCpuLoadBetweenTicks()
Returns the "recent cpu usage" for all logical processors by counting
ticks for the processors from
getProcessorCpuLoadTicks() between
successive calls of this method, with a minimum interval slightly less
than 1 second. |
long[][] |
getProcessorCpuLoadTicks()
Get Processor CPU Load tick counters.
|
String |
getProcessorID()
Gets the Processor ID.
|
String |
getStepping() |
double |
getSystemCpuLoad()
Returns the "recent cpu usage" for the whole system from
OperatingSystemMXBean.getSystemCpuLoad() if a
user is running the Oracle JVM. |
double |
getSystemCpuLoadBetweenTicks()
Returns the "recent cpu usage" for the whole system by counting ticks
from
getSystemCpuLoadTicks() between successive calls of this
method, with a minimum interval slightly less than 1 second. |
long[] |
getSystemCpuLoadTicks()
Get System-wide CPU Load tick counters.
|
double |
getSystemLoadAverage()
Returns the system load average for the last minute.
|
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 |
getSystemSerialNumber()
Deprecated.
use
ComputerSystem.getSerialNumber() instead. |
long |
getSystemUptime()
Get the System uptime (time since boot).
|
String |
getVendor()
Processor vendor.
|
long |
getVendorFreq()
Vendor frequency (in Hz), eg.
|
boolean |
isCpu64bit()
Is CPU 64bit?
|
void |
setCpu64(boolean cpu64)
Set flag is cpu is 64bit.
|
void |
setFamily(String family) |
void |
setIdentifier(String identifier)
Set processor identifier.
|
void |
setModel(String model) |
void |
setName(String name)
Set processor name.
|
void |
setProcessorID(String processorID)
Set processor ID
|
void |
setStepping(String stepping) |
void |
setVendor(String vendor)
Set processor vendor.
|
void |
setVendorFreq(long freq)
Set processor vendor frequency (in Hz).
|
String getVendor()
void setVendor(String vendor)
vendor - Vendor.String getName()
void setName(String name)
name - Name.long getVendorFreq()
void setVendorFreq(long freq)
freq - Frequency.String getProcessorID()
getIdentifier() . The remaining four
bytes are the contents of the EDX register, containing feature flags.
NOTE: The order of returned bytes is platform and software dependent.
Values may be in either Big Endian or Little Endian order.void setProcessorID(String processorID)
processorID - The processor IDString getIdentifier()
void setIdentifier(String identifier)
identifier - Identifier.boolean isCpu64bit()
void setCpu64(boolean cpu64)
cpu64 - True if cpu is 64.String getStepping()
void setStepping(String stepping)
stepping - the stepping to setString getModel()
void setModel(String model)
model - the model to setString getFamily()
void setFamily(String family)
family - the family to setdouble getSystemCpuLoadBetweenTicks()
getSystemCpuLoadTicks() between successive calls of this
method, with a minimum interval slightly less than 1 second. If less than
one second has elapsed since the last call of this method, it will return
a calculation based on the tick counts and times of the previous two
calls. If at least a second has elapsed, it will return the average CPU
load for the interval and update the "last called" times. This method is
intended to be used for periodic polling at intervals of 1 second or
longer.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.
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 and SoftIRQ ticks should be added to the
System value to get the total. System ticks also include time executing
other virtual hosts (steal).double getSystemCpuLoad()
OperatingSystemMXBean.getSystemCpuLoad() if a
user is running the Oracle JVM. This value is a double in the [0.0,1.0]
interval. A value of 0.0 means that all CPUs were idle during the recent
period of time observed, while a value of 1.0 means that all CPUs were
actively running 100% of the time during the recent period being
observed. All values between 0.0 and 1.0 are possible depending of the
activities going on in the system. If the system recent cpu usage is not
available, the method returns a negative value. Calling this method
immediately upon instantiating the CentralProcessor may give
unreliable results. If a user is not running the Oracle JVM, this method
will default to the behavior and return value of
getSystemCpuLoadBetweenTicks().double getSystemLoadAverage()
getSystemLoadAverage(int) with an
argument of 1 and returning the first value, and is retained for
compatibility.double[] getSystemLoadAverage(int nelem)
nelem - Number of elements to return.double[] getProcessorCpuLoadBetweenTicks()
getProcessorCpuLoadTicks() between
successive calls of this method, with a minimum interval slightly less
than 1 second. If less than one second has elapsed since the last call of
this method, it will return a calculation based on the tick counts and
times of the previous two calls. If at least a second has elapsed, it
will return the average CPU load for the interval and update the
"last called" times. This method is intended to be used for periodic
polling (iterating over all processors) at intervals of 1 second or
longer.long[][] getProcessorCpuLoadTicks()
getLogicalProcessorCount() arrays, each containing seven
elements representing either clock ticks or milliseconds (platform
dependent) spent in User (0), Nice (1), System (2), Idle (3), IOwait (4),
Hardware interrupts (IRQ) (5), or Software interrupts/DPC (SoftIRQ) (6)
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.
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 and SoftIRQ ticks should be added to the
System value to get the total. System ticks also include time executing
other virtual hosts (steal).long getSystemUptime()
@Deprecated String getSystemSerialNumber()
ComputerSystem.getSerialNumber() instead.int getLogicalProcessorCount()
int getPhysicalProcessorCount()
Copyright © 2010–2017 oshi. All rights reserved.