* Fixed bogus CPU statistics output, which happened when
CPU user value from /proc/stat wasn't incremented whereas
CPU guest value was.
+ * nfsiostat now takes into account POSIXLY_CORRECT environment
+ variable. nfsiostat default output is expressed in kB/s,
+ unless this variable is set (in which case the output is
+ expressed in blocks/s).
* sar manual page updated.
* Code cleaned.
-.TH NFSIOSTAT 1 "JULY 2010" Linux "Linux User's Manual" -*- nroff -*-
+.TH NFSIOSTAT 1 "DECEMBER 2010" Linux "Linux User's Manual" -*- nroff -*-
.SH NAME
nfsiostat \- Report input/output statistics for network filesystems (NFS).
.SH SYNOPSIS
.SH REPORT
The Network Filesystem (NFS) report provides statistics for each mounted network filesystem.
+Transfer rates are shown in 1K blocks by default, unless the environment
+variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
The report shows the following fields:
.B Filesystem:
The timestamp displayed with option -t will also be compliant with ISO 8601
format.
+.IP POSIXLY_CORRECT
+When this variable is set, transfer rates are shown in 512-byte blocks instead
+of the default 1K blocks.
+
.SH BUG
.I /proc
filesystem must be mounted for
exit(1);
}
+/*
+ ***************************************************************************
+ * Set output unit. Unit will be kB/s unless POSIXLY_CORRECT
+ * environment variable has been set, in which case the output will be
+ * expressed in blocks/s.
+ ***************************************************************************
+ */
+void set_output_unit(void)
+{
+ char *e;
+
+ if (DISPLAY_KILOBYTES(flags) || DISPLAY_MEGABYTES(flags))
+ return;
+
+ /* Check POSIXLY_CORRECT environment variable */
+ if ((e = getenv(ENV_POSIXLY_CORRECT)) == NULL) {
+ /* Variable not set: Unit is kB/s and not blocks/s */
+ flags |= I_D_KILOBYTES;
+ }
+}
+
/*
***************************************************************************
* SIGALRM signal handler.
count = 1;
}
+ /* Select output unit (kB/s or blocks/s) */
+ set_output_unit();
+
/* Init structures according to machine architecture */
io_sys_init();
#define DISPLAY_ISO(m) (((m) & I_D_ISO) == I_D_ISO)
#define DISPLAY_HUMAN_READ(m) (((m) & I_D_HUMAN_READ) == I_D_HUMAN_READ)
+/* Environment variable */
+#define ENV_POSIXLY_CORRECT "POSIXLY_CORRECT"
+
/* Preallocation constats */
#define NR_NFS_PREALLOC 2