Author: manu Date: Tue Jan 30 09:59:52 2018 New Revision: 328588 URL: https://svnweb.freebsd.org/changeset/base/328588
Log: nfsstat: Add libxo output Add libxo output support Merge exp41_intpr and exp_intpr function. The only difference is to print NFSV4.1 operations in exp41, add a third arguement to control that. printtitle was set to 1 and don't have a switch, add a -q options to control it. Reviewed by: bapt Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D14012 Modified: head/usr.bin/nfsstat/Makefile head/usr.bin/nfsstat/nfsstat.1 head/usr.bin/nfsstat/nfsstat.c Modified: head/usr.bin/nfsstat/Makefile ============================================================================== --- head/usr.bin/nfsstat/Makefile Tue Jan 30 04:50:23 2018 (r328587) +++ head/usr.bin/nfsstat/Makefile Tue Jan 30 09:59:52 2018 (r328588) @@ -4,6 +4,6 @@ PROG= nfsstat CFLAGS+=-DNFS -LIBADD+= devstat +LIBADD+= devstat xo .include <bsd.prog.mk> Modified: head/usr.bin/nfsstat/nfsstat.1 ============================================================================== --- head/usr.bin/nfsstat/nfsstat.1 Tue Jan 30 04:50:23 2018 (r328587) +++ head/usr.bin/nfsstat/nfsstat.1 Tue Jan 30 09:59:52 2018 (r328588) @@ -28,7 +28,7 @@ .\" From: @(#)nfsstat.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd November 23, 2016 +.Dd January 22, 2018 .Dt NFSSTAT 1 .Os .Sh NAME @@ -38,6 +38,7 @@ statistics .Sh SYNOPSIS .Nm +.Op Fl -libxo .Op Fl cdEemszW .Op Fl M Ar core .Op Fl N Ar system @@ -124,6 +125,15 @@ activity for both the client and server at second intervals. .It Fl z Reset statistics after displaying them. +.It Fl q +Do not print header +.It Fl -libxo +Generate output via +.Xr libxo 3 +in a selection of different human and machine readable formats. +See +.Xr xo_parse_args 3 +for details on command line arguments. .El .Sh FILES .Bl -tag -width ".Pa /boot/kernel/kernel" -compact Modified: head/usr.bin/nfsstat/nfsstat.c ============================================================================== --- head/usr.bin/nfsstat/nfsstat.c Tue Jan 30 04:50:23 2018 (r328587) +++ head/usr.bin/nfsstat/nfsstat.c Tue Jan 30 09:59:52 2018 (r328588) @@ -101,6 +101,8 @@ static const char rcsid[] = #include <devstat.h> #include <err.h> +#include <libxo/xo.h> + static int widemode = 0; static int zflag = 0; static int printtitle = 1; @@ -112,8 +114,7 @@ static void printhdr(int, int, int); static void usage(void); static char *sperc1(int, int); static char *sperc2(int, int); -static void exp_intpr(int, int); -static void exp41_intpr(int, int); +static void exp_intpr(int, int, int); static void exp_sidewaysintpr(u_int, int, int, int); static void compute_new_stats(struct nfsstatsv1 *cur_stats, struct nfsstatsv1 *prev_stats, int curop, long double etime, @@ -140,6 +141,8 @@ static struct stattypes statstruct[] = { #define STAT_TYPE_TO_NFS(stat_type) statstruct[stat_type].nfs_type +#define NFSSTAT_XO_VERSION "1" + int main(int argc, char **argv) { @@ -156,7 +159,14 @@ main(int argc, char **argv) interval = 0; memf = nlistf = NULL; - while ((ch = getopt(argc, argv, "cdEesWM:mN:w:z")) != -1) + + argc = xo_parse_args(argc, argv); + if (argc < 0) + exit(1); + + xo_set_version(NFSSTAT_XO_VERSION); + + while ((ch = getopt(argc, argv, "cdEesWM:mN:w:zq")) != -1) switch(ch) { case 'M': memf = optarg; @@ -211,14 +221,17 @@ main(int argc, char **argv) break; case 'E': if (extra_output != 0) - errx(1, "-e and -E are mutually exclusive"); + xo_err(1, "-e and -E are mutually exclusive"); extra_output = 2; break; case 'e': if (extra_output != 0) - errx(1, "-e and -E are mutually exclusive"); + xo_err(1, "-e and -E are mutually exclusive"); extra_output = 1; break; + case 'q': + printtitle = 0; + break; case '?': default: usage(); @@ -238,19 +251,21 @@ main(int argc, char **argv) } #endif if (modfind("nfscommon") < 0) - errx(1, "NFS client/server not loaded"); + xo_err(1, "NFS client/server not loaded"); if (interval) { exp_sidewaysintpr(interval, clientOnly, serverOnly, newStats); } else { - if (extra_output == 2) - exp41_intpr(clientOnly, serverOnly); - else if (extra_output == 1) - exp_intpr(clientOnly, serverOnly); + xo_open_container("nfsstat"); + if (extra_output != 0) + exp_intpr(clientOnly, serverOnly, extra_output - 1); else intpr(clientOnly, serverOnly); + xo_close_container("nfsstat"); } + + xo_finish(); exit(0); } @@ -271,14 +286,24 @@ intpr(int clientOnly, int serverOnly) } ext_nfsstats.vers = NFSSTATS_V1; if (nfssvc(nfssvc_flag, &ext_nfsstats) < 0) - err(1, "Can't get stats"); + xo_err(1, "Can't get stats"); if (clientOnly) { - printf("Client Info:\n"); - printf("Rpc Counts:\n"); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Getattr", "Setattr", "Lookup", "Readlink", "Read", - "Write", "Create", "Remove"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", + xo_open_container("clientstats"); + + if (printtitle) + xo_emit("{T:Client Info:\n"); + + xo_open_container("operations"); + xo_emit("{T:Rpc Counts:}\n"); + + xo_emit("{T:Getattr/%13.13s}{T:Setattr/%13.13s}" + "{T:Lookup/%13.13s}{T:Readlink/%13.13s}" + "{T:Read/%13.13s}{T:Write/%13.13s}" + "{T:Create/%13.13s}{T:Remove/%13.13s}\n"); + xo_emit("{:getattr/%13ju}{:setattr/%13ju}" + "{:lookup/%13ju}{:readlink/%13ju}" + "{:read/%13ju}{:write/%13ju}" + "{:create/%13ju}{:remove/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETATTR], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETATTR], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOOKUP], @@ -287,125 +312,188 @@ intpr(int clientOnly, int serverOnly) (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_WRITE], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATE], (uintmax_t)ext_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", "RdirPlus", "Access"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RENAME], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LINK], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SYMLINK], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKDIR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RMDIR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIRPLUS], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_ACCESS]); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Mknod", "Fsstat", "Fsinfo", "PathConf", "Commit"); - printf("%9ju %9ju %9ju %9ju %9ju\n", + + xo_emit("{T:Rename/%13.13s}{T:Link/%13.13s}" + "{T:Symlink/%13.13s}{T:Mkdir/%13.13s}" + "{T:Rmdir/%13.13s}{T:Readdir/%13.13s}" + "{T:RdirPlus/%13.13s}{T:Access/%13.13s}\n"); + xo_emit("{:rename/%13ju}{:link/%13ju}" + "{:symlink/%13ju}{:mkdir/%13ju}" + "{:rmdir/%13ju}{:readdir/%13ju}" + "{:rdirplus/%13ju}{:access/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RENAME], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LINK], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SYMLINK], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKDIR], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RMDIR], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIR], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIRPLUS], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_ACCESS]); + + xo_emit("{T:Mknod/%13.13s}{T:Fsstat/%13.13s}" + "{T:Fsinfo/%13.13s}{T:PathConf/%13.13s}" + "{T:Commit/%13.13s}\n"); + xo_emit("{:mknod/%13ju}{:fsstat/%13ju}" + "{:fsinfo/%13ju}{:pathconf/%13ju}" + "{:commit/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKNOD], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FSSTAT], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FSINFO], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_PATHCONF], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_COMMIT]); - printf("Rpc Info:\n"); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n", - "TimedOut", "Invalid", "X Replies", "Retries", - "Requests"); - printf("%9ju %9ju %9ju %9ju %9ju\n", + + xo_close_container("operations"); + + xo_open_container("rpcs"); + xo_emit("{T:Rpc Info:}\n"); + + xo_emit("{T:TimedOut/%13.13s}{T:Invalid/%13.13s}" + "{T:X Replies/%13.13s}{T:Retries/%13.13s}" + "{T:Requests/%13.13s}\n"); + xo_emit("{:timedout/%13ju}{:invalid/%13ju}" + "{:xreplies/%13ju}{:retries/%13ju}" + "{:requests/%13ju}\n", (uintmax_t)ext_nfsstats.rpctimeouts, (uintmax_t)ext_nfsstats.rpcinvalid, (uintmax_t)ext_nfsstats.rpcunexpected, (uintmax_t)ext_nfsstats.rpcretries, (uintmax_t)ext_nfsstats.rpcrequests); - printf("Cache Info:\n"); - printf("%9.9s %9.9s %9.9s %9.9s", - "Attr Hits", "Misses", "Lkup Hits", "Misses"); - printf(" %9.9s %9.9s %9.9s %9.9s\n", - "BioR Hits", "Misses", "BioW Hits", "Misses"); - printf("%9ju %9ju %9ju %9ju", - (uintmax_t)ext_nfsstats.attrcache_hits, - (uintmax_t)ext_nfsstats.attrcache_misses, - (uintmax_t)ext_nfsstats.lookupcache_hits, - (uintmax_t)ext_nfsstats.lookupcache_misses); - printf(" %9ju %9ju %9ju %9ju\n", - (uintmax_t)(ext_nfsstats.biocache_reads - - ext_nfsstats.read_bios), - (uintmax_t)ext_nfsstats.read_bios, - (uintmax_t)(ext_nfsstats.biocache_writes - - ext_nfsstats.write_bios), - (uintmax_t)ext_nfsstats.write_bios); - printf("%9.9s %9.9s %9.9s %9.9s", - "BioRLHits", "Misses", "BioD Hits", "Misses"); - printf(" %9.9s %9.9s %9.9s %9.9s\n", "DirE Hits", "Misses", "Accs Hits", "Misses"); - printf("%9ju %9ju %9ju %9ju", - (uintmax_t)(ext_nfsstats.biocache_readlinks - - ext_nfsstats.readlink_bios), - (uintmax_t)ext_nfsstats.readlink_bios, - (uintmax_t)(ext_nfsstats.biocache_readdirs - - ext_nfsstats.readdir_bios), - (uintmax_t)ext_nfsstats.readdir_bios); - printf(" %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.direofcache_hits, - (uintmax_t)ext_nfsstats.direofcache_misses, - (uintmax_t)ext_nfsstats.accesscache_hits, - (uintmax_t)ext_nfsstats.accesscache_misses); + xo_close_container("rpcs"); + + xo_open_container("cache"); + xo_emit("{T:Cache Info:}\n"); + + xo_emit("{T:Attr Hits/%13.13s}{T:Attr Misses/%13.13s}" + "{T:Lkup Hits/%13.13s}{T:Lkup Misses/%13.13s}" + "{T:BioR Hits/%13.13s}{T:BioR Misses/%13.13s}" + "{T:BioW Hits/%13.13s}{T:BioW Misses/%13.13s}\n"); + xo_emit("{:attrhits/%13ju}{:attrmisses/%13ju}" + "{:lkuphits/%13ju}{:lkupmisses/%13ju}" + "{:biorhits/%13ju}{:biormisses/%13ju}" + "{:biowhits/%13ju}{:biowmisses/%13ju}\n", + (uintmax_t)ext_nfsstats.attrcache_hits, + (uintmax_t)ext_nfsstats.attrcache_misses, + (uintmax_t)ext_nfsstats.lookupcache_hits, + (uintmax_t)ext_nfsstats.lookupcache_misses, + (uintmax_t)(ext_nfsstats.biocache_reads - + ext_nfsstats.read_bios), + (uintmax_t)ext_nfsstats.read_bios, + (uintmax_t)(ext_nfsstats.biocache_writes - + ext_nfsstats.write_bios), + (uintmax_t)ext_nfsstats.write_bios); + + xo_emit("{T:BioRL Hits/%13.13s}{T:BioRL Misses/%13.13s}" + "{T:BioD Hits/%13.13s}{T:BioD Misses/%13.13s}" + "{T:DirE Hits/%13.13s}{T:DirE Misses/%13.13s}" + "{T:Accs Hits/%13.13s}{T:Accs Misses/%13.13s}\n"); + xo_emit("{:biosrlhits/%13ju}{:biorlmisses/%13ju}" + "{:biodhits/%13ju}{:biodmisses/%13ju}" + "{:direhits/%13ju}{:diremisses/%13ju}" + "{:accshits/%13ju}{:accsmisses/%13ju}\n", + (uintmax_t)(ext_nfsstats.biocache_readlinks - + ext_nfsstats.readlink_bios), + (uintmax_t)ext_nfsstats.readlink_bios, + (uintmax_t)(ext_nfsstats.biocache_readdirs - + ext_nfsstats.readdir_bios), + (uintmax_t)ext_nfsstats.readdir_bios, + (uintmax_t)ext_nfsstats.direofcache_hits, + (uintmax_t)ext_nfsstats.direofcache_misses, + (uintmax_t)ext_nfsstats.accesscache_hits, + (uintmax_t)ext_nfsstats.accesscache_misses); + + xo_close_container("cache"); + + xo_close_container("clientstats"); } if (serverOnly) { - printf("\nServer Info:\n"); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Getattr", "Setattr", "Lookup", "Readlink", "Read", - "Write", "Create", "Remove"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_GETATTR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SETATTR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUP], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READLINK], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READ], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_CREATE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_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", "RdirPlus", "Access"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RENAME], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LINK], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SYMLINK], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_MKDIR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RMDIR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READDIR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READDIRPLUS], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_ACCESS]); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Mknod", "Fsstat", "Fsinfo", "PathConf", "Commit"); - printf("%9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_MKNOD], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_FSSTAT], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_FSINFO], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_PATHCONF], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_COMMIT]); - printf("Server Ret-Failed\n"); - printf("%17ju\n", (uintmax_t)ext_nfsstats.srvrpc_errs); - printf("Server Faults\n"); - printf("%13ju\n", (uintmax_t)ext_nfsstats.srv_errs); - printf("Server Cache Stats:\n"); - printf("%9.9s %9.9s %9.9s %9.9s\n", - "Inprog", "Idem", "Non-idem", "Misses"); - printf("%9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvcache_inproghits, - (uintmax_t)ext_nfsstats.srvcache_idemdonehits, - (uintmax_t)ext_nfsstats.srvcache_nonidemdonehits, - (uintmax_t)ext_nfsstats.srvcache_misses); - printf("Server Write Gathering:\n"); - printf("%9.9s %9.9s %9.9s\n", - "WriteOps", "WriteRPC", "Opsaved"); + xo_open_container("serverstats"); + + xo_emit("{T:Server Info:}\n"); + xo_open_container("operations"); + + xo_emit("{T:Getattr/%13.13s}{T:Setattr/%13.13s}" + "{T:Lookup/%13.13s}{T:Readlink/%13.13s}" + "{T:Read/%13.13s}{T:Write/%13.13s}" + "{T:Create/%13.13s}{T:Remove/%13.13s}\n"); + xo_emit("{:getattr/%13ju}{:setattr/%13ju}" + "{:lookup/%13ju}{:readlink/%13ju}" + "{:read/%13ju}{:write/%13ju}" + "{:create/%13ju}{:remove/%13ju}\n", + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_GETATTR], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SETATTR], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUP], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READLINK], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READ], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_CREATE], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_REMOVE]); + + xo_emit("{T:Rename/%13.13s}{T:Link/%13.13s}" + "{T:Symlink/%13.13s}{T:Mkdir/%13.13s}" + "{T:Rmdir/%13.13s}{T:Readdir/%13.13s}" + "{T:RdirPlus/%13.13s}{T:Access/%13.13s}\n"); + xo_emit("{:rename/%13ju}{:link/%13ju}" + "{:symlink/%13ju}{:mkdir/%13ju}" + "{:rmdir/%13ju}{:readdir/%13ju}" + "{:rdirplus/%13ju}{:access/%13ju}\n", + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RENAME], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LINK], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SYMLINK], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_MKDIR], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RMDIR], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READDIR], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READDIRPLUS], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_ACCESS]); + + xo_emit("{T:Mknod/%13.13s}{T:Fsstat/%13.13s}" + "{T:Fsinfo/%13.13s}{T:PathConf/%13.13s}" + "{T:Commit/%13.13s}\n"); + xo_emit("{:mknod/%13ju}{:fsstat/%13ju}" + "{:fsinfo/%13ju}{:pathconf/%13ju}" + "{:commit/%13ju}\n", + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_MKNOD], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_FSSTAT], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_FSINFO], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_PATHCONF], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_COMMIT]); + + xo_close_container("operations"); + + xo_open_container("server"); + xo_emit("{T:Server Re-Failed:}\n"); + xo_emit("{T:retfailed/%17ju}\n", (uintmax_t)ext_nfsstats.srvrpc_errs); + + xo_emit("{T:Server Faults:}\n"); + xo_emit("{T:faults/%13ju}\n", (uintmax_t)ext_nfsstats.srv_errs); + + xo_emit("{T:Server Write Gathering:/%13.13s}\n"); + + xo_emit("{T:WriteOps/%13.13s}{T:WriteRPC/%13.13s}" + "{T:Opsaved/%13.13s}\n"); + xo_emit("{:writeops/%13ju}{:writerpc/%13ju}" + "{:opsaved/%13ju}\n", /* * The new client doesn't do write gathering. It was * only useful for NFSv2. */ - printf("%9ju %9ju %9d\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], 0); + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], + (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], 0); + + xo_close_container("server"); + + xo_open_container("cache"); + xo_emit("{T:Server Cache Stats:/%13.13s}\n"); + xo_emit("{T:Inprog/%13.13s}{T:Idem/%13.13s}" + "{T:Non-Idem/%13.13s}{T:Misses/%13.13s}\n"); + xo_emit("{:inprog/%13ju}{:idem/%13ju}" + "{:nonidem/%13ju}{:misses/%13ju}\n", + (uintmax_t)ext_nfsstats.srvcache_inproghits, + (uintmax_t)ext_nfsstats.srvcache_idemdonehits, + (uintmax_t)ext_nfsstats.srvcache_nonidemdonehits, + (uintmax_t)ext_nfsstats.srvcache_misses); + xo_close_container("cache"); + + xo_close_container("serverstats"); } } @@ -550,270 +638,16 @@ compute_new_stats(struct nfsstatsv1 *cur_stats, } /* - * Print a description of the nfs stats for the experimental client/server. - */ -static void -exp_intpr(int clientOnly, int serverOnly) -{ - int nfssvc_flag; - - nfssvc_flag = NFSSVC_GETSTATS | NFSSVC_NEWSTRUCT; - if (zflag != 0) { - if (clientOnly != 0) - nfssvc_flag |= NFSSVC_ZEROCLTSTATS; - if (serverOnly != 0) - nfssvc_flag |= NFSSVC_ZEROSRVSTATS; - } - ext_nfsstats.vers = NFSSTATS_V1; - if (nfssvc(nfssvc_flag, &ext_nfsstats) < 0) - err(1, "Can't get stats"); - if (clientOnly != 0) { - if (printtitle) { - printf("Client Info:\n"); - printf("Rpc Counts:\n"); - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Getattr", "Setattr", "Lookup", "Readlink", - "Read", "Write", "Create", "Remove"); - } - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETATTR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETATTR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOOKUP], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READLINK], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READ], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_WRITE], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATE], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_REMOVE]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Rename", "Link", "Symlink", "Mkdir", "Rmdir", - "Readdir", "RdirPlus", "Access"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RENAME], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LINK], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SYMLINK], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKDIR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RMDIR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIR], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIRPLUS], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_ACCESS]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Mknod", "Fsstat", "Fsinfo", "PathConf", - "Commit", "SetClId", "SetClIdCf", "Lock"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKNOD], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FSSTAT], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FSINFO], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_PATHCONF], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_COMMIT], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETCLIENTID], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETCLIENTIDCFRM], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOCK]); - if (printtitle) - printf("%9.9s %9.9s %9.9s %9.9s\n", - "LockT", "LockU", "Open", "OpenCfr"); - printf("%9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOCKT], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOCKU], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPEN], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENCONFIRM]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "OpenOwner", "Opens", "LockOwner", - "Locks", "Delegs", "LocalOwn", - "LocalOpen", "LocalLOwn"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.clopenowners, - (uintmax_t)ext_nfsstats.clopens, - (uintmax_t)ext_nfsstats.cllockowners, - (uintmax_t)ext_nfsstats.cllocks, - (uintmax_t)ext_nfsstats.cldelegates, - (uintmax_t)ext_nfsstats.cllocalopenowners, - (uintmax_t)ext_nfsstats.cllocalopens, - (uintmax_t)ext_nfsstats.cllocallockowners); - if (printtitle) - printf("%9.9s\n", "LocalLock"); - printf("%9ju\n", (uintmax_t)ext_nfsstats.cllocallocks); - if (printtitle) { - printf("Rpc Info:\n"); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n", - "TimedOut", "Invalid", "X Replies", "Retries", - "Requests"); - } - printf("%9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.rpctimeouts, - (uintmax_t)ext_nfsstats.rpcinvalid, - (uintmax_t)ext_nfsstats.rpcunexpected, - (uintmax_t)ext_nfsstats.rpcretries, - (uintmax_t)ext_nfsstats.rpcrequests); - if (printtitle) { - printf("Cache Info:\n"); - printf("%9.9s %9.9s %9.9s %9.9s", - "Attr Hits", "Misses", "Lkup Hits", "Misses"); - printf(" %9.9s %9.9s %9.9s %9.9s\n", - "BioR Hits", "Misses", "BioW Hits", "Misses"); - } - printf("%9ju %9ju %9ju %9ju", - (uintmax_t)ext_nfsstats.attrcache_hits, - (uintmax_t)ext_nfsstats.attrcache_misses, - (uintmax_t)ext_nfsstats.lookupcache_hits, - (uintmax_t)ext_nfsstats.lookupcache_misses); - printf(" %9ju %9ju %9ju %9ju\n", - (uintmax_t)(ext_nfsstats.biocache_reads - - ext_nfsstats.read_bios), - (uintmax_t)ext_nfsstats.read_bios, - (uintmax_t)(ext_nfsstats.biocache_writes - - ext_nfsstats.write_bios), - (uintmax_t)ext_nfsstats.write_bios); - if (printtitle) { - printf("%9.9s %9.9s %9.9s %9.9s", - "BioRLHits", "Misses", "BioD Hits", "Misses"); - printf(" %9.9s %9.9s\n", "DirE Hits", "Misses"); - } - printf("%9ju %9ju %9ju %9ju", - (uintmax_t)(ext_nfsstats.biocache_readlinks - - ext_nfsstats.readlink_bios), - (uintmax_t)ext_nfsstats.readlink_bios, - (uintmax_t)(ext_nfsstats.biocache_readdirs - - ext_nfsstats.readdir_bios), - (uintmax_t)ext_nfsstats.readdir_bios); - printf(" %9ju %9ju\n", - (uintmax_t)ext_nfsstats.direofcache_hits, - (uintmax_t)ext_nfsstats.direofcache_misses); - } - if (serverOnly != 0) { - if (printtitle) { - printf("\nServer Info:\n"); - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Getattr", "Setattr", "Lookup", "Readlink", - "Read", "Write", "Create", "Remove"); - } - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_GETATTR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SETATTR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUP], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READLINK], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READ], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_V3CREATE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_REMOVE]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Rename", "Link", "Symlink", "Mkdir", "Rmdir", - "Readdir", "RdirPlus", "Access"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RENAME], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LINK], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SYMLINK], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_MKDIR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RMDIR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READDIR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_READDIRPLUS], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_ACCESS]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Mknod", "Fsstat", "Fsinfo", "PathConf", - "Commit", "LookupP", "SetClId", "SetClIdCf"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_MKNOD], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_FSSTAT], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_FSINFO], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_PATHCONF], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_COMMIT], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUPP], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SETCLIENTID], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SETCLIENTIDCFRM]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "Open", "OpenAttr", "OpenDwnGr", "OpenCfrm", - "DelePurge", "DeleRet", "GetFH", "Lock"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_OPEN], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_OPENATTR], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_OPENDOWNGRADE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_OPENCONFIRM], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_DELEGPURGE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_DELEGRETURN], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_GETFH], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOCK]); - if (printtitle) - printf( - "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" - , "LockT", "LockU", "Close", "Verify", "NVerify", - "PutFH", "PutPubFH", "PutRootFH"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOCKT], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_LOCKU], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_CLOSE], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_VERIFY], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_NVERIFY], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_PUTFH], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_PUTPUBFH], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_PUTROOTFH]); - if (printtitle) - printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Renew", "RestoreFH", "SaveFH", "Secinfo", - "RelLckOwn", "V4Create"); - printf("%9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RENEW], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RESTOREFH], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SAVEFH], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_SECINFO], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_RELEASELCKOWN], - (uintmax_t)ext_nfsstats.srvrpccnt[NFSV4OP_CREATE]); - if (printtitle) { - printf("Server:\n"); - printf("%9.9s %9.9s %9.9s\n", - "Retfailed", "Faults", "Clients"); - } - printf("%9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srv_errs, - (uintmax_t)ext_nfsstats.srvrpc_errs, - (uintmax_t)ext_nfsstats.srvclients); - if (printtitle) - printf("%9.9s %9.9s %9.9s %9.9s %9.9s \n", - "OpenOwner", "Opens", "LockOwner", - "Locks", "Delegs"); - printf("%9ju %9ju %9ju %9ju %9ju \n", - (uintmax_t)ext_nfsstats.srvopenowners, - (uintmax_t)ext_nfsstats.srvopens, - (uintmax_t)ext_nfsstats.srvlockowners, - (uintmax_t)ext_nfsstats.srvlocks, - (uintmax_t)ext_nfsstats.srvdelegates); - if (printtitle) { - printf("Server Cache Stats:\n"); - printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n", - "Inprog", "Idem", "Non-idem", "Misses", - "CacheSize", "TCPPeak"); - } - printf("%9ju %9ju %9ju %9ju %9ju %9ju\n", - (uintmax_t)ext_nfsstats.srvcache_inproghits, - (uintmax_t)ext_nfsstats.srvcache_idemdonehits, - (uintmax_t)ext_nfsstats.srvcache_nonidemdonehits, - (uintmax_t)ext_nfsstats.srvcache_misses, - (uintmax_t)ext_nfsstats.srvcache_size, - (uintmax_t)ext_nfsstats.srvcache_tcppeak); - } -} - -/* * Print a description of the nfs stats for the client/server, * including NFSv4.1. */ static void -exp41_intpr(int clientOnly, int serverOnly) +exp_intpr(int clientOnly, int serverOnly, int nfs41) { int nfssvc_flag; + xo_open_container("nfsv4"); + nfssvc_flag = NFSSVC_GETSTATS | NFSSVC_NEWSTRUCT; if (zflag != 0) { if (clientOnly != 0) @@ -823,349 +657,387 @@ exp41_intpr(int clientOnly, int serverOnly) } ext_nfsstats.vers = NFSSTATS_V1; if (nfssvc(nfssvc_flag, &ext_nfsstats) < 0) - err(1, "Can't get stats"); + xo_err(1, "Can't get stats"); if (clientOnly != 0) { + xo_open_container("clientstats"); + + xo_open_container("operations"); if (printtitle) { - printf("Client Info:\n"); - printf("RPC Counts:\n"); - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "Getattr", "Setattr", "Lookup", "Readlink", "Read", - "Write"); + xo_emit("{T:Client Info:}\n"); + xo_emit("{T:RPC Counts:}\n"); } - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", + xo_emit("{T:Getattr/%13.13s}{T:Setattr/%13.13s}" + "{T:Lookup/%13.13s}{T:Readlink/%13.13s}" + "{T:Read/%13.13s}{T:Write/%13.13s}\n"); + xo_emit("{:getattr/%13ju}{:setattr/%13ju}{:lookup/%13ju}" + "{:readlink/%13ju}{:read/%13ju}{:write/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETATTR], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETATTR], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOOKUP], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READLINK], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READ], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_WRITE]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "Create", "Remove", "Rename", "Link", "Symlink", - "Mkdir"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", + xo_emit("{T:Create/%13.13s}{T:Remove/%13.13s}" + "{T:Rename/%13.13s}{T:Link/%13.13s}" + "{T:Symlink/%13.13s}{T:Mkdir/%13.13s}\n"); + xo_emit("{:create/%13ju}{:remove/%13ju}{:rename/%13ju}" + "{:link/%13ju}{:symlink/%13ju}{:mkdir/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATE], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_REMOVE], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RENAME], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LINK], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SYMLINK], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKDIR]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "Rmdir", "Readdir", "RdirPlus", "Access", "Mknod", - "Fsstat"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", + xo_emit("{T:Rmdir/%13.13s}{T:Readdir/%13.13s}" + "{T:RdirPlus/%13.13s}{T:Access/%13.13s}" + "{T:Mknod/%13.13s}{T:Fsstat/%13.13s}\n"); + xo_emit("{:rmdir/%13ju}{:readdir/%13ju}{:rdirplus/%13ju}" + "{:access/%13ju}{:mknod/%13ju}{:fsstat/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RMDIR], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIR], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDIRPLUS], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_ACCESS], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_MKNOD], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FSSTAT]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "Fsinfo", "PathConf", "Commit", "SetClId", - "SetClIdCf", "Lock"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", + xo_emit("{T:FSinfo/%13.13s}{T:pathConf/%13.13s}" + "{T:Commit/%13.13s}{T:SetClId/%13.13s}" + "{T:SetClIdCf/%13.13s}{T:Lock/%13.13s}\n"); + xo_emit("{:fsinfo/%13ju}{:pathconf/%13ju}{:commit/%13ju}" + "{:setclientid/%13ju}{:setclientidcf/%13ju}{:lock/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FSINFO], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_PATHCONF], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_COMMIT], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETCLIENTID], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETCLIENTIDCFRM], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOCK]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "LockT", "LockU", "Open", "OpenCfr", "OpenDownGr", - "Close"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", + xo_emit("{T:LockT/%13.13s}{T:LockU/%13.13s}" + "{T:Open/%13.13s}{T:OpenCfr/%13.13s}\n"); + xo_emit("{:lockt/%13ju}{:locku/%13ju}" + "{:open/%13ju}{:opencfr/%13ju}\n", (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOCKT], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LOCKU], (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPEN], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENCONFIRM], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENDOWNGRADE], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CLOSE]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "RelLckOwn", "FreeStateID", "PutRootFH", "DelegRet", - "GetACL", "SetACL"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RELEASELCKOWN], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FREESTATEID], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_PUTROOTFH], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_DELEGRETURN], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETACL], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETACL]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "ExchangeID", "CreateSess", "DestroySess", - "DestroyClId", "LayoutGet", "GetDevInfo"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_EXCHANGEID], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATESESSION], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_DESTROYSESSION], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_DESTROYCLIENT], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LAYOUTGET], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETDEVICEINFO]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "LayoutCommit", "LayoutReturn", "ReclaimCompl", - "ReadDataS", "WriteDataS", "CommitDataS"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LAYOUTCOMMIT], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LAYOUTRETURN], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RECLAIMCOMPL], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDS], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_WRITEDS], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_COMMITDS]); - if (printtitle) - printf( - "%12.12s %12.12s\n", - "OpenLayout", "CreateLayout"); - printf("%12ju %12ju\n", - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENLAYGET], - (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATELAYGET]); - if (printtitle) - printf( - "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", - "OpenOwner", "Opens", "LockOwner", "Locks", - "Delegs", "LocalOwn"); - printf("%12ju %12ju %12ju %12ju %12ju %12ju\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENCONFIRM]); + + if (nfs41) { + xo_open_container("nfsv41"); + + xo_emit("{T:OpenDownGr/%13.13s}{T:Close/%13.13s}\n"); + xo_emit("{:opendowngr/%13ju}{:close/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENDOWNGRADE], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CLOSE]); + + xo_emit("{T:RelLckOwn/%13.13s}{T:FreeStateID/%13.13s}" + "{T:PutRootFH/%13.13s}{T:DelegRet/%13.13s}" + "{T:GetAcl/%13.13s}{T:SetAcl/%13.13s}\n"); + xo_emit("{:rellckown/%13ju}{:freestateid/%13ju}" + "{:getacl/%13ju}{:delegret/%13ju}" + "{:getacl/%13ju}{:setacl/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RELEASELCKOWN], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_FREESTATEID], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_PUTROOTFH], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_DELEGRETURN], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETACL], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_SETACL]); + + xo_emit("{T:ExchangeId/%13.13s}{T:CreateSess/%13.13s}" + "{T:DestroySess/%13.13s}{T:DestroyClId/%13.13s}" + "{T:LayoutGet/%13.13s}{T:GetDevInfo/%13.13s}\n"); + xo_emit("{:exchangeid/%13ju}{:createsess/%13ju}" + "{:destroysess/%13ju}{:destroyclid/%13ju}" + "{:layoutget/%13ju}{:getdevinfo/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_EXCHANGEID], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATESESSION], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_DESTROYSESSION], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_DESTROYCLIENT], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LAYOUTGET], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_GETDEVICEINFO]); + + xo_emit("{T:LayoutCommit/%13.13s}{T:LayoutReturn/%13.13s}" + "{T:ReclaimCompl/%13.13s}{T:ReadDataS/%13.13s}" + "{T:WriteDataS/%13.13s}{T:CommitDataS/%13.13s}\n"); + xo_emit("{:layoutcomit/%13ju}{:layoutreturn/%13ju}" + "{:reclaimcompl/%13ju}{:readdatas/%13ju}" + "{:writedatas/%13ju}{:commitdatas/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LAYOUTCOMMIT], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_LAYOUTRETURN], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_RECLAIMCOMPL], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_READDS], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_WRITEDS], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_COMMITDS]); + + xo_emit("{T:OpenLayout/%13.13s}{T:CreateLayout/%13.13s}\n"); + xo_emit("{:openlayout/%13ju}{:createlayout/%13ju}\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENLAYGET], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATELAYGET]); + + xo_close_container("nfsv41"); + } + xo_close_container("operations"); + + xo_open_container("client"); + xo_emit("{T:OpenOwner/%13.13s}{T:Opens/%13.13s}" + "{T:LockOwner/%13.13s}{T:Locks/%13.13s}" + "{T:Delegs/%13.13s}{T:LocalOwn/%13.13s}\n"); + xo_emit("{:openowner/%13ju}{:opens/%13ju}" + "{:lockowner/%13ju}{:locks/%13ju}" + "{:delegs/%13ju}{:localown/%13ju}\n", (uintmax_t)ext_nfsstats.clopenowners, (uintmax_t)ext_nfsstats.clopens, (uintmax_t)ext_nfsstats.cllockowners, (uintmax_t)ext_nfsstats.cllocks, (uintmax_t)ext_nfsstats.cldelegates, (uintmax_t)ext_nfsstats.cllocalopenowners); - if (printtitle) - printf("%12.12s %12.12s %12.12s\n", - "LocalOpen", "LocalLOwn", "LocalLock"); - printf("%12ju %12ju %12ju\n", + + xo_emit("{T:LocalOpen/%13.13s}{T:LocalLown/%13.13s}" + "{T:LocalLock\n"); + xo_emit("{:localopen/%13ju}{:locallown/%13ju}" + "{:locallock/%13ju}\n", (uintmax_t)ext_nfsstats.cllocalopens, (uintmax_t)ext_nfsstats.cllocallockowners, (uintmax_t)ext_nfsstats.cllocallocks); - if (printtitle) { - printf("Rpc Info:\n"); - printf("%12.12s %12.12s %12.12s %12.12s %12.12s\n", - "TimedOut", "Invalid", "X Replies", "Retries", - "Requests"); - } - printf("%12ju %12ju %12ju %12ju %12ju\n", + xo_close_container("client"); + + xo_open_container("rpc"); + if (printtitle) + xo_emit("{T:Rpc Info:}\n"); + xo_emit("{T:TimedOut/%13.13s}{T:Invalid/%13.13s}" + "{T:X Replies/%13.13s}{T:Retries/%13.13s}" + "{T:Requests/%13.13s}\n"); + xo_emit("{:timedout/%13ju}{:invalid/%13ju}" + "{:xreplies/%13ju}{:retries/%13ju}" + "{:requests/%13ju}\n", (uintmax_t)ext_nfsstats.rpctimeouts, (uintmax_t)ext_nfsstats.rpcinvalid, (uintmax_t)ext_nfsstats.rpcunexpected, (uintmax_t)ext_nfsstats.rpcretries, (uintmax_t)ext_nfsstats.rpcrequests); - if (printtitle) { - printf("Cache Info:\n"); - printf("%12.12s %12.12s %12.12s %12.12s\n", - "Attr Hits", "Misses", "Lkup Hits", "Misses"); - } - printf("%12ju %12ju %12ju %12ju\n", + xo_close_container("rpc"); + + xo_open_container("cache"); + if (printtitle) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"