public class Counter
extends java.lang.Object
Constructor and Description |
---|
Counter()
Creates a new counter.
|
Counter(long start,
long total,
long end)
Creates a new counter in a specific state.
|
Modifier and Type | Method and Description |
---|---|
void |
add(long count)
Adds the specified number of occurrences to the counter.
|
double |
duration()
Returns the duration expressed in fractional number of seconds.
|
boolean |
equals(java.lang.Object obj) |
void |
freeze()
Freezes the counter in the current state including the counts and times.
|
int |
hashCode() |
void |
reset()
Resets the counter, by zeroing out the count and restarting the timer.
|
double |
throughput()
Returns the number of occurrences per second.
|
java.lang.String |
toString() |
long |
total()
Returns the total number of occurrences counted.
|
public Counter()
public Counter(long start, long total, long end)
start
- start timetotal
- total number of items to start withend
- end time; if non-zepublic void reset()
public void freeze()
public void add(long count)
count
- number of occurrencespublic double throughput()
public long total()
public double duration()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object