Skip to content

Commit

Permalink
Merge pull request #338 from SebastiaanYN/CpuPressure-full
Browse files Browse the repository at this point in the history
Add `full` record to `CpuPressure`
  • Loading branch information
eminence authored Feb 18, 2025
2 parents eb07024 + c095d4b commit 2aa69ed
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions procfs-core/src/pressure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,27 @@ pub struct PressureRecord {
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub struct CpuPressure {
/// This record indicates the share of time in which at least some tasks are stalled.
pub some: PressureRecord,
/// This record indicates this share of time in which all non-idle tasks are stalled
/// simultaneously.
///
/// At the system level CPU full is set to zero.
pub full: PressureRecord,
}

impl super::FromBufRead for CpuPressure {
fn from_buf_read<R: std::io::BufRead>(mut r: R) -> ProcResult<Self> {
let mut some = String::new();
r.read_line(&mut some)?;

Ok(CpuPressure {
some: parse_pressure_record(&some)?,
})
let (some, full) = get_pressure(r)?;
Ok(CpuPressure { some, full })
}
}

/// Memory pressure information
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub struct MemoryPressure {
/// This record indicates the share of time in which at least some tasks are stalled
/// This record indicates the share of time in which at least some tasks are stalled.
pub some: PressureRecord,
/// This record indicates this share of time in which all non-idle tasks are stalled
/// simultaneously.
Expand All @@ -76,7 +78,7 @@ impl super::FromBufRead for MemoryPressure {
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub struct IoPressure {
/// This record indicates the share of time in which at least some tasks are stalled
/// This record indicates the share of time in which at least some tasks are stalled.
pub some: PressureRecord,
/// This record indicates this share of time in which all non-idle tasks are stalled
/// simultaneously.
Expand Down

0 comments on commit 2aa69ed

Please sign in to comment.