Struct cgroups_rs::cpu::CpuController [−][src]
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
impl CpuController
[src]
pub fn new(root: PathBuf, v2: bool) -> Self
[src]
Contructs a new CpuController
with root
serving as the root of the control group.
pub fn cpu(&self) -> Cpu
[src]
Returns CPU time statistics based on the processes in the control group.
pub fn set_shares(&self, shares: u64) -> Result<()>
[src]
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)
pub fn shares(&self) -> Result<u64>
[src]
Retrieve the CPU bandwidth that this control group (relative to other control groups and this control group’s parent) can use.
pub fn set_cfs_period(&self, us: u64) -> Result<()>
[src]
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.
pub fn cfs_period(&self) -> Result<u64>
[src]
Retrieve the period of time of how often this cgroup’s access to the CPU should be reallocated in microseconds.
pub fn set_cfs_quota(&self, us: i64) -> Result<()>
[src]
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()
).
pub fn cfs_quota(&self) -> Result<i64>
[src]
Retrieve the quota of time for which all tasks in this cgroup can run during one period, in microseconds.
pub fn set_cfs_quota_and_period(
&self,
quota: Option<i64>,
period: Option<u64>
) -> Result<()>
[src]
&self,
quota: Option<i64>,
period: Option<u64>
) -> Result<()>
pub fn set_rt_runtime(&self, us: i64) -> Result<()>
[src]
pub fn set_rt_period_us(&self, us: u64) -> Result<()>
[src]
Trait Implementations
impl Clone for CpuController
[src]
fn clone(&self) -> CpuController
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for CpuController
[src]
impl<'a> From<&'a Subsystem> for &'a CpuController
[src]
fn from(sub: &'a Subsystem) -> &'a CpuController
[src]
Auto Trait Implementations
impl RefUnwindSafe for CpuController
impl Send for CpuController
impl Sync for CpuController
impl Unpin for CpuController
impl UnwindSafe for CpuController
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Controller for T where
T: ControllerInternal,
[src]
T: ControllerInternal,
pub fn control_type(&Self) -> Controllers
[src]
pub fn path(&Self) -> &Path
[src]
pub fn apply(&Self, &Resources) -> Result<(), Error>
[src]
Apply a set of resources to the Controller, invoking its internal functions to pass the kernel the information.
pub fn create(&Self)
[src]
Create this controller
pub fn set_notify_on_release(&Self, bool) -> Result<(), Error>
[src]
Set notify_on_release
pub fn set_release_agent(&Self, &str) -> Result<(), Error>
[src]
Set release_agent
pub fn exists(&Self) -> bool
[src]
Does this controller already exist?
pub fn delete(&Self) -> Result<(), Error>
[src]
Delete the controller.
pub fn add_task(&Self, &CgroupPid) -> Result<(), Error>
[src]
Attach a task to this controller.
pub fn add_task_by_tgid(&Self, &CgroupPid) -> Result<(), Error>
[src]
Attach a task to this controller by thread group id.
pub fn tasks(&Self) -> Vec<CgroupPid, Global>
[src]
Get the list of tasks that this controller has.
pub fn v2(&Self) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,