Package adams.flow.execution
Class Time
- java.lang.Object
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<FlowExecutionListener>
,SizeOfHandler
,FlowExecutionListener
,GraphicalFlowExecutionListener
,TimedFlowExecutionListener
,Serializable
,Comparable
public class Time extends AbstractTimedFlowExecutionListenerWithTable
Shows how much time actors are taking in their method calls (gets accumulated).
Valid options are:
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-update-interval <int> (property: updateInterval) The update interval (= number of method executions) after which the GUI gets refreshed. default: 100 minimum: 1
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Long>
m_Overall
keeps track of the time that actors used up.protected Map<String,Long>
m_Start
keeps track of the start time of an actor.static String
SUFFIX_EXECUTE
the suffix for "execute".static String
SUFFIX_INPUT
the suffix for "input".static String
SUFFIX_OUTPUT
the suffix for "output".-
Fields inherited from class adams.flow.execution.AbstractTimedFlowExecutionListenerWithTable
m_Counter, m_UpdateInterval
-
Fields inherited from class adams.flow.execution.AbstractFlowExecutionListenerWithTable
m_FileChooser, m_Table
-
Fields inherited from class adams.flow.execution.AbstractGraphicalFlowExecutionListener
m_ListenerPanel
-
Fields inherited from class adams.flow.execution.AbstractFlowExecutionListener
m_Owner
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description Time()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addDuration(String key)
Adds the duration to the overall count.protected void
addStart(String key)
Adds the start time.void
cleanUp()
Cleans up data structures, frees up memory.protected TableModel
createTableModel()
Creates a new table model with the current data.void
finishListening()
Gets called when the flow execution ends.protected int
getDefaultUpdateInterval()
Returns the default update interval.String
getListenerTitle()
The title of this listener.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.void
postExecute(Actor actor)
Gets called after the actor was executed.void
postInput(Actor actor)
Gets called after the actor received the token.void
postOutput(Actor actor, Token token)
Gets called after a token was acquired from the actor.void
preExecute(Actor actor)
Gets called before the actor gets executed.void
preInput(Actor actor, Token token)
Gets called before the actor receives the token.void
preOutput(Actor actor)
Gets called before a token gets obtained from the actor.void
startListening()
Gets called when the flow execution starts.String
updateIntervalTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.execution.AbstractTimedFlowExecutionListenerWithTable
defineOptions, getUpdateInterval, incCounter, setUpdateInterval
-
Methods inherited from class adams.flow.execution.AbstractFlowExecutionListenerWithTable
getFileChooser, getSheet, newListenerPanel, updateGUI
-
Methods inherited from class adams.flow.execution.AbstractGraphicalFlowExecutionListener
getDefaultFrameSize, getDisposeOnFinish, newListenerPanelIfNecessary
-
Methods inherited from class adams.flow.execution.AbstractFlowExecutionListener
compareTo, equals, getListeners, getOwner, setOwner, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.execution.FlowExecutionListener
getOwner, setOwner
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
SUFFIX_INPUT
public static final String SUFFIX_INPUT
the suffix for "input".- See Also:
- Constant Field Values
-
SUFFIX_EXECUTE
public static final String SUFFIX_EXECUTE
the suffix for "execute".- See Also:
- Constant Field Values
-
SUFFIX_OUTPUT
public static final String SUFFIX_OUTPUT
the suffix for "output".- See Also:
- Constant Field Values
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractFlowExecutionListenerWithTable
-
updateIntervalTipText
public String updateIntervalTipText()
Returns the tip text for this property.- Specified by:
updateIntervalTipText
in interfaceTimedFlowExecutionListener
- Specified by:
updateIntervalTipText
in classAbstractTimedFlowExecutionListenerWithTable
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getListenerTitle
public String getListenerTitle()
The title of this listener.- Returns:
- the title
-
startListening
public void startListening()
Gets called when the flow execution starts.- Specified by:
startListening
in interfaceFlowExecutionListener
- Overrides:
startListening
in classAbstractTimedFlowExecutionListenerWithTable
-
addStart
protected void addStart(String key)
Adds the start time.- Parameters:
key
- the key in the hashtable
-
addDuration
protected void addDuration(String key)
Adds the duration to the overall count.- Parameters:
key
- the key in the hashtable
-
getDefaultUpdateInterval
protected int getDefaultUpdateInterval()
Returns the default update interval.- Overrides:
getDefaultUpdateInterval
in classAbstractTimedFlowExecutionListenerWithTable
-
createTableModel
protected TableModel createTableModel()
Creates a new table model with the current data.- Specified by:
createTableModel
in classAbstractFlowExecutionListenerWithTable
- Returns:
- the model with the current data
-
preInput
public void preInput(Actor actor, Token token)
Gets called before the actor receives the token.- Specified by:
preInput
in interfaceFlowExecutionListener
- Overrides:
preInput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that will receive the tokentoken
- the token that the actor will receive
-
postInput
public void postInput(Actor actor)
Gets called after the actor received the token.- Specified by:
postInput
in interfaceFlowExecutionListener
- Overrides:
postInput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that received the token
-
preExecute
public void preExecute(Actor actor)
Gets called before the actor gets executed.- Specified by:
preExecute
in interfaceFlowExecutionListener
- Overrides:
preExecute
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that gets executed
-
postExecute
public void postExecute(Actor actor)
Gets called after the actor was executed.- Specified by:
postExecute
in interfaceFlowExecutionListener
- Overrides:
postExecute
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that was executed
-
preOutput
public void preOutput(Actor actor)
Gets called before a token gets obtained from the actor.- Specified by:
preOutput
in interfaceFlowExecutionListener
- Overrides:
preOutput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor the token gets obtained from
-
postOutput
public void postOutput(Actor actor, Token token)
Gets called after a token was acquired from the actor.- Specified by:
postOutput
in interfaceFlowExecutionListener
- Overrides:
postOutput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that the token was acquired fromtoken
- the token that was acquired from the actor
-
finishListening
public void finishListening()
Gets called when the flow execution ends.
Outputs the counts in debug mode.- Specified by:
finishListening
in interfaceFlowExecutionListener
- Overrides:
finishListening
in classAbstractGraphicalFlowExecutionListener
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
- Overrides:
cleanUp
in classAbstractTimedFlowExecutionListenerWithTable
-
-