public abstract class Monitor
extends java.lang.Object
SigarMonitor,
JmxMonitor| Modifier and Type | Field and Description |
|---|---|
protected static int |
cachedCPU
Cached CPU usage
|
protected static java.util.concurrent.atomic.AtomicLong |
cachedPID
Cached process ID
|
protected long |
cacheTimeout
CPU cache timeout in MILLISECONDS
|
protected static long |
cpuDetectedAt
Timestamp of CPU detection
|
protected static java.util.concurrent.atomic.AtomicBoolean |
invalidMonitor |
protected org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
Monitor() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract long |
detectPID()
Returns the system CPU usage, in percents, between 0 and 100.
|
protected abstract int |
detectTotalCpuPercent()
Returns the system CPU usage, in percents, between 0 and 100.
|
long |
getPID()
Returns the cached PID of Java VM.
|
int |
getTotalCpuPercent()
Returns the cached system CPU usage, in percents, between 0 and 100.
|
protected final org.slf4j.Logger logger
protected long cacheTimeout
protected static java.util.concurrent.atomic.AtomicLong cachedPID
protected static int cachedCPU
protected static long cpuDetectedAt
protected static final java.util.concurrent.atomic.AtomicBoolean invalidMonitor
public int getTotalCpuPercent()
public long getPID()
protected abstract int detectTotalCpuPercent()
throws java.lang.Exception
java.lang.Exception - any I/O or missing DLL exceptionprotected abstract long detectPID()
throws java.lang.Exception
java.lang.Exception - any I/O or missing DLL exception