prock
Fast, low-overhead CPU statistics for process trees.
Uses direct syscalls for minimal overhead (~1-5µs per process):
- macOS:
proc_pid_rusagevia libproc - Linux:
/proc/[pid]/statfilesystem reads
Features
- CPU time (user + system) in nanoseconds
- Memory usage (RSS and virtual)
- Disk I/O statistics
- Process tree discovery (parent/child relationships)
- Tree-wide aggregation (sum stats across process + all descendants)
Usage
use ;
// Get CPU time for a single process
if let Some = get_cpu_time
// Get memory for a single process
if let Some = get_memory
// Get all stats at once (more efficient for multiple metrics)
if let Some = get_all_stats
Platform Support
| Platform | Status |
|---|---|
| macOS | Full support via libproc |
| Linux | Full support via /proc |
| Other | Fallback (returns None) |