1# ./cachestat -h 2USAGE: ./cachestat [-T] [ interval [count] ] 3 4show Linux page cache hit/miss statistics including read and write hit % 5 6optional arguments: 7 -T include timestamp on output 8 9examples: 10 ./cachestat # run with default option of 5 seconds delay 11 ./cachestat -T # run with default option of 5 seconds delay with timestamps 12 ./cachestat 1 # print every second hit/miss stats 13 ./cachestat -T 1 # include timestamps with one second samples 14 ./cachestat 1 5 # run with interval of one second for five iterations 15 ./cachestat -T 1 5 # include timestamps with interval of one second for five iterations 16 17 18Following commands show a 2GB file being read into the page cache. 19 20Command used to generate activity: 21# dd if=/root/tmpfile of=/dev/null bs=8192 22 23Output from cachestat running simultatenously: 24# ./tools/cachestat.py 1 25 TOTAL MISSES HITS DIRTIES BUFFERS_MB CACHED_MB 26 1 0 1 0 8 283 27 0 0 0 0 8 283 28 0 0 0 2 8 283 29 0 0 0 0 8 283 30 10009 9173 836 2 9 369 31 152032 152032 0 0 9 1028 32 157408 157405 3 0 9 1707 33 150432 150432 0 0 9 2331 34 0 0 0 0 9 2331 35 1 1 0 1 9 2331 36 0 0 0 0 9 2331 37 0 0 0 0 9 2331 38 0 0 0 0 9 2331 39 40The misses counter reflects a 2GB file being read and almost everything being 41a page cache miss. 42 43Below shows an example of a new 100MB file added to page cache, by using 44the command: dd if=/dev/zero of=/root/tmpfile2 bs=4k count=$((256*100)) 45 46# ./tools/cachestat.py 1 47 TOTAL MISSES HITS DIRTIES BUFFERS_MB CACHED_MB 48 0 0 0 0 15 2440 49 0 0 0 0 15 2440 50 0 0 0 0 15 2440 51 1758 0 1758 25603 15 2540 52 0 0 0 0 15 2540 53 0 0 0 0 15 2541 54 55~25600 pages are being dirtied (writes) which corresponds to the 100MB file 56added to the page cache. 57