blob: 7ecfec6da7446efa52cdab71e4760c00d549051c [file] [log] [blame]
unixtest57abe5b2016-01-31 10:47:03 +00001# ./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
Joel Fernandes2b348702018-02-27 20:38:42 -080018Following commands show a 2GB file being read into the page cache.
unixtest57abe5b2016-01-31 10:47:03 +000019
Joel Fernandes2b348702018-02-27 20:38:42 -080020Command used to generate activity:
21# dd if=/root/tmpfile of=/dev/null bs=8192
unixtest57abe5b2016-01-31 10:47:03 +000022
Joel Fernandes2b348702018-02-27 20:38:42 -080023Output 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
unixtest57abe5b2016-01-31 10:47:03 +000039
Joel Fernandes2b348702018-02-27 20:38:42 -080040The misses counter reflects a 2GB file being read and almost everything being
41a page cache miss.
unixtest57abe5b2016-01-31 10:47:03 +000042
Joel Fernandes2b348702018-02-27 20:38:42 -080043Below 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))
unixtest57abe5b2016-01-31 10:47:03 +000045
Joel Fernandes2b348702018-02-27 20:38:42 -080046# ./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.