summaryrefslogtreecommitdiffstats
path: root/usr.bin/nfsstat
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1995-06-27 11:07:30 +0000
committerdfr <dfr@FreeBSD.org>1995-06-27 11:07:30 +0000
commit666343f7f055c064375d48bb9a608730d7145beb (patch)
tree372bad41f8c547f40d0826ed596c53dc772ab986 /usr.bin/nfsstat
parent6da3ef32238f37b3b45cf709205fcff60bcbda7f (diff)
downloadFreeBSD-src-666343f7f055c064375d48bb9a608730d7145beb.zip
FreeBSD-src-666343f7f055c064375d48bb9a608730d7145beb.tar.gz
Changes to support version 3 of the NFS protocol.
The version 2 support has been tested (client+server) against FreeBSD-2.0, IRIX 5.3 and FreeBSD-current (using a loopback mount). The version 2 support is stable AFAIK. The version 3 support has been tested with a loopback mount and minimally against an IRIX 5.3 server. It needs more testing and may have problems. I have patched amd to support the new variable length filehandles although it will still only use version 2 of the protocol. Before booting a kernel with these changes, nfs clients will need to at least build and install /usr/sbin/mount_nfs. Servers will need to build and install /usr/sbin/mountd. NFS diskless support is untested. Obtained from: Rick Macklem <rick@snowhite.cis.uoguelph.ca>
Diffstat (limited to 'usr.bin/nfsstat')
-rw-r--r--usr.bin/nfsstat/nfsstat.c90
1 files changed, 58 insertions, 32 deletions
diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c
index 169e8d1..0f54f12 100644
--- a/usr.bin/nfsstat/nfsstat.c
+++ b/usr.bin/nfsstat/nfsstat.c
@@ -43,13 +43,14 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "From: @(#)nfsstat.c 8.1 (Berkeley) 6/6/93";*/
static const char rcsid[] =
- "$Id$";
+ "$Id: nfsstat.c,v 1.2 1994/10/23 23:25:43 wollman Exp $";
#endif /* not lint */
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/sysctl.h>
-#include <nfs/nfsv2.h>
+#include <nfs/rpcv2.h>
+#include <nfs/nfsproto.h>
#include <nfs/nfs.h>
#include <signal.h>
#include <fcntl.h>
@@ -73,7 +74,10 @@ kvm_t *kd;
static int deadkernel = 0;
-void intpr(void), printhdr(void), sidewaysintpr(u_int), usage(void);
+void intpr __P((void));
+void printhdr __P((void));
+void sidewaysintpr __P((u_int));
+void usage __P((void));
main(argc, argv)
int argc;
@@ -146,7 +150,8 @@ main(argc, argv)
* for dead ones.
*/
void
-readstats(struct nfsstats *stp)
+readstats(stp)
+ struct nfsstats *stp;
{
if(deadkernel) {
if(kvm_read(kd, (u_long)nl[N_NFSSTAT].n_value, stp,
@@ -171,7 +176,7 @@ readstats(struct nfsstats *stp)
* Print a description of the nfs stats.
*/
void
-intpr(void)
+intpr()
{
struct nfsstats nfsstats;
@@ -193,7 +198,7 @@ intpr(void)
nfsstats.rpccnt[NFSPROC_REMOVE]);
printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
"Rename", "Link", "Symlink", "Mkdir", "Rmdir",
- "Readdir", "Statfs", "RdirLook");
+ "Readdir", "RdirPlus", "Access");
printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
nfsstats.rpccnt[NFSPROC_RENAME],
nfsstats.rpccnt[NFSPROC_LINK],
@@ -201,11 +206,17 @@ intpr(void)
nfsstats.rpccnt[NFSPROC_MKDIR],
nfsstats.rpccnt[NFSPROC_RMDIR],
nfsstats.rpccnt[NFSPROC_READDIR],
- nfsstats.rpccnt[NFSPROC_STATFS],
- nfsstats.rpccnt[NQNFSPROC_READDIRLOOK]);
- printf("%9.9s %9.9s %9.9s\n",
+ nfsstats.rpccnt[NFSPROC_READDIRPLUS],
+ nfsstats.rpccnt[NFSPROC_ACCESS]);
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "Mknod", "Fsstat", "Fsinfo", "PathConf", "Commit",
"GLease", "Vacate", "Evict");
- printf("%9d %9d %9d\n",
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ nfsstats.rpccnt[NFSPROC_MKNOD],
+ nfsstats.rpccnt[NFSPROC_FSSTAT],
+ nfsstats.rpccnt[NFSPROC_FSINFO],
+ nfsstats.rpccnt[NFSPROC_PATHCONF],
+ nfsstats.rpccnt[NFSPROC_COMMIT],
nfsstats.rpccnt[NQNFSPROC_GETLEASE],
nfsstats.rpccnt[NQNFSPROC_VACATED],
nfsstats.rpccnt[NQNFSPROC_EVICTED]);
@@ -256,7 +267,7 @@ intpr(void)
nfsstats.srvrpccnt[NFSPROC_REMOVE]);
printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
"Rename", "Link", "Symlink", "Mkdir", "Rmdir",
- "Readdir", "Statfs", "RdirLook");
+ "Readdir", "RdirPlus", "Access");
printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
nfsstats.srvrpccnt[NFSPROC_RENAME],
nfsstats.srvrpccnt[NFSPROC_LINK],
@@ -264,11 +275,17 @@ intpr(void)
nfsstats.srvrpccnt[NFSPROC_MKDIR],
nfsstats.srvrpccnt[NFSPROC_RMDIR],
nfsstats.srvrpccnt[NFSPROC_READDIR],
- nfsstats.srvrpccnt[NFSPROC_STATFS],
- nfsstats.srvrpccnt[NQNFSPROC_READDIRLOOK]);
- printf("%9.9s %9.9s %9.9s\n",
+ nfsstats.srvrpccnt[NFSPROC_READDIRPLUS],
+ nfsstats.srvrpccnt[NFSPROC_ACCESS]);
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "Mknod", "Fsstat", "Fsinfo", "PathConf", "Commit",
"GLease", "Vacate", "Evict");
- printf("%9d %9d %9d\n",
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ nfsstats.srvrpccnt[NFSPROC_MKNOD],
+ nfsstats.srvrpccnt[NFSPROC_FSSTAT],
+ nfsstats.srvrpccnt[NFSPROC_FSINFO],
+ nfsstats.srvrpccnt[NFSPROC_PATHCONF],
+ nfsstats.srvrpccnt[NFSPROC_COMMIT],
nfsstats.srvrpccnt[NQNFSPROC_GETLEASE],
nfsstats.srvrpccnt[NQNFSPROC_VACATED],
nfsstats.srvrpccnt[NQNFSPROC_EVICTED]);
@@ -291,6 +308,13 @@ intpr(void)
nfsstats.srvnqnfs_leases,
nfsstats.srvnqnfs_maxleases,
nfsstats.srvnqnfs_getleases);
+ printf("Server Write Gathering:\n");
+ printf("%9.9s %9.9s %9.9s\n",
+ "WriteOps", "WriteRPC", "Opsaved");
+ printf("%9d %9d %9d\n",
+ nfsstats.srvvop_writes,
+ nfsstats.srvrpccnt[NFSPROC_WRITE],
+ nfsstats.srvrpccnt[NFSPROC_WRITE] - nfsstats.srvvop_writes);
}
u_char signalled; /* set if alarm goes off "early" */
@@ -321,23 +345,25 @@ sidewaysintpr(interval)
}
readstats(&nfsstats);
printf("Client: %8d %8d %8d %8d %8d %8d %8d %8d\n",
- nfsstats.rpccnt[1]-lastst.rpccnt[1],
- nfsstats.rpccnt[4]-lastst.rpccnt[4],
- nfsstats.rpccnt[5]-lastst.rpccnt[5],
- nfsstats.rpccnt[6]-lastst.rpccnt[6],
- nfsstats.rpccnt[8]-lastst.rpccnt[8],
- nfsstats.rpccnt[11]-lastst.rpccnt[11],
- nfsstats.rpccnt[12]-lastst.rpccnt[12],
- nfsstats.rpccnt[16]-lastst.rpccnt[16]);
+ nfsstats.rpccnt[NFSPROC_GETATTR]-lastst.rpccnt[NFSPROC_GETATTR],
+ nfsstats.rpccnt[NFSPROC_LOOKUP]-lastst.rpccnt[NFSPROC_LOOKUP],
+ nfsstats.rpccnt[NFSPROC_READLINK]-lastst.rpccnt[NFSPROC_READLINK],
+ nfsstats.rpccnt[NFSPROC_READ]-lastst.rpccnt[NFSPROC_READ],
+ nfsstats.rpccnt[NFSPROC_WRITE]-lastst.rpccnt[NFSPROC_WRITE],
+ nfsstats.rpccnt[NFSPROC_RENAME]-lastst.rpccnt[NFSPROC_RENAME],
+ nfsstats.rpccnt[NFSPROC_ACCESS]-lastst.rpccnt[NFSPROC_ACCESS],
+ (nfsstats.rpccnt[NFSPROC_READDIR]-lastst.rpccnt[NFSPROC_READDIR])
+ +(nfsstats.rpccnt[NFSPROC_READDIRPLUS]-lastst.rpccnt[NFSPROC_READDIRPLUS]));
printf("Server: %8d %8d %8d %8d %8d %8d %8d %8d\n",
- nfsstats.srvrpccnt[1]-lastst.srvrpccnt[1],
- nfsstats.srvrpccnt[4]-lastst.srvrpccnt[4],
- nfsstats.srvrpccnt[5]-lastst.srvrpccnt[5],
- nfsstats.srvrpccnt[6]-lastst.srvrpccnt[6],
- nfsstats.srvrpccnt[8]-lastst.srvrpccnt[8],
- nfsstats.srvrpccnt[11]-lastst.srvrpccnt[11],
- nfsstats.srvrpccnt[12]-lastst.srvrpccnt[12],
- nfsstats.srvrpccnt[16]-lastst.srvrpccnt[16]);
+ nfsstats.srvrpccnt[NFSPROC_GETATTR]-lastst.srvrpccnt[NFSPROC_GETATTR],
+ nfsstats.srvrpccnt[NFSPROC_LOOKUP]-lastst.srvrpccnt[NFSPROC_LOOKUP],
+ nfsstats.srvrpccnt[NFSPROC_READLINK]-lastst.srvrpccnt[NFSPROC_READLINK],
+ nfsstats.srvrpccnt[NFSPROC_READ]-lastst.srvrpccnt[NFSPROC_READ],
+ nfsstats.srvrpccnt[NFSPROC_WRITE]-lastst.srvrpccnt[NFSPROC_WRITE],
+ nfsstats.srvrpccnt[NFSPROC_RENAME]-lastst.srvrpccnt[NFSPROC_RENAME],
+ nfsstats.srvrpccnt[NFSPROC_ACCESS]-lastst.srvrpccnt[NFSPROC_ACCESS],
+ (nfsstats.srvrpccnt[NFSPROC_READDIR]-lastst.srvrpccnt[NFSPROC_READDIR])
+ +(nfsstats.srvrpccnt[NFSPROC_READDIRPLUS]-lastst.srvrpccnt[NFSPROC_READDIRPLUS]));
lastst = nfsstats;
fflush(stdout);
oldmask = sigblock(sigmask(SIGALRM));
@@ -355,7 +381,7 @@ printhdr()
{
printf(" %8.8s %8.8s %8.8s %8.8s %8.8s %8.8s %8.8s %8.8s\n",
"Getattr", "Lookup", "Readlink", "Read", "Write", "Rename",
- "Link", "Readdir");
+ "Access", "Readdir");
fflush(stdout);
}
OpenPOWER on IntegriCloud