pub struct ResourceMetricsCollection {
pub cpu_usage_history: VecDeque<f64>,
pub memory_usage_history: VecDeque<f64>,
pub disk_io_metrics: DiskIOMetrics,
pub network_metrics: NetworkMetrics,
}Fields§
§cpu_usage_history: VecDeque<f64>§memory_usage_history: VecDeque<f64>§disk_io_metrics: DiskIOMetrics§network_metrics: NetworkMetricsImplementations§
Source§impl ResourceMetricsCollection
impl ResourceMetricsCollection
pub fn new() -> Self
Sourcepub fn record_cpu_utilization(&mut self, fraction: f64)
pub fn record_cpu_utilization(&mut self, fraction: f64)
Record an observed CPU utilization fraction in [0, 1].
Nothing inside this crate can measure process CPU time without an FFI
dependency, so the caller supplies the sample. Before this existed
cpu_usage_history had no writers at all, which made
get_average_cpu_usage return 0.0 forever and let the
performance report present that as a measurement of zero CPU use.
Out-of-range and non-finite samples are ignored rather than recorded, so a bad caller cannot corrupt the average.
Sourcepub fn average_cpu_utilization(&self) -> Option<f64>
pub fn average_cpu_utilization(&self) -> Option<f64>
Mean recorded CPU utilization, or None when nothing has been recorded.
None means “not measured” and is what the report should show; it is not
the same statement as “0% CPU”, which is what the old f64-returning
version claimed.
Sourcepub fn cpu_sample_count(&self) -> usize
pub fn cpu_sample_count(&self) -> usize
Number of CPU samples recorded.
Sourcepub fn record_memory_usage(&mut self, bytes: f64)
pub fn record_memory_usage(&mut self, bytes: f64)
Record an observed memory usage in bytes. Called by
TransformerPerformanceTracker::record_memory_usage.
Sourcepub fn memory_sample_count(&self) -> usize
pub fn memory_sample_count(&self) -> usize
Number of memory samples recorded.
Sourcepub fn average_memory_utilization(&self) -> Option<f64>
pub fn average_memory_utilization(&self) -> Option<f64>
Mean recorded memory usage in bytes, or None when nothing has been
recorded. Fed by TransformerPerformanceTracker::record_memory_usage.
Trait Implementations§
Source§impl Clone for ResourceMetricsCollection
impl Clone for ResourceMetricsCollection
Source§impl Debug for ResourceMetricsCollection
impl Debug for ResourceMetricsCollection
Source§impl Default for ResourceMetricsCollection
impl Default for ResourceMetricsCollection
Source§impl<'de> Deserialize<'de> for ResourceMetricsCollection
impl<'de> Deserialize<'de> for ResourceMetricsCollection
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 ResourceMetricsCollection
impl RefUnwindSafe for ResourceMetricsCollection
impl Send for ResourceMetricsCollection
impl Sync for ResourceMetricsCollection
impl Unpin for ResourceMetricsCollection
impl UnsafeUnpin for ResourceMetricsCollection
impl UnwindSafe for ResourceMetricsCollection
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> 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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.