|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.cjdbc.util.Stats
This class provides thread-safe statistics. Each statistic entry is composed as follow:
Field Summary | |
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 |
display()
Displays the statistics on the standard output. |
void |
display(java.io.PrintStream out)
Displays the statistics on the standard output. |
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 |
long |
getTotalTime()
Gets the total time of an entry |
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. |
void |
reset()
Resets all entries to 0. |
void |
updateTime(long time)
Add sa 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 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 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 int getCount()
public int getError()
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 display()
public void display(java.io.PrintStream out)
out
- the output stream to display the stats
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |