Package org.cip4.jdflib.util
Class CPUTimer
- java.lang.Object
-
- org.cip4.jdflib.util.CPUTimer
-
public class CPUTimer extends java.lang.Objectclass for cpu time measurements
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCPUTimer.CPUTimerFactory
-
Constructor Summary
Constructors Constructor Description CPUTimer(boolean bStart)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(CPUTimer timer)add a timer to thislonggetAverageCPUTime()longgetAverageRealTime()longgetCreationTime()longgetCurrentCPUTime()longgetCurrentRealTime()static CPUTimer.CPUTimerFactorygetFactory()java.lang.StringgetName()longgetNumStarts()java.lang.StringgetSingleSummary()get a summary for a single runlonggetTotalCPUTime()method to get the amount of cpu time since constructionlonggetTotalRealTime()method to get the amount of real time since construction in millisecondsvoidpause()stop/pause measuring times - decrement the number of start/stop so that we don't recount the next startvoidprintln()simple print utility for lazy folksvoidsetName(java.lang.String name)voidstart()start measuring timesvoidstop()stop/pause measuring timesjava.lang.StringtoString()KElementtoXML()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
- Returns:
- the name
-
add
public void add(CPUTimer timer)
add a timer to this- Parameters:
timer-
-
setName
public void setName(java.lang.String name)
- Parameters:
name- the name to set
-
getTotalCPUTime
public long getTotalCPUTime()
method to get the amount of cpu time since construction- Returns:
- amount of cpu time in nano seconds
-
getCurrentCPUTime
public long getCurrentCPUTime()
- Returns:
-
getCreationTime
public long getCreationTime()
- Returns:
- creation time in milliseconds (see System.currentTimeMillis());
-
getTotalRealTime
public long getTotalRealTime()
method to get the amount of real time since construction in milliseconds- Returns:
- amount of real in milliseconds
-
getCurrentRealTime
public long getCurrentRealTime()
- Returns:
- the current realtime im milliseconds
-
start
public void start()
start measuring times
-
stop
public void stop()
stop/pause measuring times
-
pause
public void pause()
stop/pause measuring times - decrement the number of start/stop so that we don't recount the next start
-
getNumStarts
public long getNumStarts()
- Returns:
-
getAverageRealTime
public long getAverageRealTime()
- Returns:
-
getAverageCPUTime
public long getAverageCPUTime()
- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- See Also:
Object.toString()
-
getSingleSummary
public java.lang.String getSingleSummary()
get a summary for a single run- Returns:
-
toXML
public KElement toXML()
- Returns:
- the XML representation of this
-
getFactory
public static CPUTimer.CPUTimerFactory getFactory()
- Returns:
- the one and only CPUTimerFactory
-
println
public void println()
simple print utility for lazy folks
-
-