tobert / pcstat

Page Cache stat: get page cache stats for files on Linux
Apache License 2.0
1.23k stars 153 forks source link

add sleep loop option #4

Open tobert opened 10 years ago

tobert commented 10 years ago

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.