Class TimeTracker
java.lang.Object
com.aquima.interactions.foundation.timetracker.TimeTracker
- All Implemented Interfaces:
ITimeTracker
,Serializable
Utility class to monitor processing times.
- Since:
- 5.0
- Author:
- Jon van Leuven
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor that creates a time tracker with the name 'root'.TimeTracker
(String name) Constructs a time tracker with the specified name.TimeTracker
(String name, String type) Constructs a time tracker with the specified name and type.TimeTracker
(String name, String type, TimeTracker parent) Constructs a time tracker with the specified name, type and parent. -
Method Summary
Modifier and TypeMethodDescriptionlong
Ends a sub time tracker.void
endAll()
Ends all open time trackers.long
Gets the time in milliseconds when the tracker is ended.getName()
Returns the name.long
Gets the time in milliseconds when the tracker is started.long
Gets the total processing time of the time tracker in milliseconds.getType()
Returns the type.void
iterateChilds
(IChildVisitor visitor) Iterates all direct sub time trackers.void
log()
Logs the time tracker result to a default logger.void
Logs the time tracker result to a custom logger.void
Start a new sub time tracker.void
Start a new sub time tracker.toXml()
This methods returns an XML representation of the time tracker.
-
Constructor Details
-
TimeTracker
public TimeTracker()Default constructor that creates a time tracker with the name 'root'. -
TimeTracker
Constructs a time tracker with the specified name.- Parameters:
name
- The name of the time tracker
-
TimeTracker
Constructs a time tracker with the specified name and type.- Parameters:
name
- The name of the time trackertype
- The type of the time tracker
-
TimeTracker
Constructs a time tracker with the specified name, type and parent.- Parameters:
name
- The name of the time trackertype
- The type of the time trackerparent
- The parent time tracker.
-
-
Method Details
-
start
Description copied from interface:ITimeTracker
Start a new sub time tracker.- Specified by:
start
in interfaceITimeTracker
- Parameters:
name
- name of the tracker, cannot be null
-
start
Description copied from interface:ITimeTracker
Start a new sub time tracker.- Specified by:
start
in interfaceITimeTracker
- Parameters:
name
- name of the tracker, cannot be nulltype
- type of tracker
-
end
Description copied from interface:ITimeTracker
Ends a sub time tracker. Recursively processes all sub time trackers and closes the deepest found tracker.- Specified by:
end
in interfaceITimeTracker
- Parameters:
name
- name of the tracker, cannot be null- Returns:
- the time in milliseconds when the tracker is ended.
-
endAll
public void endAll()Description copied from interface:ITimeTracker
Ends all open time trackers.- Specified by:
endAll
in interfaceITimeTracker
-
getTotalMillis
public long getTotalMillis()Description copied from interface:ITimeTracker
Gets the total processing time of the time tracker in milliseconds.- Specified by:
getTotalMillis
in interfaceITimeTracker
- Returns:
- the total processing time of the time tracker in milliseconds.
-
getStartMillis
public long getStartMillis()Description copied from interface:ITimeTracker
Gets the time in milliseconds when the tracker is started.- Specified by:
getStartMillis
in interfaceITimeTracker
- Returns:
- the time in milliseconds when the tracker is started.
-
getEndMillis
public long getEndMillis()Description copied from interface:ITimeTracker
Gets the time in milliseconds when the tracker is ended.- Specified by:
getEndMillis
in interfaceITimeTracker
- Returns:
- the time in milliseconds when the tracker is ended.
-
getType
Description copied from interface:ITimeTracker
Returns the type.- Specified by:
getType
in interfaceITimeTracker
- Returns:
- the type of the time tracker.
-
getName
Description copied from interface:ITimeTracker
Returns the name.- Specified by:
getName
in interfaceITimeTracker
- Returns:
- The name of the time tracker.
-
iterateChilds
Description copied from interface:ITimeTracker
Iterates all direct sub time trackers.- Specified by:
iterateChilds
in interfaceITimeTracker
- Parameters:
visitor
- to process children
-
log
Description copied from interface:ITimeTracker
Logs the time tracker result to a custom logger.- Specified by:
log
in interfaceITimeTracker
- Parameters:
log
- The logger that should be used to write the result to.
-
log
public void log()Description copied from interface:ITimeTracker
Logs the time tracker result to a default logger.- Specified by:
log
in interfaceITimeTracker
-
toXml
Description copied from interface:ITimeTracker
This methods returns an XML representation of the time tracker.- Specified by:
toXml
in interfaceITimeTracker
- Returns:
- an XML representation of the time tracker.
-