|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.spif.StoreChain | +--net.sf.spif.StoreProfiler
A store which logs the time spent on each get and put call passing through as fine messages to a java.util.logging.Logger named by this class name. Note: This class is not thread safe - multiple threads may produce incorrect measures.
Field Summary | |
protected static java.util.logging.Logger |
log
The logger used by this class |
Fields inherited from class net.sf.spif.StoreChain |
chained |
Constructor Summary | |
StoreProfiler()
Creates a store profiler which logs each access |
|
StoreProfiler(boolean log)
Creates a store profiler |
Method Summary | |
java.lang.Object |
get(Id id,
boolean writeable)
Returns an object from the store. |
long |
getGetAverageTime()
Return the average get time in milliseconds |
long |
getGetCount()
Return the total number of gets |
long |
getGetTotalTime()
Return the total time spent getting in milliseconds |
long |
getPutAverageTime()
Return the average put time in milliseconds |
long |
getPutCount()
Return the total number of puts |
long |
getPutTotalTime()
Return the total time spent putting in milliseconds |
java.lang.String |
getReportString()
Returns a human-readable string containing the statistics gethered |
Id |
put(Id id,
java.lang.Object object)
Puts an object in the store. |
void |
reset()
Resets all measures to 0 |
Methods inherited from class net.sf.spif.StoreChain |
clear, equals, getChained, getChained, getChained, hashCode, remove, setChained |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static java.util.logging.Logger log
Constructor Detail |
public StoreProfiler()
public StoreProfiler(boolean log)
log
- true if accesses should be logged,
false if averages should be recorded onlyMethod Detail |
public java.lang.Object get(Id id, boolean writeable)
StoreChain
Returns an object from the store.
This default implementation just forwards to the chained. for (optional) use by subclasses.
get
in class StoreChain
id
- the id of the object to return
public Id put(Id id, java.lang.Object object)
StoreChain
Puts an object in the store. The objects may be new, or previously acquired by getting writeable. It is an error to attempt to put an existing object not previously acquired by getting writeable.
This default implementation just forwards to the chained. for (optional) use by subclasses.
put
in class StoreChain
id
- the id of the object to put. May be nullobject
- the object to put. May be null
public void reset()
public long getGetTotalTime()
public long getGetCount()
public long getGetAverageTime()
public long getPutTotalTime()
public long getPutCount()
public long getPutAverageTime()
public java.lang.String getReportString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |