|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.tum.cs.commons.system.MemoryMonitor
public class MemoryMonitor
A simple class for monitoring memory usage of an application. A second thread
is started which periodically polls the memory status.
Note:
Due to performance reasons the method
getMaximumMemoryUsage()
and reset()
are not
synchronized, so calling these methods while the memory monitor is still
running might lead to undesired results. Therefore it is recommended stop the
memory befor calling getMaximumMemoryUsage()
or
reset()
.
Constructor Summary | |
---|---|
MemoryMonitor()
Construct a new MemoryMonitor with the default monitoring
interval. |
|
MemoryMonitor(int period)
Construct a new MemoryMonitor . |
Method Summary | |
---|---|
long |
getMaximumMemoryUsage()
Obtain maximum amount of memory used since the monitor was started or reset.Use this method only when monitor is stopped. |
void |
reset()
Reset the maximum memory usage value. |
void |
start()
Start the memory monitor. |
void |
stop()
Stop the memory monitor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MemoryMonitor()
MemoryMonitor
with the default monitoring
interval.
public MemoryMonitor(int period)
MemoryMonitor
.
period
- time between subsequent polls to obtain memory statusstart()
Method Detail |
---|
public void start()
stop()
public void stop()
start()
,
reset()
public void reset()
stop()
public long getMaximumMemoryUsage()
stop()
|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |