#[non_exhaustive]pub struct CgroupStats {
pub cpu: CgroupCpuStats,
pub memory: CgroupMemoryStats,
pub pids: CgroupPidsStats,
pub psi: Psi,
}Expand description
Per-cgroup enrichment record attached to CtprofSnapshot.
Populated from the cgroup v2 filesystem at capture time. The
shape mirrors the kernel’s per-controller file layout:
CgroupCpuStats holds the cpu.* files,
CgroupMemoryStats holds the memory.* files,
CgroupPidsStats holds the pids.* files, and Psi
holds the <resource>.pressure files. These are
aggregate-over-the-cgroup values — NOT summable from
per-thread data — so the capture layer reads them directly
from cgroupfs rather than deriving.
Nested-struct shape (rather than a flat ~50-field struct)
mirrors the kernel’s controller-by-controller exposure: a
reader who knows the kernel layout can map directly between
cgroupfs files and Rust fields, and the merge policy in
crate::ctprof_compare::flatten_cgroup_stats applies
per-domain (max for limits, min for floors, saturating_add
for counters) without conflating across domains.
Schema note: the previous flat shape (4 fields:
cpu_usage_usec, nr_throttled, throttled_usec,
memory_current) is gone. Snapshots written by older
versions deserialize via serde’s defaulting — old fields
land on the new nested fields’ zero defaults rather than
migrating, so a baseline-vs-candidate compare against an
old snapshot produces “every counter went from N to 0”.
Re-capture both sides with the current build to compare
faithfully. Per the project’s pre-1.0 disposable-sidecar
policy this is intentional.
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.cpu: CgroupCpuStats§memory: CgroupMemoryStats§pids: CgroupPidsStats§psi: PsiPressure Stall Information for this cgroup, per resource.
Populated from <cgroup>/cpu.pressure,
<cgroup>/memory.pressure, <cgroup>/io.pressure, and
<cgroup>/irq.pressure (cgroup v2 files declared in
cgroup_psi_files[] (kernel/cgroup/cgroup.c)). Defaults to all-zero
when the kernel has CONFIG_PSI off, when PSI is disabled
at runtime via the psi=0 boot param, or when individual
resource files are absent (older kernels missing
irq.pressure).
Trait Implementations§
Source§impl Clone for CgroupStats
impl Clone for CgroupStats
Source§fn clone(&self) -> CgroupStats
fn clone(&self) -> CgroupStats
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CgroupStats
impl Debug for CgroupStats
Source§impl Default for CgroupStats
impl Default for CgroupStats
Source§fn default() -> CgroupStats
fn default() -> CgroupStats
Source§impl<'de> Deserialize<'de> for CgroupStats
impl<'de> Deserialize<'de> for CgroupStats
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>,
Auto Trait Implementations§
impl Freeze for CgroupStats
impl RefUnwindSafe for CgroupStats
impl Send for CgroupStats
impl Sync for CgroupStats
impl Unpin for CgroupStats
impl UnwindSafe for CgroupStats
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