Skip to main content

SystemResourceTracker

Struct SystemResourceTracker 

Source
pub struct SystemResourceTracker { /* private fields */ }
Expand description

System resource tracker backed by an injectable TelemetrySource (F12).

It previously returned hard-coded readings (32 GB memory / 16 GB used, 60% CPU, 4 GPUs at 80%, 1 TB disk, 1 GB/s network, 65 C, 250 W) from seven get_*_info helpers, each commented “in a real implementation, this would query system APIs”. Those numbers reached ResourceTracker::check_limits and were compared against the caller’s real constraints, so a tight memory budget aborted the search on invented data.

Now it reports whatever its source can actually measure and None for the rest, and check_limits skips any check whose measurement is missing.

Implementations§

Source§

impl SystemResourceTracker

Source

pub fn new(name: String, monitoring_interval: Duration) -> Self

Create a tracker using the default (honest, sparse) telemetry source.

Source

pub fn with_telemetry( name: String, monitoring_interval: Duration, telemetry: Box<dyn TelemetrySource>, ) -> Self

Create a tracker backed by a caller-supplied telemetry source. This is how GPU / thermal / power constraints become enforceable: provide a source that can measure them.

Source

pub fn telemetry_name(&self) -> &str

Name of the telemetry source in use.

Source

pub fn last_sample(&self) -> Option<&TelemetrySample>

The most recent reading, if one has been taken.

Source

pub fn sample(&self) -> TelemetrySample

Take a fresh reading.

Source

pub fn memory_pressure(&self) -> Option<MemoryPressure>

Memory pressure derived from the current reading, or None when memory is not measurable here.

Trait Implementations§

Source§

impl Debug for SystemResourceTracker

Source§

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

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

impl<T> ResourceTracker<T> for SystemResourceTracker
where T: From<f64> + Debug + Float + Debug + Send + Sync + 'static,

Source§

fn get_current_usage(&self) -> Result<ResourceUsage<T>>

Resource usage attributable to this search.

Only the process’s own resident set size is reported, and only where it can be measured; everything else stays at the accumulator identity (0), which is honest for a usage total that nothing has been attributed to. The previous version reported system-wide invented figures here, which is a category error as well as a fabrication: ResourceUsage is compared against a budget for the search, so charging it for the whole machine aborts the search whenever the host is busy.

Source§

fn check_limits( &self, constraints: &ResourceConstraints<T>, ) -> Result<Vec<ResourceViolation<T>>>

Report only violations backed by an actual measurement (F12).

Every check is guarded by the presence of its measurement, so an unmeasurable resource is treated as unlimited and can never abort a search. This is the whole point: check_violations is called from NeuralArchitectureSearch::should_stop_search on every iteration, so a fabricated reading here terminated real searches.

Source§

fn get_system_metrics(&self) -> Result<SystemMetrics<T>>

Get system metrics
Source§

fn name(&self) -> &str

Get tracker name
Source§

fn initialize(&mut self) -> Result<()>

Initialize tracker
Source§

fn cleanup(&mut self) -> Result<()>

Cleanup tracker
Source§

fn telemetry_sample(&self) -> Option<TelemetrySample>

The raw telemetry reading behind ResourceTracker::get_system_metrics, if this tracker has one. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V