Skip to main content

ExecutionScheduler

Struct ExecutionScheduler 

Source
pub struct ExecutionScheduler { /* private fields */ }
Expand description

The hot-path execution scheduler.

Implementations§

Source§

impl ExecutionScheduler

Source

pub fn new( registry: Arc<Mutex<AgentRegistry>>, context: Arc<RwLock<Context>>, agent_ids: &[AgentId], ) -> Self

Creates a new scheduler.

Source

pub fn set_parallel_execution(&mut self, enabled: bool)

Enables or disables the parallel wave executor (default off).

Sound only when the phase’s agents correctly declare their AgentAccess: eligible agents must touch no World and write disjoint deck slots. With the default (all-Exclusive) declarations every wave is a singleton, so this is behaviourally identical to sequential execution.

Source

pub fn set_telemetry_sender(&mut self, sender: Sender<TelemetryEvent>)

Connects the read-only observation tunnel to the DCC. The scheduler then publishes per-agent cost samples and per-component access snapshots so the cold path can fit cost models and recommend layouts. Non-blocking: if the channel is full the sample is dropped (telemetry is best-effort).

Source

pub fn deck_mut(&mut self) -> &mut OutputDeck

Mutable access to the last frame’s [OutputDeck] — drained by the engine at the I/O boundary (e.g. GPU submit / present).

Source

pub fn budget_channel(&self) -> &BudgetChannel

Returns a reference to the budget channel for the DCC to send budgets.

Source

pub fn register_plugin(&mut self, plugin: EnginePlugin)

Registers an engine plugin.

Source

pub fn set_phase_order(&mut self, order: &[ExecutionPhase])

Sets the phase execution order.

Source

pub fn insert_after(&mut self, existing: ExecutionPhase, new: ExecutionPhase)

Inserts a phase after an existing phase.

Source

pub fn insert_before(&mut self, existing: ExecutionPhase, new: ExecutionPhase)

Inserts a phase before an existing phase.

Source

pub fn remove_phase(&mut self, phase: ExecutionPhase)

Removes a phase from the order.

Source

pub fn run_frame(&mut self, world: &mut World, runtime: Arc<Runtime>)

Executes the complete frame cycle.

This is called every frame by the engine loop.

§Fixed-timestep sequencing

Rendering runs at the display’s variable rate, but the simulation must advance in fixed increments to stay frame-rate independent and deterministic. The scheduler reconciles the two with an accumulator:

  1. Measure the real wall-clock delta since the previous frame, clamped to [MAX_FRAME_DELTA_SECONDS] (spiral-of-death guard), and add it to sim_accumulator.
  2. The fixed step is the smallest fixed_timestep declared by any registered agent (a single sim clock — physics owns it via its GORNA strategy). If no agent declares one, the frame degrades to the legacy “everything once per frame” path with no behaviour change.
  3. Consume whole steps: steps = floor(accumulator / fixed_delta), capped at [MAX_SIM_STEPS]; the remainder carries over and yields the render interpolation_alpha.
  4. Run the fixed-timestep agents (TRANSFORM-phase physics) steps times — a fixed-update sub-loop — so the provider advances N discrete sub-steps. Then run the regular phase loop once, excluding the agents already stepped, so OUTPUT-phase render fires a single time.
  5. Publish the fresh Time (delta, fixed_delta, alpha) into the runtime resource before the render phase reads it.

Substrate Flows project once per frame; the GORNA completion map, budget arbitration, and telemetry all observe each individual agent invocation (a sub-step counts as a real run, with its own cost sample).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AppLifecycle for T
where T: ?Sized,

§

fn on_start(&mut self, ctx: &mut dyn AppContext)

Called once after the backend is up but before the first update. Apps install their theme / fonts here.
§

fn on_exit(&mut self)

Called once when the window is closing. Persist state here.
§

impl<T> AsAny for T
where T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

Returns a reference to the inner value as &dyn Any.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.