Skip to main content

CpuMetrics

Struct CpuMetrics 

Source
pub struct CpuMetrics {
Show 16 fields pub utilization_pct: f64, pub per_core_pct: Vec<f64>, pub utime_secs: f64, pub stime_secs: f64, pub process_count: u32, pub process_cores_used: Option<f64>, pub process_child_count: Option<u32>, pub process_utime_secs: Option<f64>, pub process_stime_secs: Option<f64>, pub process_rss_mib: Option<u64>, pub process_disk_read_bytes: Option<u64>, pub process_disk_write_bytes: Option<u64>, pub process_gpu_usage: Option<f64>, pub process_gpu_vram_mib: Option<f64>, pub process_gpu_utilized: Option<u32>, pub process_tree_pids: Vec<i32>,
}
Expand description

CPU metrics derived from /proc/stat tick deltas.

Fields§

§utilization_pct: f64

Aggregate CPU utilization expressed as fractional cores in use (0.0..N_cores). e.g. 4.6 on a 16-core host means ~4.6 vCPUs are fully utilized. Not clamped; values very slightly above N_cores are valid under kernel rounding. N_cores is available via host discovery (host_vcpus).

§per_core_pct: Vec<f64>

Per-core utilization indexed by logical CPU number (0.0–100.0 each).

§utime_secs: f64

User+nice mode CPU time consumed across all cores in this interval (seconds). Equivalent to Δ(user+nice ticks) / ticks_per_second. Matches Python resource-tracker’s utime column.

§stime_secs: f64

System mode CPU time consumed across all cores in this interval (seconds). Equivalent to Δ(system ticks) / ticks_per_second. Matches Python resource-tracker’s stime column.

§process_count: u32

Number of processes currently in a runnable state (from /proc/stat procs_running). Matches Python resource-tracker’s processes column.

§process_cores_used: Option<f64>

Fractional cores actively consumed by the tracked process tree (root process + all descendants), derived from /proc/<pid>/stat tick deltas divided by elapsed wall-clock ticks. e.g. 2.0 means the tree is consuming the equivalent of 2 full cores. None when no process PID is being tracked.

§process_child_count: Option<u32>

Number of live descendant processes under the tracked root PID. Does not include the root process itself. None when no process PID is being tracked.

§process_utime_secs: Option<f64>

User-mode CPU seconds consumed by the process tree this interval. Sum of utime tick deltas / ticks_per_second across all tree members. None when no PID is tracked.

§process_stime_secs: Option<f64>

System-mode CPU seconds consumed by the process tree this interval. Sum of stime tick deltas / ticks_per_second across all tree members. None when no PID is tracked.

§process_rss_mib: Option<u64>

Resident set size of the process tree (sum of VmRSS from /proc/pid/status) in MiB, sampled at each interval (not a delta). None when no PID is tracked.

§process_disk_read_bytes: Option<u64>

Disk bytes actually read from storage by the process tree this interval. Delta of /proc/pid/io read_bytes across all tree members. None when no PID is tracked or /proc/pid/io is unreadable.

§process_disk_write_bytes: Option<u64>

Disk bytes actually written to storage by the process tree this interval. Delta of /proc/pid/io write_bytes across all tree members. None when no PID is tracked or /proc/pid/io is unreadable.

§process_gpu_usage: Option<f64>

Fractional GPUs actively consumed by the tracked process tree, expressed as the equivalent number of fully-utilized GPUs (same convention as process_cores_used). e.g. 0.5 means the tree is using half of one GPU. NVIDIA: derived from SM utilization via nvmlDeviceGetProcessUtilization (no accounting mode required), summed across matched PIDs and devices, then divided by 100. AMD: derived from drm-engine-gfx cumulative ns via FdInfoStat delta tracking. None when no GPU is present, NVML/AMD data is unavailable, or no samples returned.

§process_gpu_vram_mib: Option<f64>

Total VRAM consumed by the tracked process tree across all GPUs (MiB). NVIDIA: sum of used_gpu_memory from NVML running-process lists. AMD: sum of drm-memory-vram from /proc/pid/fdinfo for matched devices. None when no PID is tracked or no GPU is present on the host.

§process_gpu_utilized: Option<u32>

Number of GPUs on which at least one process in the tracked tree has allocated VRAM or appears in the running-process list. None when no PID is tracked or no GPU is present on the host.

§process_tree_pids: Vec<i32>

PIDs in the tracked process tree (root + all descendants). Populated by CpuCollector; used by main.rs to query per-process GPU stats. Skipped in JSON/CSV output – internal routing field only.

Trait Implementations§

Source§

impl Clone for CpuMetrics

Source§

fn clone(&self) -> CpuMetrics

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CpuMetrics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CpuMetrics

Source§

fn default() -> CpuMetrics

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for CpuMetrics

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CpuMetrics

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,