4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1991, 1999 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ident "%Z%%M% %I% %E% SMI" /* SunOS */
29 #include <sys/types.h>
30 #include <sys/errno.h>
32 #include <sys/tiuser.h>
34 #include <rpc/types.h>
38 #include <rpc/rpc_msg.h>
41 extern char *dlc_header
;
42 extern jmp_buf xdr_err
;
44 void detail_stats(); /* Version 1 */
45 void detail_statsswtch(); /* Version 2 */
46 void detail_statstime(); /* Version 3 */
47 void detail_statsvar(); /* Version 4 */
49 static char *procnames_short
[] = {
51 "Get Statistics", /* 1 */
55 static char *procnames_long
[] = {
56 "Null procedure", /* 0 */
57 "Get Statistics", /* 1 */
64 interpret_rstat(flags
, type
, xid
, vers
, proc
, data
, len
)
65 int flags
, type
, xid
, vers
, proc
;
71 if (proc
< 0 || proc
> MAXPROC
)
75 if (setjmp(xdr_err
)) {
79 line
= get_sum_line();
84 procnames_short
[proc
]);
86 check_retransmit(line
, xid
);
88 (void) sprintf(line
, "RSTAT R %s ",
89 procnames_short
[proc
]);
93 if (flags
& F_DTAIL
) {
94 show_header("RSTAT: ", "RSTAT Get Statistics", len
);
96 if (setjmp(xdr_err
)) {
99 (void) sprintf(get_line(0, 0),
101 proc
, procnames_long
[proc
]);
122 (void) showxdr_u_long(
135 (void) sprintf(get_line(0, 0), "CPU Times:");
136 (void) showxdr_long(" Time (1) = %d");
137 (void) showxdr_long(" Time (2) = %d");
138 (void) showxdr_long(" Time (3) = %d");
139 (void) showxdr_long(" Time (4) = %d");
141 (void) sprintf(get_line(0, 0), "Disk Transfers:");
142 (void) showxdr_long(" Transfers(1) = %d");
143 (void) showxdr_long(" Transfers(2) = %d");
144 (void) showxdr_long(" Transfers(3) = %d");
145 (void) showxdr_long(" Transfers(4) = %d");
147 (void) showxdr_u_long("Pages in = %lu");
148 (void) showxdr_u_long("Pages out = %lu");
149 (void) showxdr_u_long("Swaps in = %lu");
150 (void) showxdr_u_long("Swaps out = %lu");
151 (void) showxdr_u_long("Interrupts = %lu");
153 (void) showxdr_long("Receive packets = %d");
154 (void) showxdr_long("Receive errors = %d");
155 (void) showxdr_long("Transmit packets = %d");
156 (void) showxdr_long("Transmit errors = %d");
157 (void) showxdr_long("Collisions = %d");
164 (void) sprintf(get_line(0, 0), "CPU Times:");
165 (void) showxdr_long(" Time (1) = %d");
166 (void) showxdr_long(" Time (2) = %d");
167 (void) showxdr_long(" Time (3) = %d");
168 (void) showxdr_long(" Time (4) = %d");
170 (void) sprintf(get_line(0, 0), "Disk Transfers:");
171 (void) showxdr_long(" Transfers(1) = %d");
172 (void) showxdr_long(" Transfers(2) = %d");
173 (void) showxdr_long(" Transfers(3) = %d");
174 (void) showxdr_long(" Transfers(4) = %d");
176 (void) showxdr_u_long("Pages in = %lu");
177 (void) showxdr_u_long("Pages out = %lu");
178 (void) showxdr_u_long("Swaps in = %lu");
179 (void) showxdr_u_long("Swaps out = %lu");
180 (void) showxdr_u_long("Interrupts = %lu");
182 (void) showxdr_long("Receive packets = %d");
183 (void) showxdr_long("Receive errors = %d");
184 (void) showxdr_long("Transmit packets = %d");
185 (void) showxdr_long("Transmit errors = %d");
186 (void) showxdr_long("Collisions = %d");
188 (void) showxdr_u_long("V switch = %lu");
189 (void) showxdr_long("Average run 0 = %d");
190 (void) showxdr_long("Average run 1 = %d");
191 (void) showxdr_long("Average run 2 = %d");
193 (void) showxdr_date("Boot time: = %s");
200 (void) sprintf(get_line(0, 0), "CPU Times:");
201 (void) showxdr_long(" Time (1) = %d");
202 (void) showxdr_long(" Time (2) = %d");
203 (void) showxdr_long(" Time (3) = %d");
204 (void) showxdr_long(" Time (4) = %d");
206 (void) sprintf(get_line(0, 0), "Disk Transfers:");
207 (void) showxdr_long(" Transfers(1) = %d");
208 (void) showxdr_long(" Transfers(2) = %d");
209 (void) showxdr_long(" Transfers(3) = %d");
210 (void) showxdr_long(" Transfers(4) = %d");
212 (void) showxdr_u_long("Pages in = %lu");
213 (void) showxdr_u_long("Pages out = %lu");
214 (void) showxdr_u_long("Swaps in = %lu");
215 (void) showxdr_u_long("Swaps out = %lu");
216 (void) showxdr_u_long("Interrupts = %lu");
218 (void) showxdr_long("Receive packets = %d");
219 (void) showxdr_long("Receive errors = %d");
220 (void) showxdr_long("Transmit packets = %d");
221 (void) showxdr_long("Transmit errors = %d");
222 (void) showxdr_long("Collisions = %d");
224 (void) showxdr_u_long("V switch = %lu");
225 (void) showxdr_long("Average run 0 = %d");
226 (void) showxdr_long("Average run 1 = %d");
227 (void) showxdr_long("Average run 2 = %d");
229 (void) showxdr_date("Boot time: = %s");
230 (void) showxdr_date("Current time = %s");
239 (void) sprintf(get_line(0, 0), "CPU Times:");
241 for (i
= 1; i
<= n
; i
++) {
242 (void) sprintf(get_line(0, 0),
243 " Time (%2d) = %d", i
, getxdr_long());
246 (void) sprintf(get_line(0, 0), "Disk Transfers:");
248 for (i
= 1; i
<= n
; i
++) {
249 (void) sprintf(get_line(0, 0),
250 " Transfers (%2d) = %d", i
, getxdr_long());
253 (void) showxdr_u_long("Pages in = %lu");
254 (void) showxdr_u_long("Pages out = %lu");
255 (void) showxdr_u_long("Swaps in = %lu");
256 (void) showxdr_u_long("Swaps out = %lu");
257 (void) showxdr_u_long("Interrupts = %lu");
259 (void) showxdr_long("Receive packets = %d");
260 (void) showxdr_long("Receive errors = %d");
261 (void) showxdr_long("Transmit packets = %d");
262 (void) showxdr_long("Transmit errors = %d");
263 (void) showxdr_long("Collisions = %d");
265 (void) showxdr_u_long("V switch = %lu");
266 (void) showxdr_long("Average run 0 = %d");
267 (void) showxdr_long("Average run 1 = %d");
268 (void) showxdr_long("Average run 2 = %d");
270 (void) showxdr_date("Boot time: = %s");
271 (void) showxdr_date("Current time = %s");