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§
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 RefUnwindSafe for BlkIoController
impl Send for BlkIoController
impl Sync for BlkIoController
impl Unpin for BlkIoController
impl UnwindSafe for BlkIoController
Blanket Implementations§
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.