pub struct ProgRuntimeStats {
pub name: String,
pub cnt: u64,
pub nsecs: u64,
pub misses: u64,
}Expand description
Per-program runtime stats summed across all CPUs.
Mirrors the kernel’s struct bpf_prog_stats (include/linux/filter.h):
cnt (invocations), nsecs (cumulative runtime), misses (recursion
re-entries skipped via bpf_prog_inc_misses_counter,
kernel/bpf/syscall.c). All three counters are u64 monotonics summed
across the program’s per-CPU bpf_prog_stats slots.
Fields§
§name: StringProgram name as registered with the kernel.
cnt: u64Total invocation count across all CPUs.
nsecs: u64Total CPU time in nanoseconds across all CPUs.
misses: u64Total recursion misses across all CPUs. A miss is a re-entry attempt blocked by the program’s per-CPU recursion guard.
Implementations§
Source§impl ProgRuntimeStats
impl ProgRuntimeStats
Sourcepub fn ns_per_call(&self) -> f64
pub fn ns_per_call(&self) -> f64
Mean nanoseconds per invocation: nsecs / cnt. Returns
0.0 when cnt == 0 (program never ran or counter not
running) so the result never propagates NaN / Infinity
into downstream finite_or_zero filters. Method-only access
(no stored shadow) — recomputed every call from the raw
fields, matching the super::super::assert::CgroupStats::wake_latency_tail_ratio
derived-ratio convention.
Unitless-from-bpftop’s perspective: bpftop-style triage reads “ns/call” as the primary cost-per-invocation metric; surfacing it here lets a failure-dump consumer compare two programs’ per-call cost without dividing the wire counters manually.
Sourcepub fn miss_rate(&self) -> f64
pub fn miss_rate(&self) -> f64
Fraction of invocation attempts blocked by the per-CPU
recursion guard: misses / (cnt + misses). Returns 0.0
when both counters are zero (no signal); never produces
NaN / Infinity even on a saturated cnt + misses
overflow because saturating_add floors at u64::MAX and
the resulting denominator is non-zero.
A non-trivial miss rate signals lock contention or a
misconfigured recursion guard — bpftop-style triage flags
any program with miss_rate > 0.01 as a hot recursion
path. Method-only access (no stored shadow); the wire
format carries cnt and misses separately so consumers
who want the raw counts can recover them.
Trait Implementations§
Source§impl Clone for ProgRuntimeStats
impl Clone for ProgRuntimeStats
Source§fn clone(&self) -> ProgRuntimeStats
fn clone(&self) -> ProgRuntimeStats
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProgRuntimeStats
impl Debug for ProgRuntimeStats
Source§impl Default for ProgRuntimeStats
impl Default for ProgRuntimeStats
Source§fn default() -> ProgRuntimeStats
fn default() -> ProgRuntimeStats
Source§impl<'de> Deserialize<'de> for ProgRuntimeStats
impl<'de> Deserialize<'de> for ProgRuntimeStats
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>,
Source§impl Display for ProgRuntimeStats
impl Display for ProgRuntimeStats
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
One-line summary used by super::dump::FailureDumpReport’s
human-readable rendering: name + the three counter sums plus
the bpftop-style derived metrics (ns/call, miss-rate fraction).
Derived metrics elide when their guards fire (cnt==0 or
cnt+misses==0) so a program that never ran renders without
misleading “0.000 ns/call” noise.
Auto Trait Implementations§
impl Freeze for ProgRuntimeStats
impl RefUnwindSafe for ProgRuntimeStats
impl Send for ProgRuntimeStats
impl Sync for ProgRuntimeStats
impl Unpin for ProgRuntimeStats
impl UnwindSafe for ProgRuntimeStats
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