| Constructor and Description |
|---|
Timer(String name)
Construct started timer.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getElapsedTime()
Elapsed time.
|
long |
getInvocationCount()
Get total invocation count.
|
String |
getName()
Name of the timer.
|
long |
getStartTime()
Start time.
|
TimerStatistics |
getStatistics()
Statistics of a stopped timer.
|
long |
invoke()
Register one invoceation.
|
long |
invoke(long invocations)
Register one or multiple invocations.
|
void |
stop()
Stop.
|
static String |
toHumanReadableTimeUnit(double ms)
Format to nicely interpretable time unit.
|
static String |
toIecBinaryUnits(long bytes)
Format memory units.
|
static String |
toSiPrefixedString(long measure)
Format nicely with SI unit prefixes.
|
String |
toString() |
String |
toString(boolean appendInvocations) |
public Timer(String name)
name - Timer namepublic long invoke(long invocations)
invocations - Invocation number to registerIllegalStateException - when invoked in stopped statepublic long invoke()
public void stop()
public long getInvocationCount()
public long getElapsedTime()
public static String toHumanReadableTimeUnit(double ms)
ms - Time in mspublic static String toIecBinaryUnits(long bytes)
bytes - Byte countpublic static String toSiPrefixedString(long measure)
measure - Value to formatpublic String toString(boolean appendInvocations)
public TimerStatistics getStatistics()
IllegalStateException - when timer is not stopped or no invocations made.public String getName()
public long getStartTime()