org.cip4.jdflib.util
Class CPUTimer

java.lang.Object
  extended by org.cip4.jdflib.util.CPUTimer

public class CPUTimer
extends Object

class for cpu time measurements

Author:
Rainer Prosi, Heidelberger Druckmaschinen

Nested Class Summary
static class CPUTimer.CPUTimerFactory
           
 
Constructor Summary
CPUTimer(boolean bStart)
           
 
Method Summary
 void add(CPUTimer timer)
          add a timer to this
 long getAverageCPUTime()
           
 long getAverageRealTime()
           
 long getCreationTime()
           
 long getCurrentCPUTime()
           
 long getCurrentRealTime()
           
static CPUTimer.CPUTimerFactory getFactory()
           
 String getName()
           
 long getNumStarts()
           
 String getSingleSummary()
          get a summary for a single run
 long getTotalCPUTime()
          method to get the amount of cpu time since construction
 long getTotalRealTime()
          method to get the amount of real time since construction in milliseconds
 void pause()
          stop/pause measuring times - decrement the number of start/stop so that we don't recount the next start
 void println()
          simple print utility for lazy folks
 void setName(String name)
           
 void start()
          start measuring times
 void stop()
          stop/pause measuring times
 String toString()
           
 KElement toXML()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CPUTimer

public CPUTimer(boolean bStart)
Parameters:
bStart - if true, start measuring now
Method Detail

getName

public String getName()
Returns:
the name

add

public void add(CPUTimer timer)
add a timer to this

Parameters:
timer -

setName

public void setName(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 String toString()
Overrides:
toString in class Object
Returns:
See Also:
Object.toString()

getSingleSummary

public 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



Copyright © 2013. All Rights Reserved.