| Crates.io | pwrzv |
| lib.rs | pwrzv |
| version | 0.6.2 |
| created_at | 2025-06-16 13:07:11.558508+00 |
| updated_at | 2025-06-25 14:47:51.867856+00 |
| description | A Rolls-Royce–inspired performance reserve meter for Linux and macOS systems |
| homepage | |
| repository | https://github.com/kookyleo/pwrzv |
| max_upload_size | |
| id | 1714258 |
| size | 240,901 |

A Rolls-Royce–inspired performance reserve meter for Linux and macOS systems. Elegant, minimal, and focused on what really matters: how much performance your machine has left to give.
This library is currently in Beta stage and not yet fully mature.
Your feedback is crucial for improving this project!
Inspired by the Power Reserve gauge in Rolls-Royce cars — which shows how much engine power is still available — pwrzv brings the same philosophy to Unix-like systems. Instead of showing raw usage, it estimates how much headroom remains in your system's core resources.
It provides a simple 0–5 score, calculated from multiple real-time metrics:
All inputs are weighted and transformed via sigmoid functions to reflect practical bottlenecks, not just raw numbers.
$ pwrzv
2
$ pwrzv --detailed
=== System Power Reserve Analysis ===
System Metrics:
CPU Usage: 12.34% (iowait: 0.00%)
Memory Available: 78.50%
Swap Usage: 0.00%
Disk I/O Usage: 5.10%
Network I/O Usage: 0.75%
File Descriptor Usage: 3.42%
Component Scores (0-5):
CPU: 5
I/O Wait: 5
Memory: 4
Swap: 5
Disk I/O: 5
Network I/O: 5
File Descriptors: 5
Overall Assessment:
Power Reserve Score: 4 (Good - Ample resources)
Bottlenecks: None
✅ System has ample performance headroom.
git clone https://github.com/kookyleo/pwrzv.git
cd pwrzv
cargo install --path .
cargo install pwrzv
pwrzv supports Linux and macOS systems for now. Other platforms will display an error message.
/proc filesystem for direct system metrics accesssysctl, vm_stat, iostat, etc.) for metrics collection# Basic usage (simplest numeric output)
pwrzv
# Detailed component analysis (default text format)
pwrzv --detailed
# Detailed analysis with JSON output
pwrzv --detailed json
# Detailed analysis with YAML output
pwrzv --detailed yaml
use pwrzv::{get_power_reserve_level_direct, PwrzvError};
#[tokio::main]
async fn main() -> Result<(), PwrzvError> {
let level = get_power_reserve_level_direct().await?;
println!("Power Reserve Level: {}/5", level);
Ok(())
}
use pwrzv::{get_power_reserve_level_with_details_direct, PwrzvError};
#[tokio::main]
async fn main() -> Result<(), PwrzvError> {
let (level, details) = get_power_reserve_level_with_details_direct().await?;
println!("Power Reserve: {:.2}/5.0", level);
println!("Detailed metrics:");
for (metric, value) in details {
println!(" {}: {:.3}", metric, value);
}
Ok(())
}
use pwrzv::{check_platform, get_platform_name, PwrzvError};
fn main() -> Result<(), PwrzvError> {
println!("Running on: {}", get_platform_name());
match check_platform() {
Ok(()) => println!("Platform is supported!"),
Err(e) => eprintln!("Platform not supported: {}", e),
}
Ok(())
}
The scoring system uses sigmoid functions to map resource utilization to a 0-5 scale:
/proc filesystem or system commandspwrzv employs sophisticated mathematical algorithms to convert raw system metrics into meaningful power reserve scores:
The core calculation uses the sigmoid function to transform linear resource utilization into a smooth 0-1 scale:
f(x) = 1 / (1 + e^(-k * (x - x₀)))
Where:
/proc filesystem, macOS: system commands)Each metric uses carefully tuned parameters:
This mathematical approach ensures that pwrzv provides intuitive, actionable scores that reflect real system performance bottlenecks rather than raw utilization percentages.
pwrzv supports customizing sigmoid function parameters for each metric via environment variables to adapt to different system characteristics and use cases.
# CPU usage configuration (default: midpoint=0.60, steepness=8.0)
export PWRZV_MACOS_CPU_USAGE_MIDPOINT=0.60
export PWRZV_MACOS_CPU_USAGE_STEEPNESS=8.0
# CPU load configuration (default: midpoint=1.2, steepness=5.0)
export PWRZV_MACOS_CPU_LOAD_MIDPOINT=1.2
export PWRZV_MACOS_CPU_LOAD_STEEPNESS=5.0
# Memory usage configuration (default: midpoint=0.85, steepness=20.0)
export PWRZV_MACOS_MEMORY_USAGE_MIDPOINT=0.85
export PWRZV_MACOS_MEMORY_USAGE_STEEPNESS=20.0
# Memory compression configuration (default: midpoint=0.60, steepness=15.0)
export PWRZV_MACOS_MEMORY_COMPRESSED_MIDPOINT=0.60
export PWRZV_MACOS_MEMORY_COMPRESSED_STEEPNESS=15.0
# Disk I/O configuration (default: midpoint=0.70, steepness=10.0)
export PWRZV_MACOS_DISK_IO_MIDPOINT=0.70
export PWRZV_MACOS_DISK_IO_STEEPNESS=10.0
# Network bandwidth configuration (default: midpoint=0.80, steepness=6.0)
export PWRZV_MACOS_NETWORK_MIDPOINT=0.80
export PWRZV_MACOS_NETWORK_STEEPNESS=6.0
# Network packet loss configuration (default: midpoint=0.01, steepness=50.0)
export PWRZV_MACOS_NETWORK_DROPPED_MIDPOINT=0.01
export PWRZV_MACOS_NETWORK_DROPPED_STEEPNESS=50.0
# File descriptor configuration (default: midpoint=0.90, steepness=30.0)
export PWRZV_MACOS_FD_MIDPOINT=0.90
export PWRZV_MACOS_FD_STEEPNESS=30.0
# Process count configuration (default: midpoint=0.80, steepness=12.0)
export PWRZV_MACOS_PROCESS_MIDPOINT=0.80
export PWRZV_MACOS_PROCESS_STEEPNESS=12.0
# CPU usage configuration (default: midpoint=0.65, steepness=8.0)
export PWRZV_LINUX_CPU_USAGE_MIDPOINT=0.65
export PWRZV_LINUX_CPU_USAGE_STEEPNESS=8.0
# CPU I/O wait configuration (default: midpoint=0.20, steepness=20.0)
export PWRZV_LINUX_CPU_IOWAIT_MIDPOINT=0.20
export PWRZV_LINUX_CPU_IOWAIT_STEEPNESS=20.0
# CPU load configuration (default: midpoint=1.2, steepness=5.0)
export PWRZV_LINUX_CPU_LOAD_MIDPOINT=1.2
export PWRZV_LINUX_CPU_LOAD_STEEPNESS=5.0
# Memory usage configuration (default: midpoint=0.85, steepness=18.0)
export PWRZV_LINUX_MEMORY_USAGE_MIDPOINT=0.85
export PWRZV_LINUX_MEMORY_USAGE_STEEPNESS=18.0
# Memory pressure configuration (default: midpoint=0.30, steepness=12.0)
export PWRZV_LINUX_MEMORY_PRESSURE_MIDPOINT=0.30
export PWRZV_LINUX_MEMORY_PRESSURE_STEEPNESS=12.0
# Disk I/O configuration (default: midpoint=0.70, steepness=10.0)
export PWRZV_LINUX_DISK_IO_MIDPOINT=0.70
export PWRZV_LINUX_DISK_IO_STEEPNESS=10.0
# Network bandwidth configuration (default: midpoint=0.80, steepness=6.0)
export PWRZV_LINUX_NETWORK_MIDPOINT=0.80
export PWRZV_LINUX_NETWORK_STEEPNESS=6.0
# Network packet loss configuration (default: midpoint=0.01, steepness=50.0)
export PWRZV_LINUX_NETWORK_DROPPED_MIDPOINT=0.01
export PWRZV_LINUX_NETWORK_DROPPED_STEEPNESS=50.0
# File descriptor configuration (default: midpoint=0.90, steepness=25.0)
export PWRZV_LINUX_FD_MIDPOINT=0.90
export PWRZV_LINUX_FD_STEEPNESS=25.0
# Process count configuration (default: midpoint=0.80, steepness=12.0)
export PWRZV_LINUX_PROCESS_MIDPOINT=0.80
export PWRZV_LINUX_PROCESS_STEEPNESS=12.0
# Adjust CPU threshold for high-performance server
export PWRZV_LINUX_CPU_USAGE_MIDPOINT=0.80
export PWRZV_LINUX_CPU_USAGE_STEEPNESS=15.0
# Run pwrzv
pwrzv --detailed
While most system monitors highlight how much is used, pwrzv tells you how much is left. This makes it a useful tool for:
Run the included examples:
# Basic usage example
cargo run --example basic_usage
# Detailed metrics analysis example
cargo run --example detailed_metrics
# Run all tests
cargo test
# Run only unit tests
cargo test --lib
# Run documentation tests
cargo test --doc
# Run examples
cargo run --example basic_usage
Generate and view the full API documentation:
cargo doc --open
cargo testThis project is licensed under the MIT License - see the LICENSE file for details.
/proc metrics