pub struct Context {
pub hardware: HardwareState,
pub mode: EngineMode,
pub global_budget_multiplier: f32,
pub memory_pressure: f32,
}Expand description
The complete context model used for strategic decision making.
Fields§
§hardware: HardwareStateObserved hardware state.
mode: EngineModeCurrent engine mode.
global_budget_multiplier: f32Global budget multiplier applied to all frame budgets for graceful performance degradation. Ranges from 0.0 (emergency) to 1.0 (full performance).
Driven by the DCC’s frame-time PID controller (khora_core::control::pid),
not a static table: the loop asservits this value so the measured frame
time tracks the heuristic-suggested latency (AnalysisReport::suggested_latency_ms,
itself modulated by thermal/battery/phase). On Critical thermal/battery or
high memory pressure the DCC additionally clamps it to a hard safety ceiling.
memory_pressure: f32System-memory pressure in [0, 1] — current_ram_bytes / memory_budget_bytes,
or 0.0 when the budget is unset. A first-class resource signal alongside
thermal/CPU/GPU: drives graceful degradation here and feeds the AGDF
repack-headroom gate (a repack transiently doubles a column, so it is
declined under high pressure).
Implementations§
Source§impl Context
impl Context
Sourcepub fn refresh_memory_pressure(&mut self)
pub fn refresh_memory_pressure(&mut self)
Recomputes Context::memory_pressure from the current RAM usage versus
the developer-set budget.
Pressure is current_ram_bytes / memory_budget_bytes, clamped to [0, 1].
An unset budget yields 0.0 (the signal is inert). This is a first-class
resource signal consumed by the heuristic engine and the AGDF repack gate;
it no longer feeds the budget multiplier directly — that is the PID loop’s
job — but it does drive the DCC’s hard safety clamp (see safety_ceiling).