|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.commsen.stopwatch.engines.DefaultStopwatchEngine com.commsen.stopwatch.engines.MemoryStopwatchEngine
public class MemoryStopwatchEngine
This class extends default Stopwatch's engine to provide information about memory usage. Note: the memory usage measurements performed by this class are FAR FROM ACCURATE.
As of now I'm not aware of how one can measure the actual amount of memory given object uses. This class simply remembers the amount of memory used by JVM at the time of starting the measurement and compares it to the amount of memory used by JVM at the time of completing the measurement. This of course may have nothing to do the truth if some other threads are running and consuming memory or for example GC is started while measuring.
So the results may vary from "almost correct" in the case of single threaded application to "pure fiction" in case of heavily loaded, multi threaded application
To use MemoryStopwatchEngine with Stopwatch one can :
-Dcom.commsen.stopwatch.engine=com.commsen.stopwatch.engines.MemoryStopwatchEngine
JVM parameterengine=com.commsen.stopwatch.engines.MemoryStopwatchEngine
Constructor Summary | |
---|---|
MemoryStopwatchEngine()
|
Method Summary | |
---|---|
long |
begin(java.lang.String group,
java.lang.String label)
Method called when mensuration is started. |
void |
end(long id)
Method called when mensuration is stopped. |
protected org.apache.log4j.Logger |
getLogger()
|
Methods inherited from class com.commsen.stopwatch.engines.DefaultStopwatchEngine |
---|
getPersistenceMode, getProperties, getStorage, getStorageClass, getStorageManager, isDebug, isDebugEnabled, pause, resume, setDebugEnabled, setPersistenceMode, setProperties, setStorage, skip, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MemoryStopwatchEngine()
Method Detail |
---|
public void end(long id)
StopwatchEngine
end
in interface StopwatchEngine
end
in class DefaultStopwatchEngine
id
- Unique ID representing the actual measurment that need to be stopped.DefaultStopwatchEngine.end(long)
public long begin(java.lang.String group, java.lang.String label)
StopwatchEngine
begin
in interface StopwatchEngine
begin
in class DefaultStopwatchEngine
group
- the name of the group this measurment should be placed inlabel
- how this measurment should be labeled
DefaultStopwatchEngine.begin(java.lang.String, java.lang.String)
protected org.apache.log4j.Logger getLogger()
getLogger
in class DefaultStopwatchEngine
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |