denet: a streaming process monitor
Denet is a streaming process monitoring tool that provides detailed metrics on running processes, including CPU, memory, I/O, and thread usage. Built with a Rust core and Python bindings, it follows a Rust-first development approach while providing convenient Python access.
Features
- Lightweight, cross-platform process monitoring
- Adaptive sampling intervals that automatically adjust based on runtime
- Memory usage tracking (RSS, VMS)
- CPU usage monitoring
- I/O bytes read/written tracking
- Thread count monitoring
- Recursive child process tracking
- Command-line interface with colorized output
- JSON output option for data processing
Requirements
- Python 3.6+
- Rust (for development only)
- pixi (for development only)
Installation
Usage
Command-Line Interface
# Basic monitoring with colored output
# Output as JSON
# Write output to a file
# Custom sampling interval (in milliseconds)
# Specify max sampling interval for adaptive mode
# Monitor existing process by PID
# Monitor just for 10 seconds
Python API
# Create a monitor for a process
=
# Option 1: Run the monitor until the process completes
# This will print JSON metrics to stdout
# Option 2: Sample on demand
# Get metrics as JSON string
=
=
Development
Denet follows a Rust-first development approach, with Python bindings as a secondary interface.
Setting Up the Development Environment
- Clone the repository
- Install pixi if you don't have it already: Pixi Installation Guide
- Set up the development environment:
Development Workflow
- Make changes to Rust code in
src/ - Test with Cargo:
pixi run test-rust - Build and install Python bindings:
pixi run develop - Test Python bindings:
pixi run test
Running Tests
# Run Rust tests only (primary development testing)
# Run Python tests only (after building with "develop")
# Run all tests together
Helper Scripts
The project includes scripts to help with development:
# Build and install the extension in the current Python environment
# Run tests in CI environment
Project Structure
denet/
├── src/ # Rust source code (primary development focus)
│ ├── lib.rs # Python binding interface
│ ├── bin/ # CLI executables
│ │ └── denet.rs # Command-line interface implementation
│ └── process_monitor.rs # Core implementation with Rust tests
├── tests/ # Python binding tests
│ └── cli/ # Command-line interface tests
├── ci/ # Continuous Integration scripts
├── scripts/ # Helper scripts for development
├── Cargo.toml # Rust dependencies and configuration
└── pyproject.toml # Python build configuration
License
GPL-3