add sleep loop option
tobert opened this issue · comments
Add a -interval / -n option to make pcstat display results every N seconds (or fractions of a second). Do not bother with \r or other terminal interactions to keep it simple. Just print a new dataset on every iteration. Should work with all output modes.
e.g.
pcstat -interval 1 -json > pcstats.json
pcstat -n 1
pcstat -terse -n 1
Ideally a hook can be added inside the getMincore() function to accept a function that it will call in a loop to avoid the open/mmap on every iteration. This is fairly complicated when multiple files are in play, so I need to think about how to do it some more.