Struct cgroups_rs::blkio::BlkIoController
source · [−]pub struct BlkIoController { /* private fields */ }Expand description
A controller that allows controlling the blkio subsystem of a Cgroup.
In essence, using the blkio controller one can limit and throttle the tasks’ usage of block
devices in the control group.
Implementations
sourceimpl BlkIoController
impl BlkIoController
sourcepub fn new(root: PathBuf, v2: bool) -> Self
pub fn new(root: PathBuf, v2: bool) -> Self
Constructs a new BlkIoController with root serving as the root of the control group.
sourcepub fn blkio(&self) -> BlkIo
pub fn blkio(&self) -> BlkIo
Gathers statistics about and reports the state of the block devices used by the control group’s tasks.
sourcepub fn set_leaf_weight(&self, w: u64) -> Result<()>
pub fn set_leaf_weight(&self, w: u64) -> Result<()>
Set the leaf weight on the control group’s tasks, i.e., how are they weighted against the descendant control groups’ tasks.
sourcepub fn set_leaf_weight_for_device(
&self,
major: u64,
minor: u64,
weight: u64
) -> Result<()>
pub fn set_leaf_weight_for_device(
&self,
major: u64,
minor: u64,
weight: u64
) -> Result<()>
Same as set_leaf_weight(), but settable per each block device.
sourcepub fn reset_stats(&self) -> Result<()>
pub fn reset_stats(&self) -> Result<()>
Reset the statistics the kernel has gathered so far and start fresh.
sourcepub fn throttle_read_bps_for_device(
&self,
major: u64,
minor: u64,
bps: u64
) -> Result<()>
pub fn throttle_read_bps_for_device(
&self,
major: u64,
minor: u64,
bps: u64
) -> Result<()>
Throttle the bytes per second rate of read operation affecting the block device
major:minor to bps.
sourcepub fn throttle_read_iops_for_device(
&self,
major: u64,
minor: u64,
iops: u64
) -> Result<()>
pub fn throttle_read_iops_for_device(
&self,
major: u64,
minor: u64,
iops: u64
) -> Result<()>
Throttle the I/O operations per second rate of read operation affecting the block device
major:minor to bps.
sourcepub fn throttle_write_bps_for_device(
&self,
major: u64,
minor: u64,
bps: u64
) -> Result<()>
pub fn throttle_write_bps_for_device(
&self,
major: u64,
minor: u64,
bps: u64
) -> Result<()>
Throttle the bytes per second rate of write operation affecting the block device
major:minor to bps.
sourcepub fn throttle_write_iops_for_device(
&self,
major: u64,
minor: u64,
iops: u64
) -> Result<()>
pub fn throttle_write_iops_for_device(
&self,
major: u64,
minor: u64,
iops: u64
) -> Result<()>
Throttle the I/O operations per second rate of write operation affecting the block device
major:minor to bps.
sourcepub fn set_weight(&self, w: u64) -> Result<()>
pub fn set_weight(&self, w: u64) -> Result<()>
Set the weight of the control group’s tasks.
Trait Implementations
sourceimpl Clone for BlkIoController
impl Clone for BlkIoController
sourcefn clone(&self) -> BlkIoController
fn clone(&self) -> BlkIoController
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresourceimpl Debug for BlkIoController
impl Debug for BlkIoController
sourceimpl<'a> From<&'a Subsystem> for &'a BlkIoController
impl<'a> From<&'a Subsystem> for &'a BlkIoController
sourcefn from(sub: &'a Subsystem) -> &'a BlkIoController
fn from(sub: &'a Subsystem) -> &'a BlkIoController
Auto Trait Implementations
impl RefUnwindSafe for BlkIoController
impl Send for BlkIoController
impl Sync for BlkIoController
impl Unpin for BlkIoController
impl UnwindSafe for BlkIoController
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Controller for Twhere
T: ControllerInternal,
impl<T> Controller for Twhere
T: ControllerInternal,
sourcefn apply(&self, res: &Resources) -> Result<(), Error>
fn apply(&self, res: &Resources) -> Result<(), Error>
Apply a set of resources to the Controller, invoking its internal functions to pass the kernel the information.
sourcefn add_task_by_tgid(&self, pid: &CgroupPid) -> Result<(), Error>
fn add_task_by_tgid(&self, pid: &CgroupPid) -> Result<(), Error>
Attach a task to this controller by thread group id.
sourcefn tasks(&self) -> Vec<CgroupPid, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
fn tasks(&self) -> Vec<CgroupPid, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Get the list of tasks that this controller has.