diff -up sysstat-8.0.4/man/iostat.1.pom sysstat-8.0.4/man/iostat.1 --- sysstat-8.0.4/man/iostat.1.pom 2007-11-10 14:41:02.000000000 +0100 +++ sysstat-8.0.4/man/iostat.1 2008-03-06 10:21:45.000000000 +0100 @@ -3,7 +3,7 @@ iostat \- Report Central Processing Unit (CPU) statistics and input/output statistics for devices, partitions and network filesystems (NFS). .SH SYNOPSIS -.B iostat [ -c ] [ -d ] [ -N ] [ -n ] [ -k | -m ] [ -t ] [ -V ] [ -x ] [ +.B iostat [ -c ] [ -d ] [ -N ] [ -n ] [ -h ] [ -k | -m ] [ -t ] [ -V ] [ -x ] [ .I device .B [ ... ] | ALL ] [ -p [ .I device @@ -409,6 +409,19 @@ NFS READ request. .RS Indicate the number of megabytes written to the server by the NFS client via an NFS WRITE request. + +.RE +.B rops/s +.RS +Indicate the number of read operations that were issued to the mount point +per second + +.RE +.B wops/s +.RS +Indicate the number of write operations that were issued to the mount point +per second + .RE .RE .SH OPTIONS @@ -429,6 +442,8 @@ Useful for viewing LVM2 statistics. .IP -n Display the network filesystem (NFS) report. This option works only with kernel 2.6.17 and later. +.IP -h +Display the NFS report more human readable. .IP "-p [ { device | ALL } ]" The -p option is exclusive of the -x option and displays statistics for block devices and all their partitions that are used by the system. diff -up sysstat-8.0.4/iostat.c.pom sysstat-8.0.4/iostat.c --- sysstat-8.0.4/iostat.c.pom 2008-01-01 10:26:31.000000000 +0100 +++ sysstat-8.0.4/iostat.c 2008-03-06 12:13:01.000000000 +0100 @@ -73,7 +73,7 @@ void usage(char *progname) { fprintf(stderr, _("Usage: %s [ options... ] [ [ ] ]\n" "Options are:\n" - "[ -c ] [ -d ] [ -N ] [ -n ] [ -k | -m ] [ -t ] [ -V ] [ -x ]\n" + "[ -c ] [ -d ] [ -N ] [ -n ] [ -h ] [ -k | -m ] [ -t ] [ -V ] [ -x ]\n" "[ [ ... ] | ALL ] [ -p [ | ALL ] ]\n"), progname); exit(1); @@ -843,10 +843,11 @@ void read_ppartitions_stat(int curr, int void read_nfs_stat(int curr, int flags) { FILE *fp; - int i, sw = 0; + int sw = 0; char line[8192]; + char *xprt_line; char nfs_name[MAX_NAME_LEN]; - char mount[10], on[10], bytes[10], aux[32]; + char mount[10], on[10], prefix[10], aux[32]; struct io_nfs_stats snfs; /* Every I/O NFS entry is potentially unregistered */ @@ -869,15 +870,45 @@ void read_nfs_stat(int curr, int flags) } } - sscanf(line, "%10s", bytes); - if (sw && (!strncmp(bytes, "bytes:", 6))) { + sscanf(line, "%10s", prefix); + if (sw && (!strncmp(prefix, "bytes:", 6))) { /* Read the stats for the last NFS-mounted directory */ - i = sscanf(strstr(line, "bytes:") + 6, "%llu %llu %llu %llu %llu %llu", + sscanf(strstr(line, "bytes:") + 6, "%llu %llu %llu %llu %llu %llu", &snfs.rd_normal_bytes, &snfs.wr_normal_bytes, &snfs.rd_direct_bytes, &snfs.wr_direct_bytes, &snfs.rd_server_bytes, &snfs.wr_server_bytes); - save_stats(nfs_name, curr, &snfs, ionfs_nr, st_hdr_ionfs); - sw = 0; + sw = 2; + } + + if ((sw==2) && (!strncmp(prefix,"xprt:", 5))) { + /* Read extended statistic for the last NFS-mounted directory + - number of sent rpc requests*/ + xprt_line=(strstr(line,"xprt:")+6); + /* upc, tcp or rdma data */ + + if (!strncmp(xprt_line,"udp",3)) { + /* port, bind_count, sends, recvs, bad_xids, req_u, bklog_u */ + sscanf(strstr(xprt_line,"udp")+4, "%*u %*u %lu %lu %*u %*u %*u", + &snfs.rpc_sends, &snfs.rpc_recvs); + } + + if (!strncmp(xprt_line,"tcp",3)) { + /* port, bind_counter, connect_count, connect_time, idle_time, + sends, recvs, bad_xids, req_u, bklog_u*/ + sscanf(strstr(xprt_line,"tcp")+4, "%*u %*u %*u %*u %*d %lu %lu %*u %*u %*u", + &snfs.rpc_sends, &snfs.rpc_recvs); + } + + if (!strncmp(xprt_line,"rdma",4)) { + /* 0(port), bind_count, connect_count, connect_time, idle_time + sends, recvs, bad_xids, req_u, bklog_u + ... */ + sscanf(strstr(xprt_line,"rdma")+5,"%*u %*u %*u %*u %*d %lu %lu %*u %*u %*u " + "%*u %*u %*u %*u %*u %*u %*u %*u %*u %*u\n", + &snfs.rpc_sends, &snfs.rpc_recvs); + } + save_stats(nfs_name, curr, &snfs, ionfs_nr, st_hdr_ionfs); + sw = 0; } } @@ -957,15 +988,15 @@ void write_nfs_stat_header(int flags, in { printf("Filesystem: "); if (DISPLAY_KILOBYTES(flags)) { - printf(" rkB_nor/s wkB_nor/s rkB_dir/s wkB_dir/s rkB_svr/s wkB_svr/s\n"); + printf(" rkB_nor/s wkB_nor/s rkB_dir/s wkB_dir/s rkB_svr/s wkB_svr/s rops/s wops/s\n"); *fctr = 1024; } else if (DISPLAY_MEGABYTES(flags)) { - printf(" rMB_nor/s wMB_nor/s rMB_dir/s wMB_dir/s rMB_svr/s wMB_svr/s\n"); + printf(" rMB_nor/s wMB_nor/s rMB_dir/s wMB_dir/s rMB_svr/s wMB_svr/s rops/s wops/s\n"); *fctr = 1024 * 1024; } else { - printf(" rBlk_nor/s wBlk_nor/s rBlk_dir/s wBlk_dir/s rBlk_svr/s wBlk_svr/s\n"); + printf(" rBlk_nor/s wBlk_nor/s rBlk_dir/s wBlk_dir/s rBlk_svr/s wBlk_svr/s rops/s wops/s\n"); *fctr = 512; } } @@ -1084,14 +1115,19 @@ void write_nfs_stat(int curr, unsigned l struct io_hdr_stats *shi, struct io_nfs_stats *ioni, struct io_nfs_stats *ionj) { - printf("%-22s %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f\n", - shi->name, - S_VALUE(ionj->rd_normal_bytes, ioni->rd_normal_bytes, itv) / fctr, + if (DISPLAY_HUMAN_READABLE(flags)) + printf("%-22s \n%23s", shi-> name,""); + else + printf("%-22s ", shi->name); + printf("%12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %9.2f %9.2f \n", + S_VALUE(ionj->rd_normal_bytes, ioni->rd_normal_bytes, itv) / fctr, S_VALUE(ionj->wr_normal_bytes, ioni->wr_normal_bytes, itv) / fctr, S_VALUE(ionj->rd_direct_bytes, ioni->rd_direct_bytes, itv) / fctr, S_VALUE(ionj->wr_direct_bytes, ioni->wr_direct_bytes, itv) / fctr, S_VALUE(ionj->rd_server_bytes, ioni->rd_server_bytes, itv) / fctr, - S_VALUE(ionj->wr_server_bytes, ioni->wr_server_bytes, itv) / fctr); + S_VALUE(ionj->wr_server_bytes, ioni->wr_server_bytes, itv) / fctr, + S_VALUE(ionj->rpc_sends, ioni->rpc_sends, itv), + S_VALUE(ionj->rpc_recvs, ioni->rpc_recvs, itv)); } @@ -1353,6 +1389,11 @@ int main(int argc, char **argv) flags |= I_D_DISK; /* Display disk utilization */ break; + case 'h': + /* Display NFS stats human readable*/ + flags |= I_D_HUMAN_READABLE; + break; + case 'k': if (DISPLAY_MEGABYTES(flags)) usage(argv[0]); diff -up sysstat-8.0.4/iostat.h.pom sysstat-8.0.4/iostat.h --- sysstat-8.0.4/iostat.h.pom 2008-01-01 10:26:31.000000000 +0100 +++ sysstat-8.0.4/iostat.h 2008-03-06 11:04:05.000000000 +0100 @@ -27,6 +27,7 @@ #define I_F_HAS_NFS 0x08000 #define I_D_DEVMAP_NAME 0x10000 #define I_D_ISO 0x20000 +#define I_D_HUMAN_READABLE 0x40000 #define DISPLAY_CPU(m) (((m) & I_D_CPU) == I_D_CPU) #define DISPLAY_DISK(m) (((m) & I_D_DISK) == I_D_DISK) @@ -46,6 +47,7 @@ #define HAS_NFS(m) (((m) & I_F_HAS_NFS) == I_F_HAS_NFS) #define DISPLAY_DEVMAP_NAME(m) (((m) & I_D_DEVMAP_NAME) == I_D_DEVMAP_NAME) #define DISPLAY_ISO(m) (((m) & I_D_ISO) == I_D_ISO) +#define DISPLAY_HUMAN_READABLE(m) (((m) & I_D_HUMAN_READABLE) == I_D_HUMAN_READABLE) #define DT_DEVICE 0 #define DT_PARTITION 1 @@ -120,6 +122,9 @@ struct io_nfs_stats { unsigned long long wr_direct_bytes __attribute__ ((packed)); unsigned long long rd_server_bytes __attribute__ ((packed)); unsigned long long wr_server_bytes __attribute__ ((packed)); + unsigned long rpc_sends __attribute__ ((packed)); + unsigned long rpc_recvs __attribute__ ((packed)); + }; #define IO_NFS_STATS_SIZE (sizeof(struct io_nfs_stats))