+ if (opt_sleep && !sleep_time) {
+ starttime = time(NULL);
+ printf("Collecting statistics; press CTRL-C to view results from interval (i.e., from pause to CTRL-C).\n");
+ if (sigaction(SIGINT, &act, NULL) != 0) {
+ fprintf(stderr, "Error: couldn't register for signal and pause.\n");
+ return 1;
+ }
+ pause();
+ }
+
+ if (opt_since || opt_sleep) {
+ if (opt_srv) {
+ get_stats(NFSSRVSTAT, serverinfo_tmp, &opt_srv, opt_clt, 1);
+ diff_stats(serverinfo_tmp, serverinfo, 1);
+ }
+ if (opt_clt) {
+ get_stats(NFSCLTSTAT, clientinfo_tmp, &opt_clt, opt_srv, 0);
+ diff_stats(clientinfo_tmp, clientinfo, 0);
+ }
+ }
+ if(sleep_time) {
+ while(1) {
+ if (opt_srv) {
+ get_stats(NFSSRVSTAT, serverinfo_tmp , &opt_srv, opt_clt, 1);
+ diff_stats(serverinfo_tmp, serverinfo, 1);
+ }
+ if (opt_clt) {
+ get_stats(NFSCLTSTAT, clientinfo_tmp, &opt_clt, opt_srv, 0);
+ diff_stats(clientinfo_tmp, clientinfo, 0);
+ }
+ if (opt_list) {
+ print_stats_list(opt_prt);
+ } else {
+ print_all_stats(opt_srv, opt_clt, opt_prt);
+ }
+ fflush(stdout);
+
+ update_old_counters(clientinfo_tmp, clientinfo);
+ sleep(sleep_time);
+ }
+ } else {
+ if (opt_list) {
+ print_stats_list(opt_prt);
+ } else {
+ print_all_stats(opt_srv, opt_clt, opt_prt);
+ }
+ }
+
+ return 0;
+}
+
+static void
+print_all_stats (int opt_srv, int opt_clt, int opt_prt)
+{
+ print_server_stats(opt_srv, opt_prt);
+ print_client_stats(opt_clt, opt_prt);
+}
+
+static void
+print_server_stats(int opt_srv, int opt_prt)
+{
+ if (!opt_srv)
+ return;
+
+ if (opt_prt & PRNT_NET) {
+ if (opt_sleep && !has_rpcstats(srvnetinfo, 4)) {
+ } else {
+ print_numbers( LABEL_srvnet
+ "packets udp tcp tcpconn\n",
+ srvnetinfo, 4);