Struct cgroups::cpu::CpuController
source · pub struct CpuController { /* private fields */ }
Expand description
A controller that allows controlling the cpu
subsystem of a Cgroup.
In essence, it allows gathering information about how much the tasks inside the control group are using the CPU and creating rules that limit their usage. Note that this crate does not yet support managing realtime tasks.
Implementations
sourceimpl CpuController
impl CpuController
sourcepub fn new(oroot: PathBuf) -> Self
pub fn new(oroot: PathBuf) -> Self
Contructs a new CpuController
with oroot
serving as the root of the control group.
sourcepub fn cpu(&self) -> Cpu
pub fn cpu(&self) -> Cpu
Returns CPU time statistics based on the processes in the control group.
Configures the CPU bandwidth (in relative relation to other control groups and this control group’s parent).
For example, setting control group A
’s shares
to 100
, and control group B
’s
shares
to 200
ensures that control group B
receives twice as much as CPU bandwidth.
(Assuming both A
and B
are of the same parent)
Retrieve the CPU bandwidth that this control group (relative to other control groups and this control group’s parent) can use.
sourcepub fn set_cfs_period(&self, us: u64) -> Result<()>
pub fn set_cfs_period(&self, us: u64) -> Result<()>
Specify a period (when using the CFS scheduler) of time in microseconds for how often this control group’s access to the CPU should be reallocated.
sourcepub fn cfs_period(&self) -> Result<u64>
pub fn cfs_period(&self) -> Result<u64>
Retrieve the period of time of how often this cgroup’s access to the CPU should be reallocated in microseconds.
sourcepub fn set_cfs_quota(&self, us: u64) -> Result<()>
pub fn set_cfs_quota(&self, us: u64) -> Result<()>
Specify a quota (when using the CFS scheduler) of time in microseconds for which all tasks
in this control group can run during one period (see: set_cfs_period()
).
Trait Implementations
sourceimpl Clone for CpuController
impl Clone for CpuController
sourcefn clone(&self) -> CpuController
fn clone(&self) -> CpuController
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more