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§
Source§impl 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§
Source§impl Clone for BlkIoController
impl Clone for BlkIoController
Source§fn clone(&self) -> BlkIoController
fn clone(&self) -> BlkIoController
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BlkIoController
impl Debug for BlkIoController
Source§impl<'a> From<&'a Subsystem> for &'a BlkIoController
impl<'a> From<&'a Subsystem> for &'a BlkIoController
Source§fn from(sub: &'a Subsystem) -> &'a BlkIoController
fn from(sub: &'a Subsystem) -> &'a BlkIoController
Auto Trait Implementations§
impl Freeze for BlkIoController
impl RefUnwindSafe for BlkIoController
impl Send for BlkIoController
impl Sync for BlkIoController
impl Unpin for BlkIoController
impl UnwindSafe for BlkIoController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Controller for Twhere
T: ControllerInternal,
impl<T> Controller for Twhere
T: ControllerInternal,
Source§fn 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.
Source§fn 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.