Class SystemResourcesCounter
- java.lang.Object
-
- java.lang.Thread
-
- org.apache.flink.runtime.metrics.util.SystemResourcesCounter
-
- All Implemented Interfaces:
Runnable
@ThreadSafe public class SystemResourcesCounter extends Thread
Daemon thread probing system resources.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description SystemResourcesCounter(Duration probeInterval)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetCpuIdle()doublegetCpuIrq()doublegetCpuLoad1()doublegetCpuLoad15()doublegetCpuLoad5()doublegetCpuNice()doublegetCpuSoftIrq()doublegetCpuSteal()doublegetCpuSys()doublegetCpuUsage()doublegetCpuUsagePerProcessor(int processor)doublegetCpuUser()doublegetIOWait()String[]getNetworkInterfaceNames()intgetProcessorsCount()longgetReceiveRatePerInterface(int interfaceNo)longgetSendRatePerInterface(int interfaceNo)voidrun()voidshutdown()-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
SystemResourcesCounter
public SystemResourcesCounter(Duration probeInterval)
-
-
Method Detail
-
shutdown
public void shutdown() throws InterruptedException- Throws:
InterruptedException
-
getCpuUser
public double getCpuUser()
-
getCpuNice
public double getCpuNice()
-
getCpuSys
public double getCpuSys()
-
getCpuIdle
public double getCpuIdle()
-
getIOWait
public double getIOWait()
-
getCpuIrq
public double getCpuIrq()
-
getCpuSoftIrq
public double getCpuSoftIrq()
-
getCpuSteal
public double getCpuSteal()
-
getCpuUsage
public double getCpuUsage()
-
getCpuLoad1
public double getCpuLoad1()
-
getCpuLoad5
public double getCpuLoad5()
-
getCpuLoad15
public double getCpuLoad15()
-
getProcessorsCount
public int getProcessorsCount()
-
getCpuUsagePerProcessor
public double getCpuUsagePerProcessor(int processor)
-
getNetworkInterfaceNames
public String[] getNetworkInterfaceNames()
-
getReceiveRatePerInterface
public long getReceiveRatePerInterface(int interfaceNo)
-
getSendRatePerInterface
public long getSendRatePerInterface(int interfaceNo)
-
-