Skip to main content

SystemSnapshot

Struct SystemSnapshot 

Source
pub struct SystemSnapshot {
Show 16 fields pub sequence: u64, pub captured_at: Instant, pub wall_time: SystemTime, pub elapsed: Duration, pub host: HostSnapshot, pub cpu: CpuSnapshot, pub memory: MemorySnapshot, pub load: MetricState<LoadSnapshot>, pub processes: Vec<ProcessSnapshot>, pub disks: Vec<DiskSnapshot>, pub filesystems: Vec<FilesystemSnapshot>, pub networks: Vec<NetworkSnapshot>, pub pressure: PressureSnapshot, pub sensors: SensorSnapshot, pub capabilities: CapabilitySnapshot, pub health: CollectorHealth,
}
Expand description

One complete, internally consistent observation of the system.

Fields§

§sequence: u64

Monotonically increasing sequence number.

Used to detect coalescing and to order snapshots without consulting the wall clock, which can move backwards (§8.1).

§captured_at: Instant

Monotonic capture time, for rate calculations and ordering (§8.1).

Deliberately an Instant, which is why this type is not Serialize: export goes through a dedicated DTO that emits wall_time instead.

§wall_time: SystemTime

Wall-clock capture time, for display and export only.

§elapsed: Duration

The actual interval since the previous snapshot.

§8.1 forbids assuming one second. Zero on the first snapshot.

§host: HostSnapshot

System identity.

§cpu: CpuSnapshot

CPU state.

§memory: MemorySnapshot

Memory state.

§load: MetricState<LoadSnapshot>

Load averages.

§processes: Vec<ProcessSnapshot>

Every process visible to us.

§disks: Vec<DiskSnapshot>

Block devices.

§filesystems: Vec<FilesystemSnapshot>

Mounted filesystems. Separate from disks by §7.3.

§networks: Vec<NetworkSnapshot>

Network interfaces.

§pressure: PressureSnapshot

Pressure Radar.

§sensors: SensorSnapshot

Temperature and battery.

§capabilities: CapabilitySnapshot

What this platform can and cannot report.

§health: CollectorHealth

Collector timing and our own overhead.

Implementations§

Source§

impl SystemSnapshot

Source

pub fn warming_up( captured_at: Instant, wall_time: SystemTime, logical_cpus: u16, ) -> Self

The first snapshot: identity is known, every measurement is warming up.

§26: the first sample of delta-based data is not zero. This constructor is what makes that the default rather than something each collector must remember.

Source

pub fn process(&self, identity: ProcessIdentity) -> Option<&ProcessSnapshot>

Looks up a process by stable identity.

Keyed on the full identity rather than the PID, so a reused PID returns None instead of a different process (§26).

Source

pub fn process_by_pid(&self, pid: u32) -> Option<&ProcessSnapshot>

Looks up whatever process currently holds pid, whichever it is.

Only the signal-revalidation path should use this: it needs to discover that a PID has been reused, which requires deliberately ignoring the start key (§6.2).

Source

pub fn process_count(&self) -> usize

Total process count, for the 218 total header in §5.5.

Source

pub fn total_process_cpu(&self) -> Option<Percent>

The sum of all per-process CPU percentages, core-normalized.

Used as the denominator of the attribution coverage figure in §2.2. This is deliberately not compared against system CPU as though the two were interchangeable: they are measured differently, and the coverage figure is presented as evidence rather than proof.

Source

pub fn notable_process_count(&self) -> usize

How many processes are in a state §7.2 requires to stand out.

Source

pub fn has_valid_interval(&self) -> bool

Whether this snapshot can produce valid rates.

False for the first snapshot, whose elapsed is zero.

Trait Implementations§

Source§

impl Clone for SystemSnapshot

Source§

fn clone(&self) -> SystemSnapshot

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SystemSnapshot

Source§

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

Formats the value using the given formatter. 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> 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.