pub struct SystemState {
pub cpu: Option<CpuState>,
pub memory: Option<MemoryState>,
pub gpus: Vec<GpuState>,
pub unreadable_gpus: Vec<UnreadableGpu>,
pub absent_gpus: Vec<AbsentGpu>,
pub timestamp: u64,
}Expand description
Condensed system state for agent context
Fields§
§cpu: Option<CpuState>CPU information
memory: Option<MemoryState>Memory information
gpus: Vec<GpuState>GPU information (only for queried GPUs)
unreadable_gpus: Vec<UnreadableGpu>Queried GPUs that were enumerated but whose query failed.
One failing adapter used to fail the whole state, so the model could answer nothing – not about memory, not about the adapter that read fine. Now the others are reported and this one is named, with the error, so the model can say which device it cannot see and why.
absent_gpus: Vec<AbsentGpu>GPU indices the query asked for that this system does not have.
These were dropped silently, so the model answered as if the request had been read. They are named here, with the count the system does have.
timestamp: u64Timestamp of state capture
Implementations§
Source§impl SystemState
impl SystemState
Sourcepub fn from_monitor(monitor: &UnifiedMonitor, query: &Query) -> Result<Self>
pub fn from_monitor(monitor: &UnifiedMonitor, query: &Query) -> Result<Self>
Extract system state from monitor based on query
Sourcepub fn to_context_string(&self) -> String
pub fn to_context_string(&self) -> String
Format state as natural language text for agent context
Sourcepub fn total_power_w(&self) -> Option<f32>
pub fn total_power_w(&self) -> Option<f32>
Total power draw across every GPU that reports it.
None when no GPU exposes a power sensor — a sum of nothing is not 0 W, and
reporting it as such told the model the machine was drawing no power. Devices
without a sensor are excluded from the sum, so the result is a lower bound
when the system mixes reporting and non-reporting GPUs.
Sourcepub fn avg_utilization(&self) -> Option<f32>
pub fn avg_utilization(&self) -> Option<f32>
Average utilization across the GPUs that report one, or None when
none does.
Averaged over the reporting devices rather than over all of them: a device with no counter used to contribute a zero and drag the mean down, which reads as spare capacity that may not exist.
Sourcepub fn avg_temperature(&self) -> Option<f32>
pub fn avg_temperature(&self) -> Option<f32>
Average temperature across GPUs that report one.
Returns None when no device has a readable sensor. Devices without one are
excluded rather than counted as zero — previously a machine reading 50°C,
36°C and “unknown” averaged to 28.7°C, which is colder than any card present.
Sourcepub fn hottest_gpu(&self) -> Option<&GpuState>
pub fn hottest_gpu(&self) -> Option<&GpuState>
Hottest GPU among those reporting a temperature.
Devices without a sensor are excluded, so an unreadable card is never named the hottest merely because its unknown reading sorted as zero.
Sourcepub fn most_utilized_gpu(&self) -> Option<&GpuState>
pub fn most_utilized_gpu(&self) -> Option<&GpuState>
Get most utilized GPU
Trait Implementations§
Source§impl Clone for SystemState
impl Clone for SystemState
Source§impl Debug for SystemState
impl Debug for SystemState
Source§impl<'de> Deserialize<'de> for SystemState
impl<'de> Deserialize<'de> for SystemState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for SystemState
impl RefUnwindSafe for SystemState
impl Send for SystemState
impl Sync for SystemState
impl Unpin for SystemState
impl UnsafeUnpin for SystemState
impl UnwindSafe for SystemState
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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