Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
🦀 darwin-metrics
A Rust library providing native access to macOS system metrics through low-level system APIs. This crate offers efficient, safe, and async-capable interfaces for monitoring system resources on macOS.
🌟 Features
🖥️ System Monitoring
-
CPU Monitoring
- Per-core usage statistics
- CPU model and frequency information
- System load metrics (user, system, idle)
-
Memory Analysis
- RAM usage and availability
- Swap space monitoring
- Memory pressure levels
-
GPU Information
- Active GPU model detection
- GPU utilization metrics
- VRAM consumption tracking
📊 Resource Tracking
-
Storage Metrics
- Disk space utilization
- I/O performance monitoring
- Read/write speed tracking
-
Power Management
- Battery status and health
- Charging state detection
- Remaining battery time estimation
-
Thermal Monitoring
- Fan speed readings
- CPU and GPU temperature tracking
- System-wide thermal status
🔌 Additional Features
-
Process Information
- Running process enumeration
- Per-process resource usage
- Parent-child process relationship tracking
- Process tree visualization
-
Network Monitoring
- Interface discovery and state tracking
- Traffic statistics (bytes/packets sent/received)
- Bandwidth calculations
- Async network monitoring
📦 Installation
Add this to your Cargo.toml
:
[]
= "0.1.5"
🔧 Requirements
- macOS 10.11 (El Capitan) or later
- Rust 1.85 or later
- Xcode Command Line Tools
🚀 Quick Start
use ;
async
🎯 Feature Flags
All features are enabled by default, but you can selectively enable only what you need:
Flag | Description |
---|---|
battery |
Enable battery monitoring |
cpu |
Enable CPU metrics |
memory |
Enable memory statistics |
gpu |
Enable GPU monitoring |
disk |
Enable storage metrics |
temperature |
Enable thermal monitoring |
async |
Enable async support (requires tokio) |
process_monitoring |
Enable detailed process monitoring |
unstable-tests |
Enable tests that may be unstable in CI |
📈 Development Status
Currently in active development. See our roadmap for detailed development plans.
Development Progress
✅ Completed (v0.1.0)
- Initial project setup
- Core architecture and error handling
- CPU monitoring module with frequency data
- Memory monitoring with pressure levels
- GPU information and metrics
- Network interface discovery and traffic stats
- Disk space monitoring
- Process monitoring and hierarchy tracking
- Temperature sensors and fan speed tracking
🚧 In Progress (v0.2.0)
- Enhanced async support throughout
- Cross-platform abstractions (Linux/Windows)
- Metrics export to Prometheus/InfluxDB
- Performance optimizations
- Event-based monitoring
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development Setup
Setup Instructions:
-
Clone the repository:
-
Install dependencies:
-
Set up the Rust toolchains:
Our workflow uses:
- Beta toolchain for linting and formatting
- Stable toolchain for building, testing, and releases
-
Build the project:
-
Run tests:
-
Format and lint your code:
📝 How to Cite
If you use darwin-metrics in your projects, please include one of the following attributions:
Citation Formats
💻 For Software Projects
This project uses darwin-metrics (https://github.com/sm-moshi/darwin-metrics) by Stuart Meya.
📚 For Documentation or Technical Writing
darwin-metrics: A Rust library for native macOS system metrics, developed by Stuart Meya.
GitHub repository: https://github.com/sm-moshi/darwin-metrics
🎓 For Academic or Research Use
Meya, S. (2025). darwin-metrics: A Rust library for native macOS system metrics.
GitHub repository: https://github.com/sm-moshi/darwin-metrics
For more detailed attribution requirements, please see the NOTICE file.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Apple's IOKit, Foundation, Core Foundation, and Metal documentation
- objc2 crate by Mads Marquart
- The Rust and Swift communities
- Contributors to the core dependencies