Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / kstat_queue.9f
blob34e78fe5225167b6c7cd290a23da568904f97df2
1 '\" te
2 .\" Copyright (c) 1994, Sun Microsystems, Inc., All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH KSTAT_QUEUE 9F "Apr 4, 1994"
7 .SH NAME
8 kstat_queue, kstat_waitq_enter, kstat_waitq_exit, kstat_runq_enter,
9 kstat_runq_exit, kstat_waitq_to_runq, kstat_runq_back_to_waitq \- update I/O
10 kstat statistics
11 .SH SYNOPSIS
12 .LP
13 .nf
14 #include <sys/types.h>
15 #include <sys/kstat.h>
19 \fBvoid\fR \fBkstat_waitq_enter\fR(\fBkstat_io_t *\fR\fIkiop\fR);
20 .fi
22 .LP
23 .nf
24 \fBvoid\fR \fBkstat_waitq_exit\fR(\fBkstat_io_t *\fR\fIkiop\fR);
25 .fi
27 .LP
28 .nf
29 \fBvoid\fR \fBkstat_runq_enter\fR(\fBkstat_io_t *\fR\fIkiop\fR);
30 .fi
32 .LP
33 .nf
34 \fBvoid\fR \fBkstat_runq_exit\fR(\fBkstat_io_t *\fR\fIkiop\fR);
35 .fi
37 .LP
38 .nf
39 \fBvoid\fR \fBkstat_waitq_to_runq\fR(\fBkstat_io_t *\fR\fIkiop\fR);
40 .fi
42 .LP
43 .nf
44 \fBvoid\fR \fBkstat_runq_back_to_waitq\fR(\fBkstat_io_t *\fR\fIkiop\fR);
45 .fi
47 .SH INTERFACE LEVEL
48 .sp
49 .LP
50 Solaris DDI specific (Solaris DDI)
51 .SH PARAMETERS
52 .sp
53 .ne 2
54 .na
55 \fB\fIkiop\fR \fR
56 .ad
57 .RS 9n
58 Pointer to a \fBkstat_io\fR(9S) structure.
59 .RE
61 .SH DESCRIPTION
62 .sp
63 .LP
64 A large number of \fBI/O\fR subsystems have at least two basic "lists" (or
65 queues) of transactions they manage: one for transactions that have been
66 accepted for processing but for which processing has yet to begin, and one for
67 transactions which are actively being processed (but not done). For this
68 reason, two cumulative time statistics are kept: wait (pre-service) time, and
69 run (service) time.
70 .sp
71 .LP
72 The \fBkstat_queue()\fR family of functions manage these times based on the
73 transitions between the driver wait queue and run queue.
74 .sp
75 .ne 2
76 .na
77 \fB\fBkstat_waitq_enter()\fR\fR
78 .ad
79 .RS 30n
80 \fBkstat_waitq_enter()\fR should be called when a request arrives and is placed
81 into a pre-service state (such as just prior to calling \fBdisksort\fR(9F)).
82 .RE
84 .sp
85 .ne 2
86 .na
87 \fB\fBkstat_waitq_exit()\fR\fR
88 .ad
89 .RS 30n
90 \fBkstat_waitq_exit()\fR should be used when a request is removed from its
91 pre-service state. (such as just prior to calling the driver's \fBstart\fR
92 routine).
93 .RE
95 .sp
96 .ne 2
97 .na
98 \fB\fBkstat_runq_enter()\fR\fR
99 .ad
100 .RS 30n
101 \fBkstat_runq_enter()\fR is also called when a request is placed in its service
102 state (just prior to calling the driver's start routine, but after
103 \fBkstat_waitq_exit()\fR).
107 .ne 2
109 \fB\fBkstat_runq_exit()\fR\fR
111 .RS 30n
112 \fBkstat_runq_exit()\fR is used when a request is removed from its service
113 state (just prior to calling \fBbiodone\fR(9F)).
117 .ne 2
119 \fB\fBkstat_waitq_to_runq()\fR\fR
121 .RS 30n
122 \fBkstat_waitq_to_runq()\fR transitions a request from the wait queue to the
123 run queue. This is useful wherever the driver would have normally done a
124 \fBkstat_waitq_exit()\fR followed by a call to \fBkstat_runq_enter()\fR.
128 .ne 2
130 \fB\fBkstat_runq_back_to_waitq()\fR\fR
132 .RS 30n
133 \fBkstat_runq_back_to_waitq()\fR transitions a request from the run queue back
134 to the wait queue. This may be necessary in some cases (write throttling is an
135 example).
138 .SH RETURN VALUES
141 None.
142 .SH CONTEXT
145 \fBkstat_create()\fR can be called from user or kernel context.
146 .SH WARNINGS
149 These transitions must be protected by holding the \fBkstat\fR's \fBks_lock\fR,
150 and must be completely accurate (all transitions are recorded). Forgetting a
151 transition may, for example, make an idle disk appear 100% busy.
152 .SH SEE ALSO
155 \fBbiodone\fR(9F), \fBdisksort\fR(9F), \fBkstat_create\fR(9F),
156 \fBkstat_delete\fR(9F), \fBkstat_named_init\fR(9F), \fBkstat\fR(9S),
157 \fBkstat_io\fR(9S)
160 \fIWriting Device Drivers\fR