pub struct DegradationCascade { /* private fields */ }Expand description
Degradation cascade orchestrator.
Sits between the conformal frame guard and the render budget system.
Call [pre_render] before each frame and [post_render] after.
Implementations§
Source§impl DegradationCascade
impl DegradationCascade
Sourcepub fn new(config: CascadeConfig) -> Self
pub fn new(config: CascadeConfig) -> Self
Create a new cascade with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a cascade with default configuration.
Sourcepub fn pre_render(&mut self, budget_us: f64, key: BucketKey) -> PreRenderResult
pub fn pre_render(&mut self, budget_us: f64, key: BucketKey) -> PreRenderResult
Pre-render check: predict p99 and decide whether to degrade.
Returns the degradation level to use for this frame and the prediction. The caller should apply the returned level to the render budget.
Sourcepub fn post_render(&mut self, frame_time_us: f64, key: BucketKey)
pub fn post_render(&mut self, frame_time_us: f64, key: BucketKey)
Post-render observation: feed actual frame time to the guard.
Call this after the frame has been rendered with the measured time.
Sourcepub fn level(&self) -> DegradationLevel
pub fn level(&self) -> DegradationLevel
Get the current degradation level.
Sourcepub fn recovery_streak(&self) -> u32
pub fn recovery_streak(&self) -> u32
Get the current recovery streak.
Sourcepub fn total_degrades(&self) -> u64
pub fn total_degrades(&self) -> u64
Total degrade events.
Sourcepub fn total_recoveries(&self) -> u64
pub fn total_recoveries(&self) -> u64
Total recovery events.
Sourcepub fn last_evidence(&self) -> Option<&CascadeEvidence>
pub fn last_evidence(&self) -> Option<&CascadeEvidence>
Access the last cascade evidence.
Sourcepub fn guard(&self) -> &ConformalFrameGuard
pub fn guard(&self) -> &ConformalFrameGuard
Access the underlying guard.
Sourcepub fn config(&self) -> &CascadeConfig
pub fn config(&self) -> &CascadeConfig
Access the configuration.
Sourcepub fn should_render_widget(&self, is_essential: bool) -> bool
pub fn should_render_widget(&self, is_essential: bool) -> bool
Whether widget should render given current degradation level and essentiality.
At EssentialOnly or higher degradation, non-essential widgets are skipped.
Sourcepub fn telemetry(&self) -> CascadeTelemetry
pub fn telemetry(&self) -> CascadeTelemetry
Capture telemetry for the cascade.