Package adams.flow.execution
Class TraceExecutionTime
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.execution.AbstractFlowExecutionListener
-
- adams.flow.execution.TraceExecutionTime
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<FlowExecutionListener>
,SizeOfHandler
,FlowExecutionListener
,Serializable
,Comparable
public class TraceExecutionTime extends AbstractFlowExecutionListener
Shows how much time actors are taking being executed (each execution is logged) separately.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING min-user-mode: Expert
-type <Input|Execute|Output> [-type ...] (property: types) The execution types to log. default: EXECUTE
-log-file <adams.core.io.PlaceholderFile> (property: logFile) The CSV log file to write to, uses TAB as column separator; writing is disabled if pointing to a directory. default: ${CWD}
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_Enabled
whether we can log anything.protected PlaceholderFile
m_LogFile
the file to write to.protected Map<String,Long>
m_Start
keeps track of the start time of an actor.protected ExecutionType[]
m_Types
the types to output.protected Set<ExecutionType>
m_TypesSet
the types to log.static String
TYPE_EXECUTE
the type for "execute".static String
TYPE_INPUT
the type for "input".static String
TYPE_OUTPUT
the type for "output".-
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 TraceExecutionTime()
-
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.void
defineOptions()
Adds options to the internal list of options.String
getListenerTitle()
The title of this listener.PlaceholderFile
getLogFile()
Returns the log file.ExecutionType[]
getTypes()
Returns the types to log.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.String
logFileTipText()
Returns the tip text for this property.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
setLogFile(PlaceholderFile value)
Sets the log file.void
setTypes(ExecutionType[] value)
Sets the types to log.void
startListening()
Gets called when the flow execution starts.String
typesTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.execution.AbstractFlowExecutionListener
compareTo, equals, finishListening, 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.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
TYPE_INPUT
public static final String TYPE_INPUT
the type for "input".- See Also:
- Constant Field Values
-
TYPE_EXECUTE
public static final String TYPE_EXECUTE
the type for "execute".- See Also:
- Constant Field Values
-
TYPE_OUTPUT
public static final String TYPE_OUTPUT
the type for "output".- See Also:
- Constant Field Values
-
m_Types
protected ExecutionType[] m_Types
the types to output.
-
m_LogFile
protected PlaceholderFile m_LogFile
the file to write to.
-
m_Enabled
protected boolean m_Enabled
whether we can log anything.
-
m_TypesSet
protected Set<ExecutionType> m_TypesSet
the types to log.
-
-
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
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionHandler
-
setTypes
public void setTypes(ExecutionType[] value)
Sets the types to log.- Parameters:
value
- the types
-
getTypes
public ExecutionType[] getTypes()
Returns the types to log.- Returns:
- the types
-
typesTipText
public String typesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLogFile
public void setLogFile(PlaceholderFile value)
Sets the log file.- Parameters:
value
- the file
-
getLogFile
public PlaceholderFile getLogFile()
Returns the log file.- Returns:
- the condition
-
logFileTipText
public String logFileTipText()
Returns the tip text for this property.- 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 classAbstractFlowExecutionListener
-
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
-
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
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
- Overrides:
cleanUp
in classAbstractFlowExecutionListener
-
-