#[non_exhaustive]pub struct PerCpuTimeStats {
pub cpu: u32,
pub cpustat_user_ns: u64,
pub cpustat_nice_ns: u64,
pub cpustat_system_ns: u64,
pub cpustat_softirq_ns: u64,
pub cpustat_irq_ns: u64,
pub cpustat_idle_ns: u64,
pub cpustat_iowait_ns: u64,
pub cpustat_steal_ns: u64,
pub softirqs: [u64; 10],
pub irqs_sum: u64,
pub iowait_sleeptime_ns: Option<u64>,
}Expand description
Per-CPU CPU-time / softirq / IRQ snapshot captured at freeze time. One entry per CPU index visible to the host walker.
All counter fields are monotonic in the kernel — the freeze captures the instantaneous value at the moment the vCPUs rendezvous-park. Diffing two snapshots (or comparing against a pre-test baseline) is the consumer’s job; this type does not derive deltas.
Field semantics match the kernel sources:
cpustat_*_ns: ns counter fromkernel_cpustat::cpustat[CPUTIME_*]. Updated byaccount_user_time/account_system_index_timeand siblings (kernel/sched/cputime.c). The kernel stores nanoseconds;/proc/statdivides bycputime_to_clock_t.softirqs[i]:kernel_stat::softirqs[i]cumulative count incremented bykstat_incr_softirqs_this_cpuon every softirq raise. Indexed bysuper::btf_offsets::SOFTIRQ_NAMES.irqs_sum:kernel_stat::irqs_sumcumulative count incremented bykstat_incr_irq_this_cpuon every hardirq.iowait_sleeptime_ns:tick_sched::iowait_sleeptimeaccumulated only under NO_HZ when the CPU enters idle withnr_iowait > 0.Nonewhen CONFIG_NO_HZ_COMMON is off or the resolver couldn’t locatetick_cpu_sched.
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: u32CPU index (0-based) this entry describes.
cpustat_user_ns: u64cpustat[CPUTIME_USER] (ns).
cpustat_nice_ns: u64cpustat[CPUTIME_NICE] (ns).
cpustat_system_ns: u64cpustat[CPUTIME_SYSTEM] (ns).
cpustat_softirq_ns: u64cpustat[CPUTIME_SOFTIRQ] (ns).
cpustat_irq_ns: u64cpustat[CPUTIME_IRQ] (ns).
cpustat_idle_ns: u64cpustat[CPUTIME_IDLE] (ns).
cpustat_iowait_ns: u64cpustat[CPUTIME_IOWAIT] (ns).
cpustat_steal_ns: u64cpustat[CPUTIME_STEAL] (ns).
softirqs: [u64; 10]kernel_stat::softirqs[] per-vector cumulative counts.
Indexed by super::btf_offsets::SOFTIRQ_NAMES.
irqs_sum: u64kernel_stat::irqs_sum cumulative hardirq count.
iowait_sleeptime_ns: Option<u64>tick_sched::iowait_sleeptime accumulated NO_HZ idle time
with outstanding IO (ns). None when NO_HZ disabled or
tick_cpu_sched symbol was absent at resolve time.
Trait Implementations§
Source§impl Clone for PerCpuTimeStats
impl Clone for PerCpuTimeStats
Source§fn clone(&self) -> PerCpuTimeStats
fn clone(&self) -> PerCpuTimeStats
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PerCpuTimeStats
impl Debug for PerCpuTimeStats
Source§impl Default for PerCpuTimeStats
impl Default for PerCpuTimeStats
Source§fn default() -> PerCpuTimeStats
fn default() -> PerCpuTimeStats
Source§impl<'de> Deserialize<'de> for PerCpuTimeStats
impl<'de> Deserialize<'de> for PerCpuTimeStats
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 PerCpuTimeStats
impl RefUnwindSafe for PerCpuTimeStats
impl Send for PerCpuTimeStats
impl Sync for PerCpuTimeStats
impl Unpin for PerCpuTimeStats
impl UnwindSafe for PerCpuTimeStats
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