Interface ITickTracker
Defines a tick tracker used to measure timing, estimate rate, and derive execution status for a block.
Namespace: MOSAIC.Components.Interfaces
Assembly: MOSAIC.dll
Syntax
public interface ITickTracker
Remarks
A tick represents a recurring event of interest (for example: a successful publish, a scheduler cycle, or an input-processing step). Implementations record ticks and provide derived metrics such as CurrentRate and a higher-level BlockStatus via GetStatus(double, bool).
The desiredRate parameters are used as reference values for classification (idle/lagging/status).
They do not imply throttling; they are used to interpret measured timing.
Properties
CurrentRate
Gets the current estimated tick rate in Hertz (ticks per second).
Declaration
double CurrentRate { get; }
Property Value
| Type | Description |
|---|---|
| double |
Remarks
Implementations may return 0 until sufficient tick history is available to compute a stable estimate.
LastTick
Gets the timestamp (seconds) of the most recently recorded tick.
Declaration
double LastTick { get; }
Property Value
| Type | Description |
|---|---|
| double |
Remarks
The time base is implementation-specific. Implementations should document whether this is monotonic time, wall-clock time, or a UNIX-like representation.
Methods
GetStatus(double, bool)
Computes the current BlockStatus based on tick history, desired rate, and stumble state.
Declaration
BlockStatus GetStatus(double desiredRate, bool isStumbling = false)
Parameters
| Type | Name | Description |
|---|---|---|
| double | desiredRate | Desired rate in Hertz used for idle/lagging classification. |
| bool | isStumbling | Optional flag indicating a temporary stumble condition detected by the caller (e.g., lock contention or missed deadlines). |
Returns
| Type | Description |
|---|---|
| BlockStatus | A BlockStatus value representing the current execution state. |
Remarks
Implementations typically prioritize isStumbling over rate-based classifications to
surface short-term instability.
IsIdle(double)
Determines whether the stream of ticks is considered idle relative to a desired rate.
Declaration
bool IsIdle(double desiredRate)
Parameters
| Type | Name | Description |
|---|---|---|
| double | desiredRate | Desired rate in Hertz used to compute an inactivity threshold. |
Returns
| Type | Description |
|---|---|
| bool | true if ticks have not been recorded recently enough to satisfy the idle threshold; otherwise, false. |
Remarks
The exact definition of “idle” is implementation-specific, but it typically means that no ticks have
occurred for a timeout derived from desiredRate.
IsLagging(double)
Determines whether the current estimated tick rate is lagging relative to a desired rate.
Declaration
bool IsLagging(double desiredRate)
Parameters
| Type | Name | Description |
|---|---|---|
| double | desiredRate | Desired rate in Hertz used as the reference. |
Returns
| Type | Description |
|---|---|
| bool | true if the measured rate is below an implementation-defined threshold of
|
Remarks
Implementations commonly apply a tolerance to avoid oscillation due to jitter.
RecordTick()
Records a tick event at the current time.
Declaration
void RecordTick()
Remarks
Implementations should use a monotonic time source when possible to ensure stable rate estimation.