public class Counter extends 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(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.
|
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()