Package org.cip4.jdflib.util
Class CPUTimer
java.lang.Object
org.cip4.jdflib.util.CPUTimer
class for cpu time measurements
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd a timer to thislonglonglonglonglongstatic CPUTimer.CPUTimerFactorygetName()longget a summary for a single runlongmethod to get the amount of cpu time since constructionlongmethod 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 folksvoidvoidstart()start measuring timesvoidstop()stop/pause measuring timestoString()toXML()
-
Constructor Details
-
CPUTimer
public CPUTimer(boolean bStart) - Parameters:
bStart- if true, start measuring now
-
-
Method Details
-
getName
- Returns:
- the name
-
add
add a timer to this- Parameters:
timer-
-
setName
- 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
-
getSingleSummary
get a summary for a single run- Returns:
-
toXML
- Returns:
- the XML representation of this
-
getFactory
- Returns:
- the one and only CPUTimerFactory
-
println
public void println()simple print utility for lazy folks
-