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