kmemleak: disable kasan instrumentation for kmemleak
[linux-2.6/btrfs-unstable.git] / Documentation / device-mapper / statistics.txt
blob2a1673adc2004beae034f0ee5d5ae3ef3bceccf8
1 DM statistics
2 =============
4 Device Mapper supports the collection of I/O statistics on user-defined
5 regions of a DM device.  If no regions are defined no statistics are
6 collected so there isn't any performance impact.  Only bio-based DM
7 devices are currently supported.
9 Each user-defined region specifies a starting sector, length and step.
10 Individual statistics will be collected for each step-sized area within
11 the range specified.
13 The I/O statistics counters for each step-sized area of a region are
14 in the same format as /sys/block/*/stat or /proc/diskstats (see:
15 Documentation/iostats.txt).  But two extra counters (12 and 13) are
16 provided: total time spent reading and writing in milliseconds.  All
17 these counters may be accessed by sending the @stats_print message to
18 the appropriate DM device via dmsetup.
20 Each region has a corresponding unique identifier, which we call a
21 region_id, that is assigned when the region is created.  The region_id
22 must be supplied when querying statistics about the region, deleting the
23 region, etc.  Unique region_ids enable multiple userspace programs to
24 request and process statistics for the same DM device without stepping
25 on each other's data.
27 The creation of DM statistics will allocate memory via kmalloc or
28 fallback to using vmalloc space.  At most, 1/4 of the overall system
29 memory may be allocated by DM statistics.  The admin can see how much
30 memory is used by reading
31 /sys/module/dm_mod/parameters/stats_current_allocated_bytes
33 Messages
34 ========
36     @stats_create <range> <step> [<program_id> [<aux_data>]]
38         Create a new region and return the region_id.
40         <range>
41           "-" - whole device
42           "<start_sector>+<length>" - a range of <length> 512-byte sectors
43                                       starting with <start_sector>.
45         <step>
46           "<area_size>" - the range is subdivided into areas each containing
47                           <area_size> sectors.
48           "/<number_of_areas>" - the range is subdivided into the specified
49                                  number of areas.
51         <program_id>
52           An optional parameter.  A name that uniquely identifies
53           the userspace owner of the range.  This groups ranges together
54           so that userspace programs can identify the ranges they
55           created and ignore those created by others.
56           The kernel returns this string back in the output of
57           @stats_list message, but it doesn't use it for anything else.
59         <aux_data>
60           An optional parameter.  A word that provides auxiliary data
61           that is useful to the client program that created the range.
62           The kernel returns this string back in the output of
63           @stats_list message, but it doesn't use this value for anything.
65     @stats_delete <region_id>
67         Delete the region with the specified id.
69         <region_id>
70           region_id returned from @stats_create
72     @stats_clear <region_id>
74         Clear all the counters except the in-flight i/o counters.
76         <region_id>
77           region_id returned from @stats_create
79     @stats_list [<program_id>]
81         List all regions registered with @stats_create.
83         <program_id>
84           An optional parameter.
85           If this parameter is specified, only matching regions
86           are returned.
87           If it is not specified, all regions are returned.
89         Output format:
90           <region_id>: <start_sector>+<length> <step> <program_id> <aux_data>
92     @stats_print <region_id> [<starting_line> <number_of_lines>]
94         Print counters for each step-sized area of a region.
96         <region_id>
97           region_id returned from @stats_create
99         <starting_line>
100           The index of the starting line in the output.
101           If omitted, all lines are returned.
103         <number_of_lines>
104           The number of lines to include in the output.
105           If omitted, all lines are returned.
107         Output format for each step-sized area of a region:
109           <start_sector>+<length> counters
111           The first 11 counters have the same meaning as
112           /sys/block/*/stat or /proc/diskstats.
114           Please refer to Documentation/iostats.txt for details.
116           1. the number of reads completed
117           2. the number of reads merged
118           3. the number of sectors read
119           4. the number of milliseconds spent reading
120           5. the number of writes completed
121           6. the number of writes merged
122           7. the number of sectors written
123           8. the number of milliseconds spent writing
124           9. the number of I/Os currently in progress
125           10. the number of milliseconds spent doing I/Os
126           11. the weighted number of milliseconds spent doing I/Os
128           Additional counters:
129           12. the total time spent reading in milliseconds
130           13. the total time spent writing in milliseconds
132     @stats_print_clear <region_id> [<starting_line> <number_of_lines>]
134         Atomically print and then clear all the counters except the
135         in-flight i/o counters.  Useful when the client consuming the
136         statistics does not want to lose any statistics (those updated
137         between printing and clearing).
139         <region_id>
140           region_id returned from @stats_create
142         <starting_line>
143           The index of the starting line in the output.
144           If omitted, all lines are printed and then cleared.
146         <number_of_lines>
147           The number of lines to process.
148           If omitted, all lines are printed and then cleared.
150     @stats_set_aux <region_id> <aux_data>
152         Store auxiliary data aux_data for the specified region.
154         <region_id>
155           region_id returned from @stats_create
157         <aux_data>
158           The string that identifies data which is useful to the client
159           program that created the range.  The kernel returns this
160           string back in the output of @stats_list message, but it
161           doesn't use this value for anything.
163 Examples
164 ========
166 Subdivide the DM device 'vol' into 100 pieces and start collecting
167 statistics on them:
169   dmsetup message vol 0 @stats_create - /100
171 Set the auxillary data string to "foo bar baz" (the escape for each
172 space must also be escaped, otherwise the shell will consume them):
174   dmsetup message vol 0 @stats_set_aux 0 foo\\ bar\\ baz
176 List the statistics:
178   dmsetup message vol 0 @stats_list
180 Print the statistics:
182   dmsetup message vol 0 @stats_print 0
184 Delete the statistics:
186   dmsetup message vol 0 @stats_delete 0