|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.cjdbc.common.util.Stats
This class provides thread-safe statistics. Each statistic entry is composed as follow:
Field Summary | |
private int |
cacheHit
Cache hits counter |
private int |
count
Statistic counter |
private int |
error
Statistic error counter |
private long |
maxTime
Maximum time for this entry (automatically computed) |
private long |
minTime
Minimum time for this entry (automatically computed) |
private java.lang.String |
name
Name of the stats. |
private long |
totalTime
Total time for this entry |
Constructor Summary | |
Stats(java.lang.String statName)
Creates a new Stats instance. |
Method Summary | |
void |
displayOnStdout()
Displays the statistics on the standard output. |
int |
getCacheHit()
Gets current cache hit count of an entry |
int |
getCount()
Gets current count of an entry. |
int |
getError()
Gets current error count of an entry |
long |
getMaxTime()
Gets the maximum time of an entry |
long |
getMinTime()
Gets the minimum time of an entry |
java.lang.String |
getName()
Gets the name of the current stat. |
long |
getTotalTime()
Gets the total time of an entry |
void |
incrementCacheHit()
Increments an entry cache hit by one. |
void |
incrementCount()
Increments an entry count by one. |
void |
incrementError()
Increments an entry error by one. |
void |
merge(Stats anotherStat)
Adds the entries of another Stats object to this one. |
java.lang.String |
multipleLineDisplay()
Displays the statistics information on multiple lines. |
void |
reset()
Resets all entries to 0. |
java.lang.String |
singleLineDisplay()
Displays the statistics information on a single line in the format: name count error cacheHit %hit minTime maxTime avgTime totalTime |
java.lang.String[] |
toStringTable()
Get the stat information in the form of a String table. |
void |
updateTime(long time)
Adds a new time sample for this entry. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int count
private int error
private int cacheHit
private long minTime
private long maxTime
private long totalTime
private java.lang.String name
Constructor Detail |
public Stats(java.lang.String statName)
Stats
instance. The entries are reset to 0.
statName
- The stat nameMethod Detail |
public void reset()
public void incrementCount()
public void incrementError()
public void incrementCacheHit()
public void updateTime(long time)
time
is added to
total time and both minTime and maxTime are updated if needed.
time
- time to add to this entrypublic java.lang.String getName()
public int getCount()
public int getError()
public int getCacheHit()
public long getMinTime()
public long getMaxTime()
public long getTotalTime()
public void merge(Stats anotherStat) throws java.lang.Exception
Stats
object to this one.
anotherStat
- stat to merge with current stat
java.lang.Exception
- if you try to merge a stat with itselfpublic void displayOnStdout()
public java.lang.String multipleLineDisplay()
String
containing the Stat outputpublic java.lang.String singleLineDisplay()
String
containing the Stat outputpublic java.lang.String[] toStringTable()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |