Class AtomicMonotonicTimestampGenerator
A timestamp generator that guarantees monotonically increasing timestamps among all client threads and logs warnings when timestamps drift in the future.
Implements
Inherited Members
Namespace: Dse
Assembly: Dse.dll
Syntax
public class AtomicMonotonicTimestampGenerator : ITimestampGenerator
Constructors
AtomicMonotonicTimestampGenerator(Int32, Int32)
Creates a new instance of AtomicMonotonicTimestampGenerator.
Declaration
public AtomicMonotonicTimestampGenerator(int warningThreshold = 1000, int minLogInterval = 1000)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | warningThreshold | Determines how far in the future timestamps are allowed to drift before a warning is logged, expressed
in milliseconds. Default: |
System.Int32 | minLogInterval | In case of multiple log events, it determines the time separation between log events, expressed in
milliseconds. Use 0 to disable. Default: |
Fields
DefaultMinLogInterval
Default time separation between log events (expressed in milliseconds) in case of multiple log events.
Declaration
public const int DefaultMinLogInterval = 1000
Field Value
Type | Description |
---|---|
System.Int32 |
DefaultWarningThreshold
Default warning threshold in milliseconds.
Declaration
public const int DefaultWarningThreshold = 1000
Field Value
Type | Description |
---|---|
System.Int32 |
TicksPerMicrosecond
The amount of ticks per microsecond.
Declaration
protected const long TicksPerMicrosecond = 10L
Field Value
Type | Description |
---|---|
System.Int64 |
UnixEpochTicks
The amount of ticks since 1/1/1 to unix epoch.
Declaration
protected static readonly long UnixEpochTicks
Field Value
Type | Description |
---|---|
System.Int64 |
Methods
GetTimestamp()
Retrieves the current system-clock time in expressed microseconds since UNIX epoch.
Declaration
protected virtual long GetTimestamp()
Returns
Type | Description |
---|---|
System.Int64 |
Next()
Declaration
public long Next()
Returns
Type | Description |
---|---|
System.Int64 |