pub enum SchedulerProfile {
Default,
RealtimeFifo {
priority: u8,
},
RealtimeRoundRobin {
priority: u8,
},
Deadline {
runtime_ns: u64,
deadline_ns: u64,
period_ns: u64,
},
}Expand description
Scheduler policy. Linux-specific (see sched(7)).
Variants§
Default
Linux SCHED_OTHER (CFS) — the default for all threads.
RealtimeFifo
Linux SCHED_FIFO — strictly priority-based, no quantum.
priority is the value of sched_priority (1..=99, higher
beats lower; 0 is not allowed for FIFO/RR with
non-empty queues, is accepted by the kernel but treated as
a SCHED_OTHER fallback).
Privileges: CAP_SYS_NICE from priority > 0 on; depending on
RLIMIT_RTPRIO also for priority 0.
RealtimeRoundRobin
Linux SCHED_RR — like FIFO, but with a round-robin quantum
per priority level.
Deadline
Linux SCHED_DEADLINE (CBS+EDF) — hard guarantees via a
(runtime, deadline, period) triple in nanoseconds.
See sched_setattr(2) for the spec. Conditions:
runtime <= deadline <= period- The kernel computes a bandwidth reservation. EBUSY if the global reservation blows the limit (default 95%).
Privileges: always CAP_SYS_NICE. Forks must not
inherit (otherwise EBUSY).
Implementations§
Source§impl SchedulerProfile
impl SchedulerProfile
Sourcepub fn apply_to_current_thread(&self) -> Result<()>
pub fn apply_to_current_thread(&self) -> Result<()>
Applies the profile to the calling thread.
§Errors
EPERM(PermissionDenied) if the privileges are missing.EINVAL(InvalidInput) on inconsistent deadline values.Unsupportedon non-Linux targets.
Trait Implementations§
Source§impl Clone for SchedulerProfile
impl Clone for SchedulerProfile
Source§fn clone(&self) -> SchedulerProfile
fn clone(&self) -> SchedulerProfile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SchedulerProfile
Source§impl Debug for SchedulerProfile
impl Debug for SchedulerProfile
impl Eq for SchedulerProfile
Source§impl PartialEq for SchedulerProfile
impl PartialEq for SchedulerProfile
Source§fn eq(&self, other: &SchedulerProfile) -> bool
fn eq(&self, other: &SchedulerProfile) -> bool
self and other values to be equal, and is used by ==.