|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.Util.Timer
public class Timer
Timer
keeps track of how much time accumulates between
successive calls to start and stop. This is useful when profiling the
compiler.
Timer t = new Timer();
for (int i=0; i<10; i++) {
bar();
t.start();
foo();
t.stop();
}
System.out.println(t.timeElapsed());
This prints the total time spent in foo in milliseconds.
Constructor Summary | |
---|---|
Timer()
Create a new Timer and initialize timeElapsed to 0. |
Method Summary | |
---|---|
void |
freshStart()
|
boolean |
running()
Ask if the timer is currently running. |
void |
start()
Start the timer running. |
void |
stop()
Stop the timer. |
long |
timeElapsed()
Return the cumulative amount of time elapsed between starts and stops in milliseconds. |
String |
toString()
Return a string representing the current state of the timer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Timer()
Method Detail |
---|
public boolean running()
public void start()
public void stop()
public void freshStart()
public long timeElapsed()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |