public class Timer extends Object implements Serializable, StringBuilderFormattable
Modifier and Type | Class and Description |
---|---|
static class |
Timer.Status |
Constructor and Description |
---|
Timer(String name)
Constructor.
|
Timer(String name,
int iterations)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
void |
formatTo(StringBuilder buffer)
Writes a text representation of this object into the specified
StringBuilder , ideally without allocating
temporary objects. |
long |
getElapsedNanoTime()
Access the elapsed time.
|
long |
getElapsedTime()
Access the elapsed time.
|
String |
getName()
Accessor for the name.
|
Timer.Status |
getStatus()
Returns the name of the last operation performed on this timer (Start, Stop, Pause or
Resume).
|
int |
hashCode() |
void |
pause()
Pause the timer.
|
void |
resume()
Resume the timer.
|
void |
start()
Start the timer.
|
void |
startOrResume() |
String |
stop()
Stop the timer.
|
String |
toString()
Returns the String representation of the timer based upon its current state
|
public void start()
public void startOrResume()
public void pause()
public void resume()
public long getElapsedTime()
public long getElapsedNanoTime()
public Timer.Status getStatus()
public String toString()
public void formatTo(StringBuilder buffer)
StringBuilderFormattable
StringBuilder
, ideally without allocating
temporary objects.formatTo
in interface StringBuilderFormattable
buffer
- the StringBuilder to write intoCopyright © 1999-1969 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.