|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jimm.util.StopWatch
public class StopWatch
Prints time durations; used for development purposes only.
No threads or system resources are harmed in the making of a stop watch. A
stop watch simply remembers the start time (and elapsed time when paused)
and prints the total "running" time when either mark()
or
stop()
is called.
stop()
doesn't really stop anything. You can call stop as many times
as you like and it will print the time elapsed since start. It would be
easy to change this behavior, but I haven't needed to.
Field Summary | |
---|---|
protected long |
elapsedTime
|
protected java.lang.String |
name
|
protected java.io.PrintWriter |
out
|
protected long |
t0
|
Constructor Summary | |
---|---|
StopWatch()
|
|
StopWatch(java.io.PrintWriter out)
|
|
StopWatch(java.lang.String name)
|
|
StopWatch(java.lang.String name,
java.io.PrintWriter out)
|
Method Summary | |
---|---|
void |
mark()
Prints the current elapsed time without stopping. |
void |
mark(boolean printMark)
Prints the current elapsed time without stopping, along with the stop watch name if printMark is true . |
void |
mark(java.lang.String msg)
Prints the current elapsed time without stopping, along with the stop watch name and msg. |
void |
mark(java.lang.String msg,
boolean printMark)
Prints the current elapsed time without stopping, along with, along with the stop watch name if printMark is true and the
msg if it's not null . |
void |
pause()
Pauses the stop watch. |
void |
resume()
Resumes the stop watch. |
void |
start()
Remembers the current time and prints a message. |
void |
start(boolean printStarting)
Remembers the current time and prints a message if requested. |
void |
stop()
Stops the stop watch and prints the name of this stop watch and the current elapsed time. |
void |
stop(java.lang.String msg)
Stops the stop watch and prints the name of this stop watch, msg if non- null , and the current elapsed time. |
void |
stop(java.lang.String msg,
boolean printName)
Prints the current elapsed time, along with the stop watch name if printMark is true and the msg if it's
not null . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String name
protected long t0
protected long elapsedTime
protected java.io.PrintWriter out
Constructor Detail |
---|
public StopWatch()
public StopWatch(java.lang.String name)
public StopWatch(java.io.PrintWriter out)
public StopWatch(java.lang.String name, java.io.PrintWriter out)
Method Detail |
---|
public void start()
public void start(boolean printStarting)
printStarting
- if true
and this stop watch has a
name, print a messagepublic void pause()
public void resume()
public void mark()
public void mark(boolean printMark)
true
.
printMark
- if true
, the stop watch name will
be printedpublic void mark(java.lang.String msg)
msg
- a message to printpublic void mark(java.lang.String msg, boolean printMark)
true
and the
msg if it's not null
.
msg
- a message to printprintMark
- if true
, the stop watch name will
be printedpublic void stop()
public void stop(java.lang.String msg)
null
, and the current elapsed time.
msg
- a message to print; may be null
public void stop(java.lang.String msg, boolean printName)
true
and the msg if it's
not null
.
msg
- a message to print; may be null
printName
- if true
, the stop watch name will
be printed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |