1kstat_io(9S) Data Structures for Drivers kstat_io(9S)
2
3
4
6 kstat_io - structure for I/O kstats
7
9 #include <sys/types.h>
10 #include <sys/kstat.h>
11 #include <sys/ddi.h>
12 #include <sys/sunddi.h>
13
14
16 Solaris DDI specific (Solaris DDI)
17
19 I/O kstat statistics are kept in a kstat_io structure. When kstat_cre‐
20 ate(9F) creates an I/O kstat, the ks_data field is a pointer to one of
21 these structures. The macro KSTAT_IO_PTR() is provided to retrieve this
22 field. It looks like this:
23
24 #define KSTAT_IO_PTR(kptr) ((kstat_io_t *)(kptr)->ks_data)
25
26
28 u_longlong_t nread; /* number of bytes read */
29 u_longlong_t nwritten; /* number of bytes written *]/
30 ulong_t reads; /* number of read operations */
31 ulong_t writes; /* number of write operations */
32
33
34
35 The nread field should be updated by the driver with the number of
36 bytes successfully read upon completion.
37
38
39 The nwritten field should be updated by the driver with the number of
40 bytes successfully written upon completion.
41
42
43 The reads field should be updated by the driver after each successful
44 read operation.
45
46
47 The writes field should be updated by the driver after each successful
48 write operation.
49
50
51 Other I/O statistics are updated through the use of the kstat_queue(9F)
52 functions.
53
55 kstat_create(9F), kstat_named_init(9F), kstat_queue(9F),
56 kstat_runq_back_to_waitq(9F), kstat_runq_enter(9F),
57 kstat_runq_exit(9F), kstat_waitq_enter(9F), kstat_waitq_exit(9F),
58 kstat_waitq_to_runq(9F)
59
60
61 Writing Device Drivers
62
63
64
65SunOS 5.11 4 Apr 1994 kstat_io(9S)