1 1.1 christos The following is a demonstration of the diskhits command. 2 1.1 christos 3 1.1 christos 4 1.1 christos Here we run diskhits on a large file, /extra1/contents with is 46 Mb, and 5 1.1 christos currently hasn't been accessed (so isn't in any cache). 6 1.1 christos 7 1.1 christos While diskhits is running, the file is grep'd in another window. This causes 8 1.1 christos the entire file to be read, 9 1.1 christos 10 1.1 christos # ./diskhits /extra1/contents 11 1.1 christos Tracing... Hit Ctrl-C to end. 12 1.1 christos ^C 13 1.1 christos Location (KB), 14 1.1 christos 15 1.1 christos value ------------- Distribution ------------- count 16 1.1 christos < 0 | 0 17 1.1 christos 0 |@@ 47 18 1.1 christos 2303 |@@ 41 19 1.1 christos 4606 |@@ 41 20 1.1 christos 6909 |@@ 42 21 1.1 christos 9212 |@@ 41 22 1.1 christos 11515 |@@ 41 23 1.1 christos 13818 |@@ 42 24 1.1 christos 16121 |@@ 43 25 1.1 christos 18424 |@@ 42 26 1.1 christos 20727 |@@ 41 27 1.1 christos 23030 |@@ 41 28 1.1 christos 25333 |@@ 41 29 1.1 christos 27636 |@@ 41 30 1.1 christos 29939 |@@ 42 31 1.1 christos 32242 |@@ 44 32 1.1 christos 34545 |@@ 41 33 1.1 christos 36848 |@@ 41 34 1.1 christos 39151 |@@ 41 35 1.1 christos 41454 |@@ 41 36 1.1 christos 43757 |@@ 40 37 1.1 christos >= 46060 | 0 38 1.1 christos 39 1.1 christos Size (KB), 40 1.1 christos 41 1.1 christos value ------------- Distribution ------------- count 42 1.1 christos 4 | 0 43 1.1 christos 8 | 6 44 1.1 christos 16 | 10 45 1.1 christos 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 818 46 1.1 christos 64 | 0 47 1.1 christos 48 1.1 christos Total RW: 46064 KB 49 1.1 christos 50 1.1 christos Ok, so the file was read evently with each access around 32 to 63 Kb in size, 51 1.1 christos and a total of 46 Mb read. This all makes sense, as it is reading the file 52 1.1 christos for the first time. 53 1.1 christos 54 1.1 christos 55 1.1 christos 56 1.1 christos Now the same file is grep'd with diskhits running, this time we can see what 57 1.1 christos effect caching the file has made, 58 1.1 christos 59 1.1 christos # ./diskhits /extra1/contents 60 1.1 christos Tracing... Hit Ctrl-C to end. 61 1.1 christos ^C 62 1.1 christos Location (KB), 63 1.1 christos 64 1.1 christos value ------------- Distribution ------------- count 65 1.1 christos 2303 | 0 66 1.1 christos 4606 | 5 67 1.1 christos 6909 |@ 67 68 1.1 christos 9212 |@@@@ 170 69 1.1 christos 11515 |@@@@@ 216 70 1.1 christos 13818 |@@@@@ 224 71 1.1 christos 16121 |@@@@@@ 287 72 1.1 christos 18424 |@@@@@ 227 73 1.1 christos 20727 |@@@ 144 74 1.1 christos 23030 |@@ 75 75 1.1 christos 25333 |@ 59 76 1.1 christos 27636 |@ 42 77 1.1 christos 29939 |@ 41 78 1.1 christos 32242 |@ 44 79 1.1 christos 34545 |@ 41 80 1.1 christos 36848 |@ 41 81 1.1 christos 39151 |@ 41 82 1.1 christos 41454 |@ 41 83 1.1 christos 43757 |@ 39 84 1.1 christos >= 46060 | 0 85 1.1 christos 86 1.1 christos Size (KB), 87 1.1 christos 88 1.1 christos value ------------- Distribution ------------- count 89 1.1 christos 2 | 0 90 1.1 christos 4 |@@@@@@@@@@@@@@@@@@@@@@@@@ 1137 91 1.1 christos 8 |@@@@@ 211 92 1.1 christos 16 |@@ 111 93 1.1 christos 32 |@@@@@@@@ 345 94 1.1 christos 64 | 0 95 1.1 christos 96 1.1 christos Total RW: 29392 KB 97 1.1 christos 98 1.1 christos The difference is dramatic. This time only 29 Mb is read, leaving around 99 1.1 christos 17 Mb that was read from the cache. The way the file is read differs - 100 1.1 christos in the later half of the file it looks the same, but in the first half there 101 1.1 christos are many more events; oddly enough, this is because the early part of the 102 1.1 christos file is cached more, the extra events are likely to be much smaller in size - 103 1.1 christos as indicated in the difference in the size distribution. 104 1.1 christos 105 1.1 christos It appears that everything less that 4606 Kb has remained in the cache, with 106 1.1 christos zero hits for that range. 107 1.1 christos 108