2021-12-09 07:44:27 +00:00
|
|
|
#![warn(missing_docs)]
|
|
|
|
|
|
|
|
//! # peach-stats
|
|
|
|
//!
|
|
|
|
//! System statistics retrieval library; designed for use with the PeachCloud platform.
|
|
|
|
//!
|
|
|
|
//! Currently offers the following statistics and associated data structures:
|
|
|
|
//!
|
|
|
|
//! - CPU: `user`, `system`, `nice`, `idle` (as values or percentages)
|
|
|
|
//! - Disk usage: `filesystem`, `one_k_blocks`, `one_k_blocks_used`,
|
|
|
|
//! `one_k_blocks_free`, `used_percentage`, `mountpoint`
|
|
|
|
//! - Load average: `one`, `five`, `fifteen`
|
|
|
|
//! - Memory: `total`, `free`, `used`
|
|
|
|
//! - Uptime: `seconds`
|
|
|
|
//!
|
|
|
|
//! ## Example Usage
|
|
|
|
//!
|
|
|
|
//! ```rust
|
2021-12-13 05:19:05 +00:00
|
|
|
//! use peach_stats::{stats, StatsError};
|
2021-12-09 07:44:27 +00:00
|
|
|
//!
|
|
|
|
//! fn main() -> Result<(), StatsError> {
|
2021-12-13 05:19:05 +00:00
|
|
|
//! let cpu = stats::cpu_stats()?;
|
|
|
|
//! let cpu_percentages = stats::cpu_stats_percent()?;
|
|
|
|
//! let disks = stats::disk_usage()?;
|
|
|
|
//! let load = stats::load_average()?;
|
|
|
|
//! let mem = stats::mem_stats()?;
|
|
|
|
//! let uptime = stats::uptime()?;
|
2021-12-09 07:44:27 +00:00
|
|
|
//!
|
|
|
|
//! Ok(())
|
|
|
|
//! }
|
|
|
|
//! ```
|
2021-12-09 07:54:53 +00:00
|
|
|
//!
|
|
|
|
//! ## Feature Flags
|
|
|
|
//!
|
|
|
|
//! Feature flags are used to offer `Serialize` and `Deserialize` implementations
|
|
|
|
//! for all `struct` data types provided by this library. These traits are not
|
|
|
|
//! provided by default. A choice of `miniserde` and `serde` is provided.
|
|
|
|
//!
|
|
|
|
//! Define the desired feature in the `Cargo.toml` manifest of your project:
|
|
|
|
//!
|
|
|
|
//! ```toml
|
|
|
|
//! peach-stats = { version = "0.1.0", features = ["miniserde_support"] }
|
|
|
|
//! ```
|
2021-12-09 07:44:27 +00:00
|
|
|
|
|
|
|
pub mod error;
|
2022-01-25 09:36:24 +00:00
|
|
|
pub mod sbot;
|
2021-12-09 07:44:27 +00:00
|
|
|
pub mod stats;
|
|
|
|
|
|
|
|
pub use crate::error::StatsError;
|