public static class Debug.Clock extends java.lang.Object implements java.io.Serializable, RevisionHandler
ThreadMXBean.isThreadCpuTimeEnabled()
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
FORMAT_HHMMSS
the output format in hours:minutes:seconds, with fraction of msecs
|
static int |
FORMAT_MILLISECONDS
the output format in milli-seconds
|
static int |
FORMAT_SECONDS
the output format in seconds, with fraction of msecs
|
int |
m_OutputFormat
the format of the output
|
static Tag[] |
TAGS_FORMAT
the output formats
|
Constructor and Description |
---|
Clock()
automatically starts the clock with FORMAT_SECONDS format and CPU
time if available
|
Clock(boolean start)
starts the clock depending on
start immediately with the
FORMAT_SECONDS output format and CPU time if available |
Clock(boolean start,
int format)
starts the clock depending on
start immediately, using
CPU time if available |
Clock(int format)
automatically starts the clock with the given output format and CPU
time if available
|
Modifier and Type | Method and Description |
---|---|
int |
getOutputFormat()
returns the output format
|
java.lang.String |
getRevision()
Returns the revision string.
|
long |
getStart()
returns the start time
|
long |
getStop()
returns the stop time or, if still running, the current time
|
boolean |
getUseCpuTime()
returns whether the use of CPU is time is enabled/disabled (regardless
whether the system supports it or not)
|
boolean |
isCpuTime()
whether the measurement is based on the msecs returned from the System
class or on the more accurate CPU time.
|
boolean |
isRunning()
whether the time is still being clocked
|
void |
setOutputFormat(int value)
sets the format of the output
|
void |
setUseCpuTime(boolean value)
enables/disables the use of CPU time (if measurement of CPU time is
available).
|
void |
start()
saves the current system time (or CPU time) in msec as start time
|
void |
stop()
saves the current system (or CPU time) in msec as stop time
|
java.lang.String |
toString()
returns the elapsed time, getStop() - getStart(), as string
|
public static final int FORMAT_MILLISECONDS
public static final int FORMAT_SECONDS
public static final int FORMAT_HHMMSS
public static final Tag[] TAGS_FORMAT
public int m_OutputFormat
public Clock()
m_OutputFormat
public Clock(int format)
format
- the output formatm_OutputFormat
public Clock(boolean start)
start
immediately with the
FORMAT_SECONDS output format and CPU time if availablestart
- whether to start the clock immediatelym_OutputFormat
public Clock(boolean start, int format)
start
immediately, using
CPU time if availablestart
- whether to start the clock immediatelyformat
- the formatm_OutputFormat
public boolean isCpuTime()
System.currentTimeMillis()
,
ThreadMXBean.isThreadCpuTimeEnabled()
,
getUseCpuTime()
public void setUseCpuTime(boolean value)
value
- if true the CPU time is used (if possible)public boolean getUseCpuTime()
public void start()
m_Start
public void stop()
m_Stop
public long getStart()
public long getStop()
public boolean isRunning()
public void setOutputFormat(int value)
value
- the format of the outputm_OutputFormat
public int getOutputFormat()
m_OutputFormat
public java.lang.String toString()
toString
in class java.lang.Object
getStart()
,
getStop()
public java.lang.String getRevision()
getRevision
in interface RevisionHandler