SimulatedTimestampGenerator Class

Generates simulated frame timestamps for paced (e.g., file replay) input by advancing a frame counter across the sub-second distribution of a defined frame rate, instead of reading the wall clock for every frame.

Definition

Namespace: Gemstone.PhasorProtocols
Assembly: Gemstone.PhasorProtocols (in Gemstone.PhasorProtocols.dll) Version: 1.0.188 -- Release Build+ec002b8b48825173d2bc841c82bc229f7f02dccd
public sealed class SimulatedTimestampGenerator
Inheritance
Object    SimulatedTimestampGenerator

Remarks

Millisecond aligned wall-clock timestamps, i.e., AlignToMillisecondDistribution(Ticks, Int32), cannot represent every frame slot when the frame rate exceeds 1,000 frames per second. For example, at 3,000 frames per second only about 2,000 distinct timestamps per second are produced, some slots twice, so consumers aligning to a 3,000-slot grid lose about a third of the frames. Reading the wall clock per frame also misplaces frames when replay pacing stalls and then bursts.

This generator anchors to the wall clock on the first frame, then issues each following frame the next slot of the FrameRate distribution at full tick resolution. Every timestamp lands exactly on the grid used by RoundToSubsecondDistribution(Ticks, Int32) and AlignToSubsecondDistribution(Ticks, Int32, Int64), each slot is used once, and consecutive frames are exactly one frame period apart. If the counter drifts from the wall clock by more than MaximumDrift, for example after a long stall in replay, the generator re-anchors to the wall clock so timestamps stay near real time.

Constructors

SimulatedTimestampGenerator Creates a new SimulatedTimestampGenerator.

Properties

FrameRate Gets the defined frame rate, in frames per second.
MaximumDrift Gets the maximum allowed difference between generated timestamps and the wall clock before re-anchoring.
Resynchronizations Gets the number of times the generator re-anchored to the wall clock because drift exceeded MaximumDrift.

Methods

AlignToFrameRate Floor-aligns timestamp to the sub-second distribution of frameRate.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
Next Gets the timestamp for the next frame, using the current UTC time as the wall-clock reference.
Next(Int64) Gets the timestamp for the next frame, using currentTicks as the wall-clock reference.
Reset Resets the generator so the next frame re-anchors to the wall clock.
ToStringReturns a string that represents the current object.
(Inherited from Object)

Fields

DefaultMaximumDrift Defines the default maximum drift between the frame counter and the wall clock before re-anchoring.
MaximumMillisecondFrameRate Defines the highest frame rate for which millisecond aligned timestamps can represent every frame slot.

See Also