The core driver re-armed itself via wake_by_ref() after every poll, an unconditional spin at scheduler speed per worker for the engine's lifetime. The provisioning-reconciler-demo supervisor + 3 node children burned ~750% CPU idle; now ~50% (demo churn), wakeup latency for work delivered to an idle worker bounded by the idle interval. - ExecutionBackend::core_idle_poll() (default Duration::ZERO = previous immediate re-arm) lets a backend opt its drivers into idle parking. - TokioConfig::core_idle_poll (default 500us) configures it for the Tokio backend; from_runtime adopts the default. - CoreDriver: busy tick (or zero interval) re-arms immediately; idle tick arms one backend timer and parks. Every poll still runs exactly one try_tick, so stepping-backend semantics are unchanged. The backend is held Weak and touched only on idle transitions; if the engine is gone the driver parks until the substrate cancels it. - Contract tests: a parked driver observes a late external (engine-invisible) send within the idle interval; the backend reports its configured interval.
23 lines
800 B
Rust
23 lines
800 B
Rust
//! swactor-engine: an execution engine that drives a `swactor` core runtime on
|
|
//! a selected substrate without exposing that substrate through its handle.
|
|
//!
|
|
//! The default substrate is Tokio; a deterministic [`SteppingBackend`] provides
|
|
//! a non-Tokio portability proof. The public contract is defined by
|
|
//! [`ENGINE_SPEC.md`](../ENGINE_SPEC.md).
|
|
#![deny(clippy::disallowed_methods)]
|
|
mod backend;
|
|
mod core_driver;
|
|
mod engine;
|
|
mod stepping;
|
|
mod time;
|
|
|
|
#[cfg(feature = "tokio")]
|
|
mod tokio;
|
|
|
|
pub use backend::{BoxTask, BoxTimer, BoxWork, Capabilities, EngineError, ExecutionBackend};
|
|
pub use engine::{Engine, EngineHandle};
|
|
pub use stepping::SteppingBackend;
|
|
pub use time::{Elapsed, EngineInstant, Interval, Timeout, Timer};
|
|
|
|
#[cfg(feature = "tokio")]
|
|
pub use tokio::{TokioBackend, TokioConfig};
|