public class PerformanceMonitor
extends java.lang.Object
implements java.lang.Runnable
PerformanceMonitor is responsible for monitoring system resources. For now the following information is captured:
- timestamp of the measurement | Modifier and Type | Field and Description |
|---|---|
private boolean |
isStarted
Flag used to determine if the thread is fully started.
|
private static org.apache.log4j.Logger |
log
Used to log different events.
|
private PerformanceMonitorQueue |
myPerformanceMonitorQueue
Queue of information about measurements.
|
private java.lang.Thread |
performanceMonitorThread
Thread used by this class.
|
private boolean |
runFlag
Flag used to stop the thread.
|
private int |
samplingInterval
Interval between measurements.
|
| Constructor and Description |
|---|
PerformanceMonitor()
Constructs the object.
|
| Modifier and Type | Method and Description |
|---|---|
PerformanceMonitorQueue |
getPerformanceMonitorQueue()
Gets the queue of information about measurements.
|
boolean |
isAlive()
Checks if
PerformanceMonitor is alive. |
void |
run()
Runs the thread in loop.
|
private void |
sample()
Makes measurements and stores them in the queue.
|
void |
setSamplingInterval(int samplingInterval)
Sets the interval between measurements.
|
void |
start()
Starts the thread.
|
void |
stop()
Stops the thread.
|
private static org.apache.log4j.Logger log
private java.lang.Thread performanceMonitorThread
private boolean runFlag
private boolean isStarted
private int samplingInterval
private PerformanceMonitorQueue myPerformanceMonitorQueue
public void start()
public void stop()
public boolean isAlive()
PerformanceMonitor is alive. It means that: isStarted equals true).
This condition is used to check if the thread is fully started or if it needs more time to start.true if the thread is fully started and operational, false otherwisepublic void run()
run in interface java.lang.Runnablepublic void setSamplingInterval(int samplingInterval)
samplingInterval - interval between measurementspublic PerformanceMonitorQueue getPerformanceMonitorQueue()
private void sample()