#[non_exhaustive]pub struct CtprofMetricDef {
pub name: &'static str,
pub rule: AggRule,
pub sched_class: Option<&'static str>,
pub config_gates: &'static [&'static str],
pub is_dead: bool,
pub description: &'static str,
pub section: Section,
}Expand description
One metric exposed by the comparison pipeline.
The auto-scale ladder for the rendered cell is derived from
AggRule::ladder at render time — there is no separate
unit tag on the metric def. A registry entry that pairs an
AggRule variant with a category-mismatched ladder fails at
compile time (the ladder mapping is a closed match on the
variant, not a free-form string).
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.name: &'static str§rule: AggRule§sched_class: Option<&'static str>Scheduler-class scope for the metric. None means
class-agnostic — every task class accumulates the value
(e.g. nr_migrations). Concrete spellings:
"cfs-only"— incremented strictly inside CFS-class call paths (kernel/sched/fair.c), zero under SCHED_EXT / SCHED_FIFO / SCHED_RR / SCHED_DEADLINE / SCHED_IDLE. Examples:nr_wakeups_affine,nr_wakeups_affine_attempts,nr_failed_migrations_*,nr_forced_migrations,slice_max."fair-policy"— emitted only whenfair_policy(p->policy)returns true. Perkernel/sched/sched.h:194,203, that admits SCHED_NORMAL, SCHED_BATCH, AND SCHED_EXT (under CONFIG_SCHED_CLASS_EXT). Zero under SCHED_FIFO/RR/DL/IDLE. Example:fair_slice_ns."non-ext"— written by the schedstats sleep/wait family wrappers__update_stats_enqueue_sleeper(kernel/sched/stats.c:48) and__update_stats_wait_end(kernel/sched/stats.c:21), called from fair.c, rt.c, deadline.c but NOT ext.c — i.e. CFS/RT/DL accumulate, sched_ext bypasses. Examples:wait_sum,wait_count,wait_max,voluntary_sleep_ns,sleep_max,block_sum,block_max,iowait_sum,iowait_count.
config_gates: &'static [&'static str]Kernel CONFIG options that gate the metric. &[] means
no gating (always populated when the source path runs).
One element typically; multi-element when more than one
gate is required (e.g. core_forceidle_sum requires
CONFIG_SCHED_CORE AND CONFIG_SCHEDSTATS). Concrete
spellings match the literal Kconfig symbol so an
operator can grep CONFIG_X /boot/config-$(uname -r) to
confirm. Verified gates:
"CONFIG_SCHEDSTATS"— gates every__schedstat_*/schedstat_*macro call. Off → the macro isdo { } while (0)perkernel/sched/stats.h:75-82."CONFIG_SCHED_INFO"— gates the lighter-weightsched_info_*accounting (run_time_ns,wait_time_ns,timeslices); the schedstat file is gated bysched_info_on()atproc_pid_schedstat(fs/proc/base.c:511-523)."CONFIG_SCHED_CORE"— gates the core-scheduling subsystem (__account_forceidle_time)."CONFIG_SCHED_CLASS_EXT"— gates the sched_ext class. When off, no task can land on ext, soext_enabledreads false uniformly."CONFIG_TASK_DELAY_ACCT"— gates the delayacct accounting path that populates the taskstats genetlink delay-family fields (cpu_delay_*,blkio_delay_*, etc.)."CONFIG_TASK_IO_ACCOUNTING"— gates the per-task I/O accounting fields exposed by/proc/<tid>/io(rchar,wchar,syscr,syscw,read_bytes,write_bytes,cancelled_write_bytes). The kernel emits all 7 fields under onedo_io_accountingcall, and CONFIG_TASK_IO_ACCOUNTINGdepends onCONFIG_TASK_XACCT ininit/Kconfig— so from the procfs-reader perspective the file is all-or-nothing.
is_dead: boolTrue for kernel counters that are exposed in /proc
but never incremented anywhere in the kernel tree —
always reads zero. Operators reading the rendered table
see the [dead] flag and stop chasing the always-zero
cell. The registry is currently empty of is_dead: true
entries: the previously-registered dead counters
(nr_wakeups_idle, nr_wakeups_passive,
nr_migrations_cold) were dropped from ThreadState
and the registry; the kernel still emits the lines so
the parser silently ignores them. The flag remains as
infrastructure: a future kernel that resurrects a dead
counter (or exposes a new always-zero one) registers
with is_dead: true and the [dead] rendering path
fires.
description: &'static strOne-line operator-facing description of what this metric
counts. Surfaced by the ctprof metric-list
subcommand alongside the bracketed tag suffix so an
operator scanning a rendered table can map an unfamiliar
metric name to its semantics without leaving the CLI.
Plain ASCII. “Cumulative” is load-bearing — use it to
distinguish counters from gauges; the AggRule only
names the per-group reduction, not the per-thread
counter shape.
section: SectionSection this metric belongs to for the --sections
per-row filter. Most rows tag Section::Primary;
taskstats-sourced rows (the eight delay-accounting
categories plus the two memory watermarks) carry
Section::TaskstatsDelay so an operator can scope
the rendered table down to (or away from) the taskstats
rows. The primary-table emitter checks
DisplayOptions::is_section_enabled per row before
rendering — --sections taskstats-delay keeps only
taskstats rows, --sections primary excludes them, and
either alone keeps the primary table open. The default
(empty filter) renders every row regardless of section.
Trait Implementations§
Source§impl Clone for CtprofMetricDef
impl Clone for CtprofMetricDef
Source§fn clone(&self) -> CtprofMetricDef
fn clone(&self) -> CtprofMetricDef
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CtprofMetricDef
impl Debug for CtprofMetricDef
impl Copy for CtprofMetricDef
Auto Trait Implementations§
impl Freeze for CtprofMetricDef
impl RefUnwindSafe for CtprofMetricDef
impl Send for CtprofMetricDef
impl Sync for CtprofMetricDef
impl Unpin for CtprofMetricDef
impl UnwindSafe for CtprofMetricDef
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