@ThreadSafe public class SystemResourcesCounter extends Thread
To accurately and consistently report CPU and network usage we have to periodically probe CPU ticks and network sent/received bytes and then convert those values to CPU usage and send/receive byte rates.
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
SystemResourcesCounter(Time probeInterval) |
Modifier and Type | Method and Description |
---|---|
double |
getCpuIdle() |
double |
getCpuIrq() |
double |
getCpuLoad1() |
double |
getCpuLoad15() |
double |
getCpuLoad5() |
double |
getCpuNice() |
double |
getCpuSoftIrq() |
double |
getCpuSys() |
double |
getCpuUsage() |
double |
getCpuUsagePerProcessor(int processor) |
double |
getCpuUser() |
double |
getIOWait() |
String[] |
getNetworkInterfaceNames() |
int |
getProcessorsCount() |
long |
getReceiveRatePerInterface(int interfaceNo) |
long |
getSendRatePerInterface(int interfaceNo) |
void |
run() |
void |
shutdown() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public SystemResourcesCounter(Time probeInterval)
public void shutdown() throws InterruptedException
InterruptedException
public double getCpuUser()
public double getCpuNice()
public double getCpuSys()
public double getCpuIdle()
public double getIOWait()
public double getCpuIrq()
public double getCpuSoftIrq()
public double getCpuUsage()
public double getCpuLoad1()
public double getCpuLoad5()
public double getCpuLoad15()
public int getProcessorsCount()
public double getCpuUsagePerProcessor(int processor)
public String[] getNetworkInterfaceNames()
public long getReceiveRatePerInterface(int interfaceNo)
public long getSendRatePerInterface(int interfaceNo)
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.