[−][src]Trait systemstat::platform::common::Platform
The Platform trait declares all the functions for getting system information.
Required methods
fn new() -> Self
fn cpu_load(&self) -> Result<DelayedMeasurement<Vec<CPULoad>>>
Returns a delayed vector of CPU load statistics, one object per CPU (core).
You need to wait some time (about a second is good) before unwrapping the
DelayedMeasurement
with .done()
.
fn load_average(&self) -> Result<LoadAverage>
Returns a load average object.
fn memory(&self) -> Result<Memory>
Returns a memory information object.
fn battery_life(&self) -> Result<BatteryLife>
Returns a battery life information object.
fn on_ac_power(&self) -> Result<bool>
Returns whether AC power is plugged in.
fn mounts(&self) -> Result<Vec<Filesystem>>
Returns a vector of filesystem mount information objects.
fn block_device_statistics(&self) -> Result<BTreeMap<String, BlockDeviceStats>>
Returns a map of block device statistics objects
fn networks(&self) -> Result<BTreeMap<String, Network>>
Returns a map of network intefrace information objects.
It's a map because most operating systems return an object per IP address, not per interface, and we're doing deduplication and packing everything into one object per interface. You can use the .values() iterator if you need to iterate over all of them.
fn network_stats(&self, interface: &str) -> Result<NetworkStats>
Returns statistics for a given interface (bytes/packets sent/received)
fn cpu_temp(&self) -> Result<f32>
Returns the current CPU temperature in degrees Celsius.
Depending on the platform, this might be core 0, package, etc.
fn socket_stats(&self) -> Result<SocketStats>
Returns information about the number of sockets in use
Provided methods
fn cpu_load_aggregate(&self) -> Result<DelayedMeasurement<CPULoad>>
Returns a delayed CPU load statistics object, average over all CPUs (cores).
You need to wait some time (about a second is good) before unwrapping the
DelayedMeasurement
with .done()
.
fn uptime(&self) -> Result<Duration>
Returns the system uptime.
fn boot_time(&self) -> Result<DateTime<Utc>>
Returns the system boot time.
fn mount_at<P: AsRef<Path>>(&self, path: P) -> Result<Filesystem>
Returns a filesystem mount information object for the filesystem at a given path.
Implementors
impl Platform for PlatformImpl
[src]
An implementation of Platform
for macOS.
See Platform
for documentation.