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