pid_stats_recorder
Version, currently main branch1 version
- main branchlatestAug 15, 2026
github.com/williamthom-as/pid_stats_recorder
Monitor and record mem/cpu usage for a process
Installation
# Add this to your shard.yml
dependencies:
pid_stats_recorder:
github: williamthom-as/pid_stats_recorder
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.21.0- License
- MIT
- Author
- william
- Target
pid_stats_recorderfrom src/pid_stats_recorder.cr
Dependencies
This version declares no dependencies.
README
pid_stats_recorder
Simple tool to stream the mem, swap and cpu usage of a process with optional export to a csv file. Useful if you want to watermark process usage over time without sitting in htop watching.
Install
You must have installed Crystal 1.21.0, then run shards build. The binary
will be at ./bin/pid_stats_recorder.
Usage
Run pid_stats_recorder --help to see the flags. The only required flag is
--process.
All options:
--process PIDrequired, pid to monitor--frequency SECONDSsampling interval, default 1--export[=FILENAME]write csv (add filename or use default)--helphelpCtrl+Cstop, prints RSS/swap/CPU min/avg/max calcs for monitored window
Examples
./bin/pid_stats_recorder --process 12345./bin/pid_stats_recorder --process 12345 --frequency 5./bin/pid_stats_recorder --process 12345 --export./bin/pid_stats_recorder --process 12345 --export=run1.csv
> ./bin/pid_stats_recorder --process 42986 --frequency 15 -e
2026-08-15T09:38:00.026823Z INFO - Monitoring process 42986 every 15s (Ctrl+C to stop)
2026-08-15T09:38:00.026978Z INFO - Exporting to pid_stats_recorder_42986_20260815_193800.csv
2026-08-15T09:38:00.027133Z INFO - RSS: 177.6 MB Swap: 0.0 MB CPU: -
2026-08-15T09:38:21.270176Z INFO - RSS: 177.8 MB Swap: 0.0 MB CPU: 1.3%
2026-08-15T09:38:36.271016Z INFO - RSS: 215.2 MB Swap: 0.0 MB CPU: 2.5%
2026-08-15T09:38:51.271315Z INFO - RSS: 180.5 MB Swap: 0.0 MB CPU: 4.2%
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Aug 15, 2026
- Crystal
>= 1.21.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/williamthom-as/pid_stats_recorder
Metadata
- Created
- Aug 15, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1