public class PerformanceMonitor extends java.lang.Object
start()
 and stop().
 
 In order to avoid programming mistakes, the calls to the methods
 start() and stop() must
 adhere to a simple protocol:
 The PerformanceMonitor can be in on of the three states NOT_RUN,
 RUNNING, FINISHED.
 
 start() May only be called in state NOT_RUN and
 stop() may only be called in state RUNNING.
 
 All other calls to start() and
 stop() result in IllegalArgumentExceptions
| Constructor and Description | 
|---|
| PerformanceMonitor(boolean useMemoryMonitor)Constructor has package level to allow tests to access it, yet enforce use of
 factory methods for public use. | 
| Modifier and Type | Method and Description | 
|---|---|
| static PerformanceMonitor | create()Convenience factory method: Creates a new  PerformanceMonitorand
 starts it. | 
| static PerformanceMonitor | create(boolean useMemoryMonitor)Convenience factory method: Creates a new  PerformanceMonitorand
 starts it. | 
| long | getDeltaMemUsageInBytes()Gets the delta in memory consumption in bytes | 
| long | getDeltaMemUsageInKBs()Gets the delta in memory consumption in kilobytes | 
| long | getMaxMemUsageInBytes()Gets the maximal memory consumption in bytes | 
| long | getMaxMemUsageInKBs()Gets the maximal memory consumption in kilobytes | 
| long | getMilliseconds()Gets the measured time in milliseconds. | 
| long | getSeconds()Gets the measured time in seconds. | 
| boolean | isStopped()Returns whether the PerformanceMonitor is stopped and will return meaningful
 values. | 
| void | start()Starts the  PerformanceMonitor. | 
| long | stop()Stops the  PerformanceMonitor. | 
public PerformanceMonitor(boolean useMemoryMonitor)
public static PerformanceMonitor create(boolean useMemoryMonitor)
PerformanceMonitor and
 starts it.useMemoryMonitor - detemines whether the PerformanceMonitor internally uses a
            MemoryMonitor to measure memory consumption. This requires
            more resources, since the MemoryMonitor runs its own
            thread, but promises more precise measurement of maximum memory
            consumption.public static PerformanceMonitor create()
PerformanceMonitor and
 starts it. PerformanceMonitor does not use a MemoryMonitor internallypublic void start()
PerformanceMonitor. It will measure time and maximal
 memory consumption until the method stop() is
 called.
 
 This method may only be called, if the PerformanceMonitor is in state
 NOT_RUN. (i.e., after it has been created via the constructor). Node: the
 create() method creates and starts the monitor.
 
 All subsequent calls to this method will result in a
 IllegalStateException
public long stop()
PerformanceMonitor.
 
 This method may only be called, if the PerformanceMonitor is in state
 RUNNING. (i.e., after a call to start() ).
 
 If the PerformanceMonitor is in any other state, a call to this
 method results in an IllegalStateException
public boolean isStopped()
public long getSeconds()
public long getMilliseconds()
public long getMaxMemUsageInBytes()
public long getMaxMemUsageInKBs()
public long getDeltaMemUsageInBytes()
public long getDeltaMemUsageInKBs()