Motion Master 6.0.0-alpha.50
Next-generation motion control software
Loading...
Searching...
No Matches
CycleContext Struct Reference

Per-cycle timing context passed to every CyclicTask::execute(). More...

#include <cyclic_task.h>

Public Attributes

uint64_t elapsed = 0
 Cycles elapsed since run() = executed + skipped (grid index).
 
uint64_t skipped = 0
 Cycles skipped just before this cycle; 0 on the normal path.
 

Detailed Description

Per-cycle timing context passed to every CyclicTask::execute().

The game loop sleeps to a fixed deadline grid (CyclicTimer), so when a cycle is missed — an overrun or a scheduling stall, routine on a non-RT OS — the timer skips the backlog and re-syncs rather than firing missed cycles back-to-back. A task that generates a time-indexed target (e.g. trajectory playback) needs to know that happened; a task that only acts on the freshest state (e.g. ProcessDataCyclicTask) ignores this entirely.

The two views of the same event (both counts of cycles — the struct name supplies that unit):

  • elapsed — total cycles elapsed since run() began: the current cycle's absolute position on the deadline grid, equal to executed + skipped. It advances by 1 on a normal cycle and by 1 + skipped after a stall, so a target computed as a pure function of elapsed (e.g. cursor = ctx.elapsed - startCycle) stays on the real-time schedule across skips with no per-cycle accumulation — the same drift-free principle as the absolute-deadline timer itself.
  • skipped — cycles skipped immediately before this one; 0 on the normal path. For anomaly policy (e.g. an opt-in strict mode that aborts a move when the RT guarantee is badly violated), not for normal advancement. This is this cycle's skip count — distinct from the cumulative GameLoop::skippedCycles(), which is the running total since run().

Member Data Documentation

◆ elapsed

uint64_t CycleContext::elapsed = 0

Cycles elapsed since run() = executed + skipped (grid index).

◆ skipped

uint64_t CycleContext::skipped = 0

Cycles skipped just before this cycle; 0 on the normal path.


The documentation for this struct was generated from the following file: