Class CommandMonitor
java.lang.Object
services.moleculer.monitor.Monitor
services.moleculer.monitor.CommandMonitor
CPU monitor, which detects the current CPU usage via command line.
-
Field Summary
FieldsFields inherited from class Monitor
cachedCPU, cachedPID, cacheTimeout, cpuDetectedAt, invalidMonitor, logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longReturns the PID of Java VM.protected intReturns the system CPU usage, in percents, between 0 and 100.voidsetCommand(String command) Methods inherited from class Monitor
getPID, getTotalCpuPercent
-
Field Details
-
command
-
-
Constructor Details
-
CommandMonitor
public CommandMonitor() -
CommandMonitor
-
-
Method Details
-
detectTotalCpuPercent
Returns the system CPU usage, in percents, between 0 and 100.- Specified by:
detectTotalCpuPercentin classMonitor- Returns:
- total CPU usage of the current OS
- Throws:
Exception- any I/O or missing DLL exception
-
detectPID
-
getCommand
-
setCommand
-