Crates.io | riscv_sys_monitor |
lib.rs | riscv_sys_monitor |
version | |
source | src |
created_at | 2024-12-03 19:32:11.332787 |
updated_at | 2024-12-04 19:18:40.439639 |
description | A system monitor for RISC-V SBCs on Linux |
homepage | |
repository | |
max_upload_size | |
id | 1470583 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
riscv_sys_monitor is a lightweight, real-time system monitoring tool for RISC-V single-board computers (SBCs) running Linux. It provides insights into CPU usage, memory consumption, and disk usage with customizable update intervals, making it an essential utility for developers and enthusiasts.
CPU Monitoring: Displays the average CPU usage across all cores. Memory Monitoring: Reports used and total memory in MB. Disk Monitoring: Displays detailed usage for each disk, including a summary of total used, free, and total space. Customizable Update Interval: Allows you to specify how frequently the system statistics are refreshed.
Ensure you have the following installed on your system:
Rust: Install it using rustup. Linux OS: The tool is designed for Linux-based RISC-V platforms.
Steps Clone the repository:
git clone https://github.com/your-username/riscv_sys_monitor.git
cd riscv_sys_monitor
Build the project:
cargo build --release
Run the executable:
./target/release/riscv_sys_monitor
Run riscv_sys_monitor with a user-defined update interval (in seconds):
./riscv_sys_monitor --interval <SECONDS>
Option | Description | Default |
---|---|---|
-i, --interval |
Sets the update interval in seconds | 1 |
To update system statistics every 5 seconds:
./riscv_sys_monitor --interval 5
Starting riscv_sys_monitor...
System Metrics - 2024-12-03 14:12:45
---------------------------
CPU Usage: 15.67%
Memory Usage: 2048 / 4096 MB
Disk Usage:
Disk: /dev/sda1 | Used: 50.00 GB | Free: 450.00 GB | Total: 500.00 GB
Disk: /dev/sda2 | Used: 100.00 GB | Free: 100.00 GB | Total: 200.00 GB
Total Disk Usage: Used: 150.00 GB | Free: 550.00 GB | Total: 700.00 GB
The tool consists of the following core functionalities:
refresh_system: Refreshes all system statistics using the sysinfo crate. format_size: Converts byte sizes into a human-readable format (e.g., KB, MB, GB, TB). print_system_info: Outputs CPU, memory, and disk usage metrics.
Main Program: Reads the update interval from command-line arguments and repeatedly fetches and displays system statistics. Unit Tests: Validates the correctness of CPU, memory, and disk usage calculations.
Run tests using:
cargo test
The tests include:
CPU usage calculations Memory usage retrieval Disk usage retrieval and verification
This project is licensed under the MIT License
Ben Santora - Cape Ann MA