Interface ITimeTracker
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
NullTracker
,TimeTracker
Utility interface to monitor processing times.
- Since:
- 5.0
- Author:
- Jon van Leuven
-
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.
-
Method Details
-
start
Start a new sub time tracker.- Parameters:
name
- name of the tracker, cannot be nulltype
- type of tracker
-
start
Start a new sub time tracker.- Parameters:
name
- name of the tracker, cannot be null
-
end
Ends a sub time tracker. Recursively processes all sub time trackers and closes the deepest found tracker.- Parameters:
name
- name of the tracker, cannot be null- Returns:
- the time in milliseconds when the tracker is ended.
- Throws:
IllegalStateException
- exception is raised when there is no sub tracker to close or the track contains children that needs to be closed first.
-
endAll
void endAll()Ends all open time trackers. -
getTotalMillis
long getTotalMillis()Gets the total processing time of the time tracker in milliseconds.- Returns:
- the total processing time of the time tracker in milliseconds.
-
getStartMillis
long getStartMillis()Gets the time in milliseconds when the tracker is started.- Returns:
- the time in milliseconds when the tracker is started.
-
getEndMillis
long getEndMillis()Gets the time in milliseconds when the tracker is ended.- Returns:
- the time in milliseconds when the tracker is ended.
-
log
void log()Logs the time tracker result to a default logger.- Throws:
IllegalStateException
- an exception is raised when there are non-ended sub trackers
-
log
Logs the time tracker result to a custom logger.- Parameters:
log
- The logger that should be used to write the result to.- Throws:
IllegalStateException
- an exception is raised when there are non-ended sub trackers
-
toXml
IXmlElement toXml()This methods returns an XML representation of the time tracker.- Returns:
- an XML representation of the time tracker.
- Throws:
IllegalStateException
- an exception is raised when there are non-ended sub trackers
-
iterateChilds
Iterates all direct sub time trackers.- Parameters:
visitor
- to process children
-
getType
String getType()Returns the type.- Returns:
- the type of the time tracker.
-
getName
String getName()Returns the name.- Returns:
- The name of the time tracker.
-