pub struct Environment { /* private fields */ }
Expand description
An environment for fetching system utilisation
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn load_average(&self) -> [f64; 3]
pub fn load_average(&self) -> [f64; 3]
Returns the system load average value. This function returns three numbers, representing the last 1 minute, 5 minute, and 15 minute periods.
Sourcepub fn physical_cores(&self) -> usize
pub fn physical_cores(&self) -> usize
Fetches the estimate of the available parallelism of the hardware on which the database is running. This number often corresponds to the amount of CPUs, but it may diverge in various cases.
Sourcepub fn available_parallelism(&self) -> usize
pub fn available_parallelism(&self) -> usize
Fetches the estimate of the available parallelism of the hardware on which the database is running. This number often corresponds to the amount of CPUs, but it may diverge in various cases.
Sourcepub fn cpu_usage(&self) -> f32
pub fn cpu_usage(&self) -> f32
Returns the total CPU usage of the system as a percentage. This may be greater than 100% if running on a mult-core machine.
Sourcepub fn memory_usage(&self) -> u64
pub fn memory_usage(&self) -> u64
Returns the total memory usage (in bytes) of the system. This is the size of the memory allocated, not including swap.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Environment
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnwindSafe for Environment
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> 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