pub struct PowerSchedule {
pub active_secs: u64,
pub saver_secs: u64,
pub critical_secs: u64,
pub saver_below: f32,
pub critical_below: f32,
pub hysteresis: f32,
}Expand description
How often a node samples as its battery drains, in plain seconds.
This is the serializable form of a PowerPlan: a
manifest carries the three work intervals as whole seconds and the two
state-of-charge thresholds, and plan assembles the
pamoja-power governor from them. The thresholds may be omitted from a manifest,
in which case they default to entering the saver cadence below 50% charge and the
critical cadence below 20%. So may the hysteresis margin, which defaults to five
points: a node that fell below a threshold climbs back once the charge is 5% above
it, so a charge hovering at the threshold does not switch the cadence every cycle.
Fields§
§active_secs: u64Seconds between samples at a healthy charge.
saver_secs: u64Seconds between samples while conserving.
critical_secs: u64Seconds between samples when critically low.
saver_below: f32Enter the saver cadence below this state of charge.
critical_below: f32Enter the critical cadence below this state of charge.
hysteresis: f32How far above a threshold the charge must climb to leave the lower cadence.
Implementations§
Source§impl PowerSchedule
impl PowerSchedule
Sourcepub fn new(active_secs: u64, saver_secs: u64, critical_secs: u64) -> Self
pub fn new(active_secs: u64, saver_secs: u64, critical_secs: u64) -> Self
Creates a schedule from its three work intervals, with default thresholds.
§Arguments
active_secs- seconds between samples at a healthy charge.saver_secs- seconds between samples while conserving.critical_secs- seconds between samples when critically low.
§Returns
A schedule that enters the saver cadence below 50% charge and the critical cadence below 20%, and leaves each once the charge is five points above it.
Sourcepub fn with_thresholds(self, saver_below: f32, critical_below: f32) -> Self
pub fn with_thresholds(self, saver_below: f32, critical_below: f32) -> Self
Sourcepub fn with_hysteresis(self, margin: f32) -> Self
pub fn with_hysteresis(self, margin: f32) -> Self
Trait Implementations§
Source§impl Clone for PowerSchedule
impl Clone for PowerSchedule
Source§fn clone(&self) -> PowerSchedule
fn clone(&self) -> PowerSchedule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more