com.zwares.base.monitor
Class MemoryUtil

java.lang.Object
  |
  +--com.zwares.base.monitor.MemoryUtil

public class MemoryUtil
extends java.lang.Object

This class provides methods to access memory statistics on a given application or a component.


Constructor Summary
MemoryUtil()
          Default constructor
MemoryUtil(java.lang.String contextName)
          Constructs a memory object.
 
Method Summary
 long getChangeInMemory()
          Returns change in memory between two calls to getUsedMemory() method.
 long getFreeMemory()
          Returns memory currently avialable to the application.
 long getMaxUsedMemory()
          Returns the maximum amount of memory used by the application.
 long getMinUsedMemory()
          Returns the least amount of memory used by the application.
 long getTotalMemory()
          Returns total memory currently available to the application.
 long getUsedMemory()
          Returns memory currently used by the application.
 java.lang.String toString()
          Converts memory stats to string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MemoryUtil

public MemoryUtil()
Default constructor


MemoryUtil

public MemoryUtil(java.lang.String contextName)
Constructs a memory object.

Parameters:
contextName - name assigned to a test.
Method Detail

getUsedMemory

public long getUsedMemory()
Returns memory currently used by the application. Whenever this method is called, memory util recalculates min, max and change in memory size.


getFreeMemory

public long getFreeMemory()
Returns memory currently avialable to the application.


getChangeInMemory

public long getChangeInMemory()
Returns change in memory between two calls to getUsedMemory() method.


getTotalMemory

public long getTotalMemory()
Returns total memory currently available to the application.


getMinUsedMemory

public long getMinUsedMemory()
Returns the least amount of memory used by the application.


getMaxUsedMemory

public long getMaxUsedMemory()
Returns the maximum amount of memory used by the application.


toString

public java.lang.String toString()
Converts memory stats to string.

Overrides:
toString in class java.lang.Object