static void print_all_stats(int, int, int);
static void print_server_stats(int, int);
static void print_client_stats(int, int);
-static void print_stats_list(int);
+static void print_stats_list(int, int, int);
static void print_numbers(const char *, unsigned int *,
unsigned int);
static void print_callstats(const char *, const char **,
diff_stats(clientinfo_tmp, clientinfo, 0);
}
if (opt_list) {
- print_stats_list(opt_prt);
+ print_stats_list(opt_srv, opt_clt, opt_prt);
} else {
print_all_stats(opt_srv, opt_clt, opt_prt);
}
}
} else {
if (opt_list) {
- print_stats_list(opt_prt);
+ print_stats_list(opt_srv, opt_clt, opt_prt);
} else {
print_all_stats(opt_srv, opt_clt, opt_prt);
}
if (opt_sleep && !has_stats(cltproc3info)) {
;
} else {
- print_callstats( LABEL_cltproc3,
+ print_callstats(LABEL_cltproc3,
nfsv3name, cltproc3info + 1,
sizeof(nfsv3name)/sizeof(char *));
}
}
static void
-print_stats_list(int opt_prt)
+print_clnt_list(int opt_prt)
{
if (opt_prt & PRNT_CALLS) {
- if ((opt_prt & PRNT_V2) || ((opt_prt & PRNT_AUTO) && has_stats(cltproc2info))) {
- print_callstats_list(
- "nfs v2 server",
- nfsv2name, srvproc2info + 1, sizeof(nfsv2name)/sizeof(char *));
- print_callstats_list(
- "nfs v2 client",
- nfsv2name, cltproc2info + 1, sizeof(nfsv2name)/sizeof(char *));
+ if ((opt_prt & PRNT_V2) ||
+ ((opt_prt & PRNT_AUTO) && has_stats(cltproc2info))) {
+ if (opt_sleep && !has_stats(cltproc2info)) {
+ ;
+ } else {
+ print_callstats_list("nfs v2 client",
+ nfsv2name, cltproc2info + 1,
+ sizeof(nfsv2name)/sizeof(char *));
+ }
+ }
+ if ((opt_prt & PRNT_V3) ||
+ ((opt_prt & PRNT_AUTO) && has_stats(cltproc3info))) {
+ if (opt_sleep && !has_stats(cltproc3info)) {
+ ;
+ } else {
+ print_callstats_list("nfs v3 client",
+ nfsv3name, cltproc3info + 1,
+ sizeof(nfsv3name)/sizeof(char *));
+ }
+ }
+ if ((opt_prt & PRNT_V4) ||
+ ((opt_prt & PRNT_AUTO) && has_stats(cltproc4info))) {
+ if (opt_sleep && !has_stats(cltproc4info)) {
+ ;
+ } else {
+ print_callstats_list("nfs v4 ops",
+ nfssrvproc4opname, srvproc4opsinfo + 1,
+ sizeof(nfssrvproc4opname)/sizeof(char *));
+ print_callstats_list("nfs v4 client",
+ nfscltproc4name, cltproc4info + 1,
+ sizeof(nfscltproc4name)/sizeof(char *));
+ }
+ }
+ }
+}
+static void
+print_serv_list(int opt_prt)
+{
+ if (opt_prt & PRNT_CALLS) {
+ if ((opt_prt & PRNT_V2) ||
+ ((opt_prt & PRNT_AUTO) && has_stats(srvproc2info))) {
+ if (opt_sleep && !has_stats(srvproc2info)) {
+ ;
+ } else {
+ print_callstats_list("nfs v2 server",
+ nfsv2name, srvproc2info + 1,
+ sizeof(nfsv2name)/sizeof(char *));
+ }
}
- if ((opt_prt & PRNT_V3) || ((opt_prt & PRNT_AUTO) && has_stats(cltproc3info))) {
- print_callstats_list(
- "nfs v3 server",
- nfsv3name, srvproc3info + 1, sizeof(nfsv3name)/sizeof(char *));
- print_callstats_list(
- "nfs v3 client",
- nfsv3name, cltproc3info + 1, sizeof(nfsv3name)/sizeof(char *));
+ if ((opt_prt & PRNT_V3) ||
+ ((opt_prt & PRNT_AUTO) && has_stats(srvproc3info))) {
+ if (opt_sleep && !has_stats(srvproc3info)) {
+ ;
+ } else {
+ print_callstats_list("nfs v3 server",
+ nfsv3name, srvproc3info + 1,
+ sizeof(nfsv3name)/sizeof(char *));
+ }
}
- if ((opt_prt & PRNT_V4) || ((opt_prt & PRNT_AUTO) && has_stats(cltproc4info))) {
- print_callstats_list(
- "nfs v4 server",
- nfssrvproc4name, srvproc4info + 1, sizeof(nfssrvproc4name)/sizeof(char *));
- print_callstats_list(
- "nfs v4 ops",
- nfssrvproc4opname, srvproc4opsinfo + 1, sizeof(nfssrvproc4opname)/sizeof(char *));
- print_callstats_list(
- "nfs v4 client",
- nfscltproc4name, cltproc4info + 1, sizeof(nfscltproc4name)/sizeof(char *));
+ if ((opt_prt & PRNT_V4) ||
+ ((opt_prt & PRNT_AUTO) && has_stats(srvproc4opsinfo))) {
+ if (opt_sleep && !has_stats(srvproc4info)) {
+ ;
+ } else {
+ print_callstats_list("nfs v4 ops",
+ nfssrvproc4opname, srvproc4opsinfo + 1,
+ sizeof(nfssrvproc4opname)/sizeof(char *));
+ }
}
}
}
+static void
+print_stats_list(int opt_srv, int opt_clt, int opt_prt)
+{
+ if (opt_srv)
+ print_serv_list(opt_prt);
+
+ if (opt_clt)
+ print_clnt_list(opt_prt);
+}
static statinfo *
get_stat_info(const char *sp, struct statinfo *statp)