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
impl SystemResourceTracker
Sourcepub fn new(name: String, monitoring_interval: Duration) -> Self
pub fn new(name: String, monitoring_interval: Duration) -> Self
Create a tracker using the default (honest, sparse) telemetry source.
Sourcepub fn with_telemetry(
name: String,
monitoring_interval: Duration,
telemetry: Box<dyn TelemetrySource>,
) -> Self
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.
Sourcepub fn telemetry_name(&self) -> &str
pub fn telemetry_name(&self) -> &str
Name of the telemetry source in use.
Sourcepub fn last_sample(&self) -> Option<&TelemetrySample>
pub fn last_sample(&self) -> Option<&TelemetrySample>
The most recent reading, if one has been taken.
Sourcepub fn sample(&self) -> TelemetrySample
pub fn sample(&self) -> TelemetrySample
Take a fresh reading.
Sourcepub fn memory_pressure(&self) -> Option<MemoryPressure>
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
impl Debug for SystemResourceTracker
Source§impl<T> ResourceTracker<T> for SystemResourceTracker
impl<T> ResourceTracker<T> for SystemResourceTracker
Source§fn get_current_usage(&self) -> Result<ResourceUsage<T>>
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>>>
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>>
fn get_system_metrics(&self) -> Result<SystemMetrics<T>>
Source§fn initialize(&mut self) -> Result<()>
fn initialize(&mut self) -> Result<()>
Source§fn telemetry_sample(&self) -> Option<TelemetrySample>
fn telemetry_sample(&self) -> Option<TelemetrySample>
ResourceTracker::get_system_metrics, if
this tracker has one. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SystemResourceTracker
impl !UnwindSafe for SystemResourceTracker
impl Freeze for SystemResourceTracker
impl Send for SystemResourceTracker
impl Sync for SystemResourceTracker
impl Unpin for SystemResourceTracker
impl UnsafeUnpin for SystemResourceTracker
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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