Package kieker.monitoring.timer
Class SystemNanoTimer
java.lang.Object
kieker.monitoring.timer.AbstractTimeSource
kieker.monitoring.timer.SystemNanoTimer
- All Implemented Interfaces:
ITimeSource
public final class SystemNanoTimer extends AbstractTimeSource
A timer implementation, counting in nanoseconds since a specified offset.
- Since:
- 1.5
- Author:
- Jan Waller
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONFIG_OFFSETThis is the name of the configuration determining the used offset (in nanoseconds).static java.lang.StringCONFIG_UNITThis is the name of the configuration determining the used time unit (0 = nanoseconds, 1 = microseconds, 2 = milliseconds, 3 = seconds). -
Constructor Summary
Constructors Constructor Description SystemNanoTimer(Configuration configuration)Creates a new instance of this class using the given parameters. -
Method Summary
Modifier and Type Method Description longgetOffset()longgetTime()java.util.concurrent.TimeUnitgetTimeUnit()java.lang.StringtoString()
-
Field Details
-
CONFIG_OFFSET
public static final java.lang.String CONFIG_OFFSETThis is the name of the configuration determining the used offset (in nanoseconds). -
CONFIG_UNIT
public static final java.lang.String CONFIG_UNITThis is the name of the configuration determining the used time unit (0 = nanoseconds, 1 = microseconds, 2 = milliseconds, 3 = seconds).
-
-
Constructor Details
-
SystemNanoTimer
Creates a new instance of this class using the given parameters.- Parameters:
configuration- The configuration for this timer.
-
-
Method Details
-
getTime
public long getTime()- Returns:
- The timestamp for the current time in
TimeUnit. - See Also:
ITimeSource.getTimeUnit()
-
getOffset
public long getOffset()- Returns:
- The offset of the timesource to 1970-1-1 in
TimeUnit. - See Also:
ITimeSource.getTimeUnit()
-
getTimeUnit
public java.util.concurrent.TimeUnit getTimeUnit()- Returns:
- The
TimeUnitof the timesource.
-
toString
public java.lang.String toString()- Specified by:
toStringin interfaceITimeSource- Specified by:
toStringin classAbstractTimeSource- Returns:
- A String representation of the timesource. E.g., the meaning of a timestamp from this source.
-