Class ConstantMonitor
java.lang.Object
services.moleculer.monitor.Monitor
services.moleculer.monitor.ConstantMonitor
"Fake" system monitor, which returns a constant value.
-
Field Summary
FieldsFields inherited from class Monitor
cachedCPU, cachedPID, cacheTimeout, cpuDetectedAt, invalidMonitor, logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longReturns the system CPU usage, in percents, between 0 and 100.protected intReturns the system CPU usage, in percents, between 0 and 100.intReturns the system CPU usage, in percents, between 0 and 100.voidsetTotalCpuPercent(int value)
-
Field Details
-
totalCpuPercent
protected int totalCpuPercent
-
-
Constructor Details
-
ConstantMonitor
public ConstantMonitor() -
ConstantMonitor
public ConstantMonitor(int totalCpuPercent)
-
-
Method Details
-
getTotalCpuPercent
public int getTotalCpuPercent()Returns the system CPU usage, in percents, between 0 and 100.- Overrides:
getTotalCpuPercentin classMonitor- Returns:
- total CPU usage of the current OS
-
detectTotalCpuPercent
protected int detectTotalCpuPercent()Returns the system CPU usage, in percents, between 0 and 100.- Specified by:
detectTotalCpuPercentin classMonitor- Returns:
- total CPU usage of the current OS
-
detectPID
-
setTotalCpuPercent
public void setTotalCpuPercent(int value)
-