| Crates.io | stop-cli |
| lib.rs | stop-cli |
| version | 0.0.1 |
| created_at | 2025-11-05 01:11:06.99031+00 |
| updated_at | 2025-11-05 07:57:34.07705+00 |
| description | Modern process monitoring with JSON, CSV, and human-readable output |
| homepage | |
| repository | https://github.com/nijaru/stop |
| max_upload_size | |
| id | 1917244 |
| size | 208,202 |
Modern process monitoring with structured output
stop (structured top) is a process and system monitoring tool that outputs JSON, CSV, or human-readable formats. Get system metrics and process information in a format that's easy to parse, script, and automate.
Traditional monitoring tools output formatted text that's hard to parse:
top/htop - Interactive TUI, not script-friendlyps - Text output requires complex parsing (awk/grep/sed)iostat/vmstat - Inconsistent formats across platformsstop provides:
v0.0.1 - Phases 1-4 complete
✅ Filter, sort, limit processes (with AND/OR logic) ✅ JSON/CSV/human-readable output ✅ Advanced metrics: thread count, disk I/O, open file descriptors ✅ 52 tests passing (16 unit + 19 edge case + 17 integration) ✅ Zero clippy warnings ✅ CI/CD pipeline (GitHub Actions on Ubuntu and macOS) ✅ Tested on macOS and Linux (Fedora) ✅ Performance optimized (86% allocation reduction in watch mode)
cargo install stop-cli
Or from source:
git clone https://github.com/nijaru/stop.git
cd stop
cargo install --path .
Verify:
stop --version
# Human-readable output with colors (default)
stop
# JSON output
stop --json
# CSV output
stop --csv
# Filter high CPU processes
stop --filter "cpu > 10"
# Top 10 processes by memory
stop --sort-by mem --top-n 10
# Combined: filter, sort, limit
stop --filter "mem >= 1" --sort-by cpu --top-n 5 --json
# Watch mode (continuous monitoring)
stop --watch # Updates every 2s (default)
stop --watch --interval 1 # Custom interval
stop --watch --json | jq '.system.cpu_usage' # NDJSON stream
Build filter expressions with field op value and combine them with and/or:
Fields:
cpu - CPU percentage (float)mem - Memory percentage (float)pid - Process ID (integer)name - Process name (case-insensitive contains)user - User name/ID (exact match)Operators:
>, >=, <, <= - Numeric comparisons==, != - Equality (works with all fields)and, or - Combine conditions (case-insensitive)Precedence: and has higher precedence than or (standard boolean logic)
Simple Examples:
# High CPU processes
stop --filter "cpu > 50"
# Memory hogs
stop --filter "mem >= 5.0"
# System processes (low PIDs)
stop --filter "pid < 1000"
# Find Chrome processes
stop --filter "name == chrome"
# Processes by specific user
stop --filter "user == root"
Compound Examples:
# High CPU AND high memory
stop --filter "cpu > 50 and mem > 10"
# Chrome OR Firefox processes
stop --filter "name == chrome or name == firefox"
# High resource usage (either CPU or memory)
stop --filter "cpu > 50 or mem > 10"
# System processes with high CPU
stop --filter "pid < 1000 and cpu > 5"
# Case-insensitive keywords (all equivalent)
stop --filter "cpu > 10 AND mem > 5"
stop --filter "cpu > 10 and mem > 5"
stop --filter "cpu > 10 And mem > 5"
# Mixed AND/OR with precedence: (cpu > 50 AND mem > 10) OR name == chrome
stop --filter "cpu > 50 and mem > 10 or name == chrome"
Output Modes:
Filtering:
field op value syntaxand/or logic>, >=, <, <=, ==, !=Sorting:
Limiting:
--top-n flag to show top N processesWatch Mode:
--watch flag--interval (default: 2s)head)Advanced Metrics (Phase 3):
{
"timestamp": "2025-11-05T00:23:56.037549+00:00",
"system": {
"cpu_usage": 6.5,
"memory_total": 137438953472,
"memory_used": 73425764352,
"memory_percent": 53.4
},
"processes": [
{
"pid": 1234,
"name": "chrome",
"cpu_percent": 12.5,
"memory_bytes": 2147483648,
"memory_percent": 1.6,
"user": "501",
"command": "/Applications/Chrome.app/Contents/MacOS/Chrome",
"thread_count": 15,
"disk_read_bytes": 12345678,
"disk_write_bytes": 8765432,
"open_files": 120
}
]
}
Scripting & Automation:
# Kill processes using >50% CPU
stop --filter "cpu > 50" --json | jq -r '.processes[].pid' | xargs kill
# Alert if memory usage >80%
if [ $(stop --json | jq '.system.memory_percent') -gt 80 ]; then
echo "High memory usage!"
fi
# Log metrics for analysis
stop --csv --interval 5 > metrics.csv
Monitoring & Alerting:
Development & Debugging:
# Watch Chrome memory usage in real-time
stop --watch --filter "name == chrome" --sort-by mem
# Find all Electron apps (VS Code, Slack, etc.)
stop --filter "name == electron" --json | jq '.processes[].name'
# Monitor Docker containers
stop --filter "name == docker" --top-n 20
# Find memory leaks (processes with high memory, many open files)
stop --filter "mem > 5" --sort-by mem --json | \
jq '.processes[] | select(.open_files > 100) | {name, memory_percent, open_files}'
# Identify I/O-heavy processes
stop --json | jq '.processes | sort_by(.disk_write_bytes) | reverse | .[:5]'
# Find multi-threaded processes
stop --json | jq '.processes | sort_by(.thread_count) | reverse | .[:10]'
# Quick system overview
stop --top-n 5
# Export system state for analysis
stop --json > system-snapshot-$(date +%Y%m%d-%H%M%S).json
# Monitor system during load test
stop --watch --interval 1 --json | tee load-test-metrics.jsonl
# Check if specific service is running
stop --filter "name == nginx" --json | jq -e '.processes | length > 0' && \
echo "nginx is running" || echo "nginx is NOT running"
# Find processes causing high CPU during investigation
stop --watch --filter "cpu > 10" --interval 0.5
# Compare disk I/O before and after optimization
stop --filter "name == myapp" --json | jq '.processes[].disk_write_bytes'
# Monitor resource usage with CSV for spreadsheet analysis
stop --watch --csv --interval 5 > metrics.csv
# Analyze in Excel/Google Sheets later
# Alert on resource spikes (monitoring script)
while true; do
CPU=$(stop --json | jq '.system.cpu_usage')
if (( $(echo "$CPU > 90" | bc -l) )); then
echo "ALERT: CPU at ${CPU}%" | mail -s "High CPU" admin@example.com
fi
sleep 60
done
# Log top 10 processes every hour (cron job)
0 * * * * /usr/local/bin/stop --top-n 10 --json >> /var/log/process-metrics.jsonl
# Kill runaway processes automatically
stop --filter "cpu > 80 and name == myapp" --json | \
jq -r '.processes[].pid' | \
xargs -I {} sh -c 'echo "Killing PID {}"; kill {}'
| Feature | top/htop | ps | stop |
|---|---|---|---|
| JSON output | ❌ | ❌ | ✅ |
| CSV output | ❌ | ❌ | ✅ |
| Filtering | Limited | Complex | Simple syntax |
| Cross-platform | ⚠️ Varies | ⚠️ Varies | ✅ Consistent |
| Structured data | ❌ TUI | ❌ Text parsing | ✅ JSON/CSV |
| Watch mode | ✅ | ❌ | ✅ |
| One-shot | ❌ | ✅ | ✅ |
# Run tests (52 tests: 16 unit + 19 edge case + 17 integration)
cargo test
# Check code quality
cargo clippy
cargo fmt
# Build release
cargo build --release
# Install locally
cargo install --path .
Architecture:
Testing:
null for privileged processes and kernel threads (expected behavior)See ai/PLAN.md for detailed roadmap.
Completed (v0.0.1):
Next up:
Early stage project. Not yet accepting contributions - focusing on core implementation first.
MIT
Inspired by: