1N/AThe following is a demonstration of the diskhits command.
1N/Acurrently hasn't been accessed (so isn't in any cache).
1N/AWhile diskhits is running, the file is grep'd in another window. This causes
1N/Athe entire file to be read,
1N/A Tracing... Hit Ctrl-C to end.
1N/A value ------------- Distribution ------------- count
1N/A value ------------- Distribution ------------- count
1N/A 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 818
1N/AOk, so the file was read evently with each access around 32 to 63 Kb in size,
1N/Aand a total of 46 Mb read. This all makes sense, as it is reading the file
1N/ANow the same file is grep'd with diskhits running, this time we can see what
1N/Aeffect caching the file has made,
1N/A Tracing... Hit Ctrl-C to end.
1N/A value ------------- Distribution ------------- count
1N/A value ------------- Distribution ------------- count
1N/A 4 |@@@@@@@@@@@@@@@@@@@@@@@@@ 1137
1N/AThe difference is dramatic. This time only 29 Mb is read, leaving around
1N/A17 Mb that was read from the cache. The way the file is read differs -
1N/Ain the later half of the file it looks the same, but in the first half there
1N/Aare many more events; oddly enough, this is because the early part of the
1N/Afile is cached more, the extra events are likely to be much smaller in size -
1N/Aas indicated in the difference in the size distribution.
1N/AIt appears that everything less that 4606 Kb has remained in the cache, with
1N/Azero hits for that range.