#[non_exhaustive]pub struct PsiHalf {
pub avg10: u16,
pub avg60: u16,
pub avg300: u16,
pub total_usec: u64,
}Expand description
One Pressure Stall Information half-line: either the some
or full row for one resource. Mirrors the kernel emission
format %s avg10=%lu.%02lu avg60=%lu.%02lu avg300=%lu.%02lu total=%llu
in psi_show() (kernel/sched/psi.c).
avg10/60/300 are stored as centi-percent (lossless
fixed-point) — the kernel writes LOAD_INT(avg).LOAD_FRAC(avg)
as a 2-decimal-digit percentage in psi_show(). The integer
expansion is int * 100 + frac, giving a numerical range of
0..=10099. The upper bound is 100.99 (not 100.00)
because the kernel’s EWMA helper calc_load()
(include/linux/sched/loadavg.h) rounds via newload += FIXED_1 - 1 before the final >> FSHIFT, so a fully-loaded
group can land just over 100.0 for one sample. This avoids
serde JSON float-roundtrip drift that would manifest as
spurious non-zero deltas in compare output.
total_usec is microseconds (kernel
div_u64(total_ns, NSEC_PER_USEC) in psi_show()). Same unit
as CgroupCpuStats::usage_usec, so the existing
auto_scale “µs” ladder applies.
“some” semantics: at least one task is stalled on this
resource. “full” semantics: every runnable task is stalled.
At the SYSTEM level (/proc/pressure/cpu), cpu.full is
always zero by kernel design — the explicit gate
if (!(group == &psi_system && res == PSI_CPU && full)) in
psi_show() (kernel/sched/psi.c) skips the avg/total
computation, but the seq_printf in psi_show() still emits
the structurally-present line. Per-cgroup cpu.full (under
<cgroup>/cpu.pressure) IS meaningful and computed
normally. irq is full-only (kernel only_full = res == PSI_IRQ
in psi_show()), so PsiResource::some for irq always reads
zero.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.avg10: u1610-second running average of pressure %, scaled by 100 (so 0..=10099 covers 0.00..=100.99 — see the EWMA-rounding note on the struct doc).
avg60: u1660-second running average of pressure %, same scaling.
avg300: u16300-second running average of pressure %, same scaling.
total_usec: u64Cumulative total stalled time in microseconds.
Implementations§
Source§impl PsiHalf
impl PsiHalf
Sourcepub fn avg10_percent(&self) -> f64
pub fn avg10_percent(&self) -> f64
Convert the centi-percent avg10 value to a percentage
f64. Returns 0.0..=100.99 per the kernel’s EWMA
rounding (see struct-level doc).
Sourcepub fn avg60_percent(&self) -> f64
pub fn avg60_percent(&self) -> f64
Convert the centi-percent avg60 value to a percentage
f64. Same range as Self::avg10_percent.
Sourcepub fn avg300_percent(&self) -> f64
pub fn avg300_percent(&self) -> f64
Convert the centi-percent avg300 value to a percentage
f64. Same range as Self::avg10_percent.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PsiHalf
impl<'de> Deserialize<'de> for PsiHalf
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Copy for PsiHalf
Auto Trait Implementations§
impl Freeze for PsiHalf
impl RefUnwindSafe for PsiHalf
impl Send for PsiHalf
impl Sync for PsiHalf
impl Unpin for PsiHalf
impl UnwindSafe for PsiHalf
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more