|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--utilities.UTimer
Constructor Summary | |
UTimer(java.lang.String n)
constructor for a named timer. |
|
UTimer(java.lang.String n,
int window)
constructor for a windowed timer. |
Method Summary | |
void |
action()
the static time function will time whatever this function does. |
static void |
clearTimer(java.lang.String s)
removes the specified timer from the global timer list. |
double |
getAverage()
returns the average of all timing. |
int |
getCount()
returns the number of times collected. |
long |
getTime()
returns the result of timing. |
static UTimer |
getTimer(java.lang.String s)
returns a UTimer with the specified name. |
int |
getWindow()
returns the size of the window used. |
boolean |
isWindowed()
returns whether the timer is windowed. |
void |
resetTimer()
Resets the timer. |
void |
resetWindow()
clears the window of all data. |
void |
setWindowed(boolean b,
int w)
Sets whether the timer is windowed. |
void |
startTimer()
Starts the timer. |
long |
stopTimer()
Stops the timer. |
static long |
time(int count,
UTimer t)
times something using whatever windowing setting the UTimer already has. |
static long |
time(int count,
UTimer t,
boolean windowed)
will time the specified timer's action, for count times, with the given windowed setting. |
static long |
time(UTimer t)
times the specified timer's action once. |
java.lang.String |
toString()
returns a human readable display of the timer. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public UTimer(java.lang.String n)
n
- the name of the timer.public UTimer(java.lang.String n, int window)
n
- the name of the timer.window
- the size of the window.setWindowed(boolean, int)
Method Detail |
public static UTimer getTimer(java.lang.String s)
s
- the name of the timer to get.public static void clearTimer(java.lang.String s)
s
- the name of the timer to dispense with.public static long time(int count, UTimer t, boolean windowed)
UTimer.time(100, new UTimer("findArea with partials") {
public void action()
{
b.setDepth(temp);
temparea = b.findArea();
b.flushCache();
b.printcachestats = false;
}
}, true);
This code creates an anonymous UTimer class with an action function that
calls the BetterArea's find area function. Some workarounds are
necessary to use variables from the local scope outside of the class
definition; the need to be final and there are some other wierdnesses.
For more detail see BetterArea.main()count
- the number of times to time the action.t
- the UTimer to use - it's recommended that you fill in that
timer's action function, or not much will happen.whether
- to use windowing or not.BetterArea.main(java.lang.String[])
,
setWindowed(boolean, int)
,
action()
public static long time(int count, UTimer t)
count
- the number of times to run the action.t
- the timer to use.time(int,UTimer,boolean)
public static long time(UTimer t)
t
- the UTimer to use.#time(int,Timer,boolean)
public boolean isWindowed()
public void setWindowed(boolean b, int w)
b
- whether the UTimer should use windowing.w
- the size of the window to use.public int getWindow()
public void resetWindow()
public void startTimer()
public long stopTimer()
public void resetTimer()
public long getTime()
public double getAverage()
public int getCount()
public java.lang.String toString()
toString
in class java.lang.Object
public void action()
time(int, utilities.UTimer, boolean)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |