nfsstat.c revision 1.9 1 1.9 lukem /* $NetBSD: nfsstat.c,v 1.9 1997/10/19 06:27:21 lukem Exp $ */
2 1.7 thorpej
3 1.1 cgd /*
4 1.5 mycroft * Copyright (c) 1983, 1989, 1993
5 1.5 mycroft * The Regents of the University of California. All rights reserved.
6 1.1 cgd *
7 1.1 cgd * This code is derived from software contributed to Berkeley by
8 1.1 cgd * Rick Macklem at The University of Guelph.
9 1.1 cgd *
10 1.1 cgd * Redistribution and use in source and binary forms, with or without
11 1.1 cgd * modification, are permitted provided that the following conditions
12 1.1 cgd * are met:
13 1.1 cgd * 1. Redistributions of source code must retain the above copyright
14 1.1 cgd * notice, this list of conditions and the following disclaimer.
15 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 cgd * notice, this list of conditions and the following disclaimer in the
17 1.1 cgd * documentation and/or other materials provided with the distribution.
18 1.1 cgd * 3. All advertising materials mentioning features or use of this software
19 1.1 cgd * must display the following acknowledgement:
20 1.1 cgd * This product includes software developed by the University of
21 1.1 cgd * California, Berkeley and its contributors.
22 1.1 cgd * 4. Neither the name of the University nor the names of its contributors
23 1.1 cgd * may be used to endorse or promote products derived from this software
24 1.1 cgd * without specific prior written permission.
25 1.1 cgd *
26 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 1.1 cgd * SUCH DAMAGE.
37 1.1 cgd */
38 1.1 cgd
39 1.9 lukem #include <sys/cdefs.h>
40 1.1 cgd #ifndef lint
41 1.9 lukem __COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1993\n\
42 1.9 lukem The Regents of the University of California. All rights reserved.\n");
43 1.1 cgd #endif /* not lint */
44 1.1 cgd
45 1.1 cgd #ifndef lint
46 1.7 thorpej #if 0
47 1.7 thorpej static char sccsid[] = "from: @(#)nfsstat.c 8.1 (Berkeley) 6/6/93";
48 1.7 thorpej #else
49 1.9 lukem __RCSID("$NetBSD: nfsstat.c,v 1.9 1997/10/19 06:27:21 lukem Exp $");
50 1.7 thorpej #endif
51 1.1 cgd #endif /* not lint */
52 1.1 cgd
53 1.1 cgd #include <sys/param.h>
54 1.1 cgd #include <sys/mount.h>
55 1.6 fvdl #include <sys/sysctl.h>
56 1.8 explorer
57 1.6 fvdl #include <nfs/rpcv2.h>
58 1.6 fvdl #include <nfs/nfsproto.h>
59 1.1 cgd #include <nfs/nfs.h>
60 1.8 explorer
61 1.1 cgd #include <ctype.h>
62 1.8 explorer #include <err.h>
63 1.1 cgd #include <errno.h>
64 1.8 explorer #include <fcntl.h>
65 1.5 mycroft #include <kvm.h>
66 1.8 explorer #include <limits.h>
67 1.1 cgd #include <nlist.h>
68 1.8 explorer #include <paths.h>
69 1.8 explorer #include <signal.h>
70 1.8 explorer #include <stdlib.h>
71 1.1 cgd #include <stdio.h>
72 1.1 cgd #include <string.h>
73 1.8 explorer #include <unistd.h>
74 1.1 cgd
75 1.1 cgd struct nlist nl[] = {
76 1.1 cgd #define N_NFSSTAT 0
77 1.1 cgd { "_nfsstats" },
78 1.9 lukem { "" },
79 1.1 cgd };
80 1.5 mycroft kvm_t *kd;
81 1.1 cgd
82 1.9 lukem void catchalarm __P((int));
83 1.9 lukem void intpr __P((u_long));
84 1.9 lukem int main __P((int, char **));
85 1.9 lukem void printhdr __P((void));
86 1.9 lukem void sidewaysintpr __P((u_int, u_long));
87 1.9 lukem void usage __P((void));
88 1.1 cgd
89 1.9 lukem int
90 1.1 cgd main(argc, argv)
91 1.1 cgd int argc;
92 1.1 cgd char **argv;
93 1.1 cgd {
94 1.1 cgd extern int optind;
95 1.1 cgd extern char *optarg;
96 1.1 cgd u_int interval;
97 1.1 cgd int ch;
98 1.5 mycroft char *memf, *nlistf;
99 1.8 explorer char errbuf[_POSIX2_LINE_MAX];
100 1.1 cgd
101 1.1 cgd interval = 0;
102 1.5 mycroft memf = nlistf = NULL;
103 1.9 lukem while ((ch = getopt(argc, argv, "M:N:w:")) != -1)
104 1.1 cgd switch(ch) {
105 1.1 cgd case 'M':
106 1.5 mycroft memf = optarg;
107 1.1 cgd break;
108 1.1 cgd case 'N':
109 1.5 mycroft nlistf = optarg;
110 1.1 cgd break;
111 1.1 cgd case 'w':
112 1.1 cgd interval = atoi(optarg);
113 1.1 cgd break;
114 1.1 cgd case '?':
115 1.1 cgd default:
116 1.1 cgd usage();
117 1.1 cgd }
118 1.1 cgd argc -= optind;
119 1.1 cgd argv += optind;
120 1.1 cgd
121 1.1 cgd #define BACKWARD_COMPATIBILITY
122 1.1 cgd #ifdef BACKWARD_COMPATIBILITY
123 1.1 cgd if (*argv) {
124 1.5 mycroft interval = atoi(*argv);
125 1.1 cgd if (*++argv) {
126 1.5 mycroft nlistf = *argv;
127 1.5 mycroft if (*++argv)
128 1.5 mycroft memf = *argv;
129 1.1 cgd }
130 1.1 cgd }
131 1.1 cgd #endif
132 1.5 mycroft /*
133 1.5 mycroft * Discard setgid privileges if not the running kernel so that bad
134 1.5 mycroft * guys can't print interesting stuff from kernel memory.
135 1.5 mycroft */
136 1.5 mycroft if (nlistf != NULL || memf != NULL)
137 1.5 mycroft setgid(getgid());
138 1.5 mycroft
139 1.9 lukem if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf)) == 0)
140 1.9 lukem errx(1, "kvm_openfiles: %s", errbuf);
141 1.9 lukem if (kvm_nlist(kd, nl) != 0)
142 1.9 lukem errx(1, "kvm_nlist: can't get names");
143 1.1 cgd
144 1.1 cgd if (interval)
145 1.5 mycroft sidewaysintpr(interval, nl[N_NFSSTAT].n_value);
146 1.1 cgd else
147 1.5 mycroft intpr(nl[N_NFSSTAT].n_value);
148 1.1 cgd exit(0);
149 1.1 cgd }
150 1.1 cgd
151 1.1 cgd /*
152 1.5 mycroft * Print a description of the nfs stats.
153 1.1 cgd */
154 1.1 cgd void
155 1.1 cgd intpr(nfsstataddr)
156 1.5 mycroft u_long nfsstataddr;
157 1.1 cgd {
158 1.1 cgd struct nfsstats nfsstats;
159 1.1 cgd
160 1.9 lukem if (kvm_read(kd, (u_long)nfsstataddr,
161 1.9 lukem (char *)&nfsstats, sizeof(struct nfsstats)) < 0)
162 1.9 lukem errx(1, "kvm_read failed");
163 1.1 cgd printf("Client Info:\n");
164 1.1 cgd printf("Rpc Counts:\n");
165 1.1 cgd printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
166 1.1 cgd "Getattr", "Setattr", "Lookup", "Readlink", "Read",
167 1.1 cgd "Write", "Create", "Remove");
168 1.1 cgd printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
169 1.5 mycroft nfsstats.rpccnt[NFSPROC_GETATTR],
170 1.5 mycroft nfsstats.rpccnt[NFSPROC_SETATTR],
171 1.5 mycroft nfsstats.rpccnt[NFSPROC_LOOKUP],
172 1.5 mycroft nfsstats.rpccnt[NFSPROC_READLINK],
173 1.5 mycroft nfsstats.rpccnt[NFSPROC_READ],
174 1.5 mycroft nfsstats.rpccnt[NFSPROC_WRITE],
175 1.5 mycroft nfsstats.rpccnt[NFSPROC_CREATE],
176 1.5 mycroft nfsstats.rpccnt[NFSPROC_REMOVE]);
177 1.5 mycroft printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
178 1.1 cgd "Rename", "Link", "Symlink", "Mkdir", "Rmdir",
179 1.6 fvdl "Readdir", "RdirPlus", "Access");
180 1.5 mycroft printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
181 1.5 mycroft nfsstats.rpccnt[NFSPROC_RENAME],
182 1.5 mycroft nfsstats.rpccnt[NFSPROC_LINK],
183 1.5 mycroft nfsstats.rpccnt[NFSPROC_SYMLINK],
184 1.5 mycroft nfsstats.rpccnt[NFSPROC_MKDIR],
185 1.5 mycroft nfsstats.rpccnt[NFSPROC_RMDIR],
186 1.5 mycroft nfsstats.rpccnt[NFSPROC_READDIR],
187 1.6 fvdl nfsstats.rpccnt[NFSPROC_READDIRPLUS],
188 1.6 fvdl nfsstats.rpccnt[NFSPROC_ACCESS]);
189 1.6 fvdl printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
190 1.6 fvdl "Mknod", "Fsstat", "Fsinfo", "PathConf", "Commit",
191 1.5 mycroft "GLease", "Vacate", "Evict");
192 1.6 fvdl printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
193 1.6 fvdl nfsstats.rpccnt[NFSPROC_MKNOD],
194 1.6 fvdl nfsstats.rpccnt[NFSPROC_FSSTAT],
195 1.6 fvdl nfsstats.rpccnt[NFSPROC_FSINFO],
196 1.6 fvdl nfsstats.rpccnt[NFSPROC_PATHCONF],
197 1.6 fvdl nfsstats.rpccnt[NFSPROC_COMMIT],
198 1.5 mycroft nfsstats.rpccnt[NQNFSPROC_GETLEASE],
199 1.5 mycroft nfsstats.rpccnt[NQNFSPROC_VACATED],
200 1.5 mycroft nfsstats.rpccnt[NQNFSPROC_EVICTED]);
201 1.1 cgd printf("Rpc Info:\n");
202 1.1 cgd printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n",
203 1.1 cgd "TimedOut", "Invalid", "X Replies", "Retries", "Requests");
204 1.1 cgd printf("%9d %9d %9d %9d %9d\n",
205 1.1 cgd nfsstats.rpctimeouts,
206 1.1 cgd nfsstats.rpcinvalid,
207 1.1 cgd nfsstats.rpcunexpected,
208 1.1 cgd nfsstats.rpcretries,
209 1.1 cgd nfsstats.rpcrequests);
210 1.1 cgd printf("Cache Info:\n");
211 1.1 cgd printf("%9.9s %9.9s %9.9s %9.9s",
212 1.1 cgd "Attr Hits", "Misses", "Lkup Hits", "Misses");
213 1.1 cgd printf(" %9.9s %9.9s %9.9s %9.9s\n",
214 1.1 cgd "BioR Hits", "Misses", "BioW Hits", "Misses");
215 1.1 cgd printf("%9d %9d %9d %9d",
216 1.1 cgd nfsstats.attrcache_hits, nfsstats.attrcache_misses,
217 1.1 cgd nfsstats.lookupcache_hits, nfsstats.lookupcache_misses);
218 1.1 cgd printf(" %9d %9d %9d %9d\n",
219 1.1 cgd nfsstats.biocache_reads-nfsstats.read_bios,
220 1.1 cgd nfsstats.read_bios,
221 1.1 cgd nfsstats.biocache_writes-nfsstats.write_bios,
222 1.1 cgd nfsstats.write_bios);
223 1.1 cgd printf("%9.9s %9.9s %9.9s %9.9s",
224 1.1 cgd "BioRLHits", "Misses", "BioD Hits", "Misses");
225 1.1 cgd printf(" %9.9s %9.9s\n", "DirE Hits", "Misses");
226 1.1 cgd printf("%9d %9d %9d %9d",
227 1.1 cgd nfsstats.biocache_readlinks-nfsstats.readlink_bios,
228 1.1 cgd nfsstats.readlink_bios,
229 1.1 cgd nfsstats.biocache_readdirs-nfsstats.readdir_bios,
230 1.1 cgd nfsstats.readdir_bios);
231 1.1 cgd printf(" %9d %9d\n",
232 1.1 cgd nfsstats.direofcache_hits, nfsstats.direofcache_misses);
233 1.1 cgd printf("\nServer Info:\n");
234 1.1 cgd printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
235 1.1 cgd "Getattr", "Setattr", "Lookup", "Readlink", "Read",
236 1.1 cgd "Write", "Create", "Remove");
237 1.1 cgd printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
238 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_GETATTR],
239 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_SETATTR],
240 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_LOOKUP],
241 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_READLINK],
242 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_READ],
243 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_WRITE],
244 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_CREATE],
245 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_REMOVE]);
246 1.5 mycroft printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
247 1.1 cgd "Rename", "Link", "Symlink", "Mkdir", "Rmdir",
248 1.6 fvdl "Readdir", "RdirPlus", "Access");
249 1.5 mycroft printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
250 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_RENAME],
251 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_LINK],
252 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_SYMLINK],
253 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_MKDIR],
254 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_RMDIR],
255 1.5 mycroft nfsstats.srvrpccnt[NFSPROC_READDIR],
256 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_READDIRPLUS],
257 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_ACCESS]);
258 1.6 fvdl printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
259 1.6 fvdl "Mknod", "Fsstat", "Fsinfo", "PathConf", "Commit",
260 1.5 mycroft "GLease", "Vacate", "Evict");
261 1.6 fvdl printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
262 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_MKNOD],
263 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_FSSTAT],
264 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_FSINFO],
265 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_PATHCONF],
266 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_COMMIT],
267 1.5 mycroft nfsstats.srvrpccnt[NQNFSPROC_GETLEASE],
268 1.5 mycroft nfsstats.srvrpccnt[NQNFSPROC_VACATED],
269 1.5 mycroft nfsstats.srvrpccnt[NQNFSPROC_EVICTED]);
270 1.1 cgd printf("Server Ret-Failed\n");
271 1.1 cgd printf("%17d\n", nfsstats.srvrpc_errs);
272 1.1 cgd printf("Server Faults\n");
273 1.1 cgd printf("%13d\n", nfsstats.srv_errs);
274 1.1 cgd printf("Server Cache Stats:\n");
275 1.1 cgd printf("%9.9s %9.9s %9.9s %9.9s\n",
276 1.1 cgd "Inprog", "Idem", "Non-idem", "Misses");
277 1.1 cgd printf("%9d %9d %9d %9d\n",
278 1.1 cgd nfsstats.srvcache_inproghits,
279 1.1 cgd nfsstats.srvcache_idemdonehits,
280 1.1 cgd nfsstats.srvcache_nonidemdonehits,
281 1.1 cgd nfsstats.srvcache_misses);
282 1.5 mycroft printf("Server Lease Stats:\n");
283 1.5 mycroft printf("%9.9s %9.9s %9.9s\n",
284 1.5 mycroft "Leases", "PeakL", "GLeases");
285 1.5 mycroft printf("%9d %9d %9d\n",
286 1.5 mycroft nfsstats.srvnqnfs_leases,
287 1.5 mycroft nfsstats.srvnqnfs_maxleases,
288 1.5 mycroft nfsstats.srvnqnfs_getleases);
289 1.6 fvdl printf("Server Write Gathering:\n");
290 1.6 fvdl printf("%9.9s %9.9s %9.9s\n",
291 1.6 fvdl "WriteOps", "WriteRPC", "Opsaved");
292 1.6 fvdl printf("%9d %9d %9d\n",
293 1.6 fvdl nfsstats.srvvop_writes,
294 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_WRITE],
295 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_WRITE] - nfsstats.srvvop_writes);
296 1.1 cgd }
297 1.1 cgd
298 1.1 cgd u_char signalled; /* set if alarm goes off "early" */
299 1.1 cgd
300 1.1 cgd /*
301 1.1 cgd * Print a running summary of nfs statistics.
302 1.1 cgd * Repeat display every interval seconds, showing statistics
303 1.1 cgd * collected over that interval. Assumes that interval is non-zero.
304 1.1 cgd * First line printed at top of screen is always cumulative.
305 1.1 cgd */
306 1.1 cgd void
307 1.1 cgd sidewaysintpr(interval, off)
308 1.1 cgd u_int interval;
309 1.5 mycroft u_long off;
310 1.1 cgd {
311 1.1 cgd struct nfsstats nfsstats, lastst;
312 1.1 cgd int hdrcnt, oldmask;
313 1.1 cgd
314 1.1 cgd (void)signal(SIGALRM, catchalarm);
315 1.1 cgd signalled = 0;
316 1.1 cgd (void)alarm(interval);
317 1.9 lukem memset((caddr_t)&lastst, 0, sizeof(lastst));
318 1.1 cgd
319 1.1 cgd for (hdrcnt = 1;;) {
320 1.1 cgd if (!--hdrcnt) {
321 1.1 cgd printhdr();
322 1.1 cgd hdrcnt = 20;
323 1.1 cgd }
324 1.9 lukem if (kvm_read(kd, off, (char *)&nfsstats, sizeof nfsstats) < 0)
325 1.9 lukem errx(1, "kvm_read failed");
326 1.1 cgd printf("Client: %8d %8d %8d %8d %8d %8d %8d %8d\n",
327 1.6 fvdl nfsstats.rpccnt[NFSPROC_GETATTR]-lastst.rpccnt[NFSPROC_GETATTR],
328 1.6 fvdl nfsstats.rpccnt[NFSPROC_LOOKUP]-lastst.rpccnt[NFSPROC_LOOKUP],
329 1.6 fvdl nfsstats.rpccnt[NFSPROC_READLINK]-lastst.rpccnt[NFSPROC_READLINK],
330 1.6 fvdl nfsstats.rpccnt[NFSPROC_READ]-lastst.rpccnt[NFSPROC_READ],
331 1.6 fvdl nfsstats.rpccnt[NFSPROC_WRITE]-lastst.rpccnt[NFSPROC_WRITE],
332 1.6 fvdl nfsstats.rpccnt[NFSPROC_RENAME]-lastst.rpccnt[NFSPROC_RENAME],
333 1.6 fvdl nfsstats.rpccnt[NFSPROC_ACCESS]-lastst.rpccnt[NFSPROC_ACCESS],
334 1.6 fvdl (nfsstats.rpccnt[NFSPROC_READDIR]-lastst.rpccnt[NFSPROC_READDIR])
335 1.6 fvdl +(nfsstats.rpccnt[NFSPROC_READDIRPLUS]-lastst.rpccnt[NFSPROC_READDIRPLUS]));
336 1.1 cgd printf("Server: %8d %8d %8d %8d %8d %8d %8d %8d\n",
337 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_GETATTR]-lastst.srvrpccnt[NFSPROC_GETATTR],
338 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_LOOKUP]-lastst.srvrpccnt[NFSPROC_LOOKUP],
339 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_READLINK]-lastst.srvrpccnt[NFSPROC_READLINK],
340 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_READ]-lastst.srvrpccnt[NFSPROC_READ],
341 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_WRITE]-lastst.srvrpccnt[NFSPROC_WRITE],
342 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_RENAME]-lastst.srvrpccnt[NFSPROC_RENAME],
343 1.6 fvdl nfsstats.srvrpccnt[NFSPROC_ACCESS]-lastst.srvrpccnt[NFSPROC_ACCESS],
344 1.6 fvdl (nfsstats.srvrpccnt[NFSPROC_READDIR]-lastst.srvrpccnt[NFSPROC_READDIR])
345 1.6 fvdl +(nfsstats.srvrpccnt[NFSPROC_READDIRPLUS]-lastst.srvrpccnt[NFSPROC_READDIRPLUS]));
346 1.1 cgd lastst = nfsstats;
347 1.1 cgd fflush(stdout);
348 1.1 cgd oldmask = sigblock(sigmask(SIGALRM));
349 1.1 cgd if (!signalled)
350 1.1 cgd sigpause(0);
351 1.1 cgd sigsetmask(oldmask);
352 1.1 cgd signalled = 0;
353 1.1 cgd (void)alarm(interval);
354 1.1 cgd }
355 1.1 cgd /*NOTREACHED*/
356 1.1 cgd }
357 1.1 cgd
358 1.1 cgd void
359 1.1 cgd printhdr()
360 1.1 cgd {
361 1.1 cgd printf(" %8.8s %8.8s %8.8s %8.8s %8.8s %8.8s %8.8s %8.8s\n",
362 1.1 cgd "Getattr", "Lookup", "Readlink", "Read", "Write", "Rename",
363 1.6 fvdl "Access", "Readdir");
364 1.1 cgd fflush(stdout);
365 1.1 cgd }
366 1.1 cgd
367 1.1 cgd /*
368 1.1 cgd * Called if an interval expires before sidewaysintpr has completed a loop.
369 1.1 cgd * Sets a flag to not wait for the alarm.
370 1.1 cgd */
371 1.1 cgd void
372 1.9 lukem catchalarm(dummy)
373 1.9 lukem int dummy;
374 1.1 cgd {
375 1.1 cgd signalled = 1;
376 1.1 cgd }
377 1.1 cgd
378 1.1 cgd void
379 1.1 cgd usage()
380 1.1 cgd {
381 1.1 cgd (void)fprintf(stderr,
382 1.1 cgd "usage: nfsstat [-M core] [-N system] [-w interval]\n");
383 1.1 cgd exit(1);
384 1.1 cgd }
385