CVS commit: src/usr.sbin/iostat

2023-10-30 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Oct 30 19:43:33 UTC 2023

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
fix rev 1.70: -X is 1 line output, avoids printing the header too often.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2023-10-30 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Oct 30 19:43:33 UTC 2023

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
fix rev 1.70: -X is 1 line output, avoids printing the header too often.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.71 src/usr.sbin/iostat/iostat.c:1.72
--- src/usr.sbin/iostat/iostat.c:1.71	Fri Jul 28 12:03:33 2023
+++ src/usr.sbin/iostat/iostat.c	Mon Oct 30 19:43:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.71 2023/07/28 12:03:33 wiz Exp $	*/
+/*	$NetBSD: iostat.c,v 1.72 2023/10/30 19:43:33 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.71 2023/07/28 12:03:33 wiz Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.72 2023/10/30 19:43:33 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -357,9 +357,12 @@ main(int argc, char *argv[])
 	do_header = 1;
 
 	for (hdrcnt = 1;;) {
-		if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_3 | SHOW_STATS_Y)) {
+		if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y)) {
 			lines = ndrives;
 			hdroffset = 3;
+		} else if (ISSET(todo, SHOW_STATS_3)) {
+			lines = 1;
+			hdroffset = 3;
 		} else {
 			lines = 1;
 			hdroffset = 4;



CVS commit: src/usr.sbin/iostat

2023-07-28 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jul 28 12:03:33 UTC 2023

Modified Files:
src/usr.sbin/iostat: iostat.8 iostat.c

Log Message:
ostat: use standard option order (AaBb...)

Fix macro usage while here


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.70 -r1.71 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2023-07-28 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jul 28 12:03:33 UTC 2023

Modified Files:
src/usr.sbin/iostat: iostat.8 iostat.c

Log Message:
ostat: use standard option order (AaBb...)

Fix macro usage while here


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.70 -r1.71 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.8
diff -u src/usr.sbin/iostat/iostat.8:1.29 src/usr.sbin/iostat/iostat.8:1.30
--- src/usr.sbin/iostat/iostat.8:1.29	Fri Jul 28 09:18:58 2023
+++ src/usr.sbin/iostat/iostat.8	Fri Jul 28 12:03:33 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: iostat.8,v 1.29 2023/07/28 09:18:58 mrg Exp $
+.\"	$NetBSD: iostat.8,v 1.30 2023/07/28 12:03:33 wiz Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -37,7 +37,7 @@
 .Nd report I/O statistics
 .Sh SYNOPSIS
 .Nm
-.Op Fl CdDITxXyz
+.Op Fl CDdITXxyz
 .Op Fl c Ar count
 .Op Fl H Ar height
 .Op Fl W Ar width
@@ -65,14 +65,25 @@ to print raw, unaveraged values (totals)
 Only the last disk option specified
 .Fl ( d ,
 .Fl D ,
-.Fl x ,
 .Fl X ,
+.Fl x ,
 or
 .Fl y )
 is used.
 .Pp
 The options are as follows:
 .Bl -tag -width XNXsystemX
+.It Fl C
+Show CPU statistics.
+This is enabled by default unless any of the
+.Fl D ,
+.Fl d ,
+.Fl T ,
+.Fl X ,
+.Fl x ,
+or
+.Fl y
+flags are used.
 .It Fl c Ar count
 Repeat the display
 .Ar count
@@ -84,26 +95,6 @@ each subsequent report is for the time p
 If no
 .Ar wait
 interval is specified, the default is 1 second.
-.It Fl C
-Show CPU statistics.
-This is enabled by default unless any of the
-.Fl d ,
-.Fl D ,
-.Fl T ,
-.Fl x ,
-.Fl X ,
-or
-.Fl y
-flags are used.
-.It Fl d
-Show disk statistics.
-This is the default.
-Displays
-number of transfers per second,
-kilobytes per transfer,
-and
-megabytes transferred per second.
-Use of this flag disables the default display of CPU and tty statistics.
 .It Fl D
 Show alternative disk statistics.
 Displays
@@ -116,6 +107,15 @@ during the
 period (or since boot with
 .Fl I ) .
 Use of this flag disables the default display.
+.It Fl d
+Show disk statistics.
+This is the default.
+Displays
+number of transfers per second,
+kilobytes per transfer,
+and
+megabytes transferred per second.
+Use of this flag disables the default display of CPU and tty statistics.
 .It Fl H Ar height
 Set the page size (length, or height) explicitly, as the number of lines,
 .Ar height .
@@ -140,19 +140,19 @@ started running, rather than since the s
 In this case the first output would necessarily be zero,
 so is suppressed.
 Consequently this option produces no output if neither
-.Fl w
-nor
 .Fl c
+nor
+.Fl w
 is given.
 .ii
 .It Fl T
 Show tty statistics.
 This is enabled by default unless one, or more, of the
 .Fl C ,
-.Fl d ,
 .Fl D ,
-.Fl x ,
+.Fl d ,
 .Fl X ,
+.Fl x ,
 or
 .Fl y
 flags are used.
@@ -168,13 +168,6 @@ include a column after each relevant out
 showing the difference between this output and the previous.
 These added columns will be blank in the first displayed output.
 .uu
-.It Fl w Ar wait
-Pause
-.Ar wait
-seconds between each display.
-If no repeat
-.Ar count
-is specified, the default is infinity.
 .It Fl W Ar width
 Set the page width explicitly, as the number of columns of characters,
 .Ar width .
@@ -188,6 +181,20 @@ This width is used only to determine the
 by default when no drive list is given.
 In other cases output will be as wide as needed to display the
 data requested.
+.It Fl w Ar wait
+Pause
+.Ar wait
+seconds between each display.
+If no repeat
+.Ar count
+is specified, the default is infinity.
+.It Fl X
+Show limited alternative disk statistics.
+Displays megabytes transferred, and time spent in transfers, during the
+.Ar wait
+period (or since boot with
+.Fl I ) .
+Use of this flag disables the default display.
 .It Fl x
 Show extended disk statistics.
 Each disk is displayed on a line of its own with all available
@@ -201,13 +208,6 @@ The
 and
 .Fl T
 options are ignored with this output format.
-.It Fl X
-Show limited alternative disk statistics.
-Displays megabytes transferred, and time spent in transfers, during the
-.Ar wait
-period (or since boot with
-.Fl I ) .
-Use of this flag disables the default display.
 .It Fl y
 Shows the extended statistics (as with
 .Fl x )
@@ -354,7 +354,7 @@ The archaic option format:
 .ti +3n
 .Nm
 .Op Ar drives ...
-.Oo Ar wait Op Ar count Oc
+.Oo Ar wait Oo Ar count Oc Oc
 .br
 remains supported (the first
 .Ar drive

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.70 src/usr.sbin/iostat/iostat.c:1.71
--- src/usr.sbin/iostat/iostat.c:1.70	Fri Jul 28 09:18:58 2023
+++ src/usr.sbin/iostat/iostat.c	Fri Jul 28 12:03:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.70 2023/07/28 09:18:58 mrg Exp $	*/
+/*	$NetBSD: 

CVS commit: src/usr.sbin/iostat

2023-07-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Jul 28 09:18:59 UTC 2023

Modified Files:
src/usr.sbin/iostat: iostat.8 iostat.c

Log Message:
add iostat -X option, limited alternative statistics.

this is like the "-D" option, except it skips the xfers/s, and
reports MB/s instead of KB/s.  allows for far more devices to
be displayed per line by default (about 50% more.)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.69 -r1.70 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.8
diff -u src/usr.sbin/iostat/iostat.8:1.28 src/usr.sbin/iostat/iostat.8:1.29
--- src/usr.sbin/iostat/iostat.8:1.28	Sat Jun 18 11:33:13 2022
+++ src/usr.sbin/iostat/iostat.8	Fri Jul 28 09:18:58 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: iostat.8,v 1.28 2022/06/18 11:33:13 kre Exp $
+.\"	$NetBSD: iostat.8,v 1.29 2023/07/28 09:18:58 mrg Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)iostat.8	8.1 (Berkeley) 6/6/93
 .\"
-.Dd June 18, 2022
+.Dd July 28, 2023
 .Dt IOSTAT 8
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd report I/O statistics
 .Sh SYNOPSIS
 .Nm
-.Op Fl CdDITxyz
+.Op Fl CdDITxXyz
 .Op Fl c Ar count
 .Op Fl H Ar height
 .Op Fl W Ar width
@@ -66,6 +66,7 @@ Only the last disk option specified
 .Fl ( d ,
 .Fl D ,
 .Fl x ,
+.Fl X ,
 or
 .Fl y )
 is used.
@@ -90,6 +91,7 @@ This is enabled by default unless any of
 .Fl D ,
 .Fl T ,
 .Fl x ,
+.Fl X ,
 or
 .Fl y
 flags are used.
@@ -150,6 +152,7 @@ This is enabled by default unless one, o
 .Fl d ,
 .Fl D ,
 .Fl x ,
+.Fl X ,
 or
 .Fl y
 flags are used.
@@ -198,6 +201,13 @@ The
 and
 .Fl T
 options are ignored with this output format.
+.It Fl X
+Show limited alternative disk statistics.
+Displays megabytes transferred, and time spent in transfers, during the
+.Ar wait
+period (or since boot with
+.Fl I ) .
+Use of this flag disables the default display.
 .It Fl y
 Shows the extended statistics (as with
 .Fl x )
@@ -255,6 +265,7 @@ Megabytes transferred per second
 The alternative display format, (selected with
 .Fl D ) ,
 presents the following values:
+.Pp
 .Bl -tag -width indent -compact
 .It xfr
 Disk transfers
@@ -267,6 +278,7 @@ Seconds spent in disk activity
 With the
 .Fl y
 flag, the following queuing measurements are added:
+.Pp
 .Bl -tag -width indent -compact
 .It wait
 Number of I/O requests queued up
@@ -281,6 +293,17 @@ Seconds spent in the waiting queue.
 Queuing data might not be available from all drivers
 and is then shown as zeros.
 .El
+.Pp
+With the
+.Fl X
+flag, the following queuing measurements are added:
+.Pp
+.Bl -tag -width indent -compact
+.It MB/s
+Megabytes transferred per second
+.It time
+Seconds spent in disk activity
+.El
 .It cpu
 .Bl -tag -width indent -compact
 .It \
@@ -322,6 +345,10 @@ Collection of queuing values and the
 .Fl y
 option were added in
 .Nx 8.0 .
+The
+.Fl X
+option was added in
+.Nx 11.0 .
 The archaic option format:
 .br
 .ti +3n

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.69 src/usr.sbin/iostat/iostat.c:1.70
--- src/usr.sbin/iostat/iostat.c:1.69	Sat Jun 18 11:33:13 2022
+++ src/usr.sbin/iostat/iostat.c	Fri Jul 28 09:18:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.69 2022/06/18 11:33:13 kre Exp $	*/
+/*	$NetBSD: iostat.c,v 1.70 2023/07/28 09:18:58 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.69 2022/06/18 11:33:13 kre Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.70 2023/07/28 09:18:58 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -107,19 +107,20 @@ static char Line_Marker[] = "___
 #define	MIN(a,b)	(((a)<(b))?(a):(b))
 
 #define	ISSET(x, a)	((x) & (a))
-#define	SHOW_CPU	(1<<0)
-#define	SHOW_TTY	(1<<1)
-#define	SHOW_STATS_1	(1<<2)
-#define	SHOW_STATS_2	(1<<3)
-#define	SHOW_STATS_X	(1<<4)
-#define	SHOW_STATS_Y	(1<<5)
-#define	SHOW_UPDATES	(1<<6)
-#define	SHOW_TOTALS	(1<<7)
-#define	SHOW_NEW_TOTALS	(1<<8)
-#define	SUPPRESS_ZERO	(1<<9)
+#define	SHOW_CPU	(1u<<0)
+#define	SHOW_TTY	(1u<<1)
+#define	SHOW_STATS_1	(1u<<2)
+#define	SHOW_STATS_2	(1u<<3)
+#define	SHOW_STATS_3	(1u<<4)
+#define	SHOW_STATS_X	(1u<<5)
+#define	SHOW_STATS_Y	(1u<<6)
+#define	SHOW_UPDATES	(1u<<7)
+#define	SHOW_TOTALS	(1u<<8)
+#define	SHOW_NEW_TOTALS	(1u<<9)
+#define	SUPPRESS_ZERO	(1u<<10)
 
 #define	SHOW_STATS_ALL	(SHOW_STATS_1 | SHOW_STATS_2 |	\
-			SHOW_STATS_X | SHOW_STATS_Y)
+			 SHOW_STATS_3 | SHOW_STATS_X | SHOW_STATS_Y)
 
 /*
  * Decide how many screen columns each output statistic is given
@@ -165,6 +166,8 @@ static char Line_Marker[] = "___
 #define	LAYOUT_DRIVE_2_TBUSY	9	/*		time	*/
 #define	LAYOUT_DRIVE_2_BUSY	5	

CVS commit: src/usr.sbin/iostat

2023-07-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Jul 28 09:18:59 UTC 2023

Modified Files:
src/usr.sbin/iostat: iostat.8 iostat.c

Log Message:
add iostat -X option, limited alternative statistics.

this is like the "-D" option, except it skips the xfers/s, and
reports MB/s instead of KB/s.  allows for far more devices to
be displayed per line by default (about 50% more.)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.69 -r1.70 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2022-06-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jun 18 11:33:13 UTC 2022

Modified Files:
src/usr.sbin/iostat: iostat.8 iostat.c

Log Message:
Significant changes to output layout methods - except for -x and -y
which have not (yet) been touched (-xD needs *serious* improvements).

While this still has no run-time configurability, it is now easy to
adjust the column widths in the source and recompile.  Dynamic (auto)
column width sizing is probably out of the question (requires predicting
the future) but options to allow the widths to be set isn't out of the
question.

The columns are now (mostly) considerably wider than they were before,
hence wider windows are needed to view the same info.  In an 80
column window the default display (with tty & cpu included) displays
just 2 drives.   160 columns will fit 7 (but with -I, just 4).

One new option added (-z) suppresses output which is true 0 (but still
prints 0 for values rounded down to 0) for everything except tty stats.
For drive output, the drive must have done nothing during the interval
to get its output data blanked.

Also options -H h -W w to set the output size (page height & width), the
former used to decide when to print headers, and the latter to calculate
the number of drives to print when no drive names were given.  Env vars
LINES and COLUMNS are used if the options are not given, with fallback
to the terminal size (if output is to a terminal, and its sizes are
known), and if all else fails, 20 lines, 80 columns.  Specifying 0
means unlimited (infinite).   So "iostat -W 0" will show all of the
drives, across one (often very) long line.  Wedges count as drives.

When drives are specified, the output will now appear in the order they were
given on the command line, rather than the order the system discovered them
during auto-configuration.  If specified as an fnmatch(3) pattern, drives that
match will appear in auto-conf order, but that's generally what is wanted.
When none are specified, you still get the first N (however many fits based
upon the options selected) in auto-conf order (usually useless, more so now
given that less will fit).

Lastly, for those who looked at the patch I sent to current-users@
and were horrified at how kludgey it was, rest assured, that was just
a quick hack to demonstrate what the output format changes would look
like.   This version (I hope) is not nearly so disgusting.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.68 -r1.69 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2022-06-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jun 18 11:33:13 UTC 2022

Modified Files:
src/usr.sbin/iostat: iostat.8 iostat.c

Log Message:
Significant changes to output layout methods - except for -x and -y
which have not (yet) been touched (-xD needs *serious* improvements).

While this still has no run-time configurability, it is now easy to
adjust the column widths in the source and recompile.  Dynamic (auto)
column width sizing is probably out of the question (requires predicting
the future) but options to allow the widths to be set isn't out of the
question.

The columns are now (mostly) considerably wider than they were before,
hence wider windows are needed to view the same info.  In an 80
column window the default display (with tty & cpu included) displays
just 2 drives.   160 columns will fit 7 (but with -I, just 4).

One new option added (-z) suppresses output which is true 0 (but still
prints 0 for values rounded down to 0) for everything except tty stats.
For drive output, the drive must have done nothing during the interval
to get its output data blanked.

Also options -H h -W w to set the output size (page height & width), the
former used to decide when to print headers, and the latter to calculate
the number of drives to print when no drive names were given.  Env vars
LINES and COLUMNS are used if the options are not given, with fallback
to the terminal size (if output is to a terminal, and its sizes are
known), and if all else fails, 20 lines, 80 columns.  Specifying 0
means unlimited (infinite).   So "iostat -W 0" will show all of the
drives, across one (often very) long line.  Wedges count as drives.

When drives are specified, the output will now appear in the order they were
given on the command line, rather than the order the system discovered them
during auto-configuration.  If specified as an fnmatch(3) pattern, drives that
match will appear in auto-conf order, but that's generally what is wanted.
When none are specified, you still get the first N (however many fits based
upon the options selected) in auto-conf order (usually useless, more so now
given that less will fit).

Lastly, for those who looked at the patch I sent to current-users@
and were horrified at how kludgey it was, rest assured, that was just
a quick hack to demonstrate what the output format changes would look
like.   This version (I hope) is not nearly so disgusting.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.68 -r1.69 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.8
diff -u src/usr.sbin/iostat/iostat.8:1.27 src/usr.sbin/iostat/iostat.8:1.28
--- src/usr.sbin/iostat/iostat.8:1.27	Sun Jul 29 21:17:43 2018
+++ src/usr.sbin/iostat/iostat.8	Sat Jun 18 11:33:13 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: iostat.8,v 1.27 2018/07/29 21:17:43 wiz Exp $
+.\"	$NetBSD: iostat.8,v 1.28 2022/06/18 11:33:13 kre Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)iostat.8	8.1 (Berkeley) 6/6/93
 .\"
-.Dd July 29, 2018
+.Dd June 18, 2022
 .Dt IOSTAT 8
 .Os
 .Sh NAME
@@ -37,8 +37,10 @@
 .Nd report I/O statistics
 .Sh SYNOPSIS
 .Nm
-.Op Fl CdDITxy
+.Op Fl CdDITxyz
 .Op Fl c Ar count
+.Op Fl H Ar height
+.Op Fl W Ar width
 .Op Fl w Ar wait
 .Op Ar drives
 .Sh DESCRIPTION
@@ -49,6 +51,8 @@ By default,
 displays one line of statistics averaged over the machine's run time.
 The use of
 .Fl c
+or
+.Fl w
 presents successive lines averaged over the
 .Ar wait
 period.
@@ -56,13 +60,14 @@ The
 .Fl I
 option causes
 .Nm
-to print raw, unaveraged values.
+to print raw, unaveraged values (totals).
 .Pp
 Only the last disk option specified
 .Fl ( d ,
 .Fl D ,
+.Fl x ,
 or
-.Fl x )
+.Fl y )
 is used.
 .Pp
 The options are as follows:
@@ -80,34 +85,86 @@ If no
 interval is specified, the default is 1 second.
 .It Fl C
 Show CPU statistics.
-This is enabled by default unless the
+This is enabled by default unless any of the
 .Fl d ,
 .Fl D ,
 .Fl T ,
+.Fl x ,
 or
-.Fl x
+.Fl y
 flags are used.
 .It Fl d
 Show disk statistics.
 This is the default.
-Displays kilobytes per
-transfer, number of transfers, and megabytes transferred.
-Use of this flag disables display of CPU and tty statistics.
+Displays
+number of transfers per second,
+kilobytes per transfer,
+and
+megabytes transferred per second.
+Use of this flag disables the default display of CPU and tty statistics.
 .It Fl D
 Show alternative disk statistics.
-Displays kilobytes transferred, number of
-transfers, and time spent in transfers.
+Displays
+number of transfers,
+kilobytes transferred,
+and
+time spent in transfers,
+during the
+.Ar wait
+period (or since boot with
+.Fl I ) .
 Use of this flag disables the default display.
+.It Fl H Ar height
+Set the page 

CVS commit: src/usr.sbin/iostat

2022-06-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 17 01:47:45 UTC 2022

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
Fix processing of the archaic arg format (BACKWARD_COMPATIBILITY) so it
doesn't repeat the processing every iteration.  Repeatedly seeing the wait
interval does no harm, but setting the iteration count (reps) over and
over again rather defeats its purpose.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.67 src/usr.sbin/iostat/iostat.c:1.68
--- src/usr.sbin/iostat/iostat.c:1.67	Sun Apr  8 11:37:31 2018
+++ src/usr.sbin/iostat/iostat.c	Fri Jun 17 01:47:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.67 2018/04/08 11:37:31 mlelstv Exp $	*/
+/*	$NetBSD: iostat.c,v 1.68 2022/06/17 01:47:45 kre Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.67 2018/04/08 11:37:31 mlelstv Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.68 2022/06/17 01:47:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -124,7 +124,7 @@ static volatile int do_header;
 static void header(void);
 __dead static void usage(void);
 static void display(void);
-static int selectdrives(int, char *[]);
+static int selectdrives(int, char *[], int);
 
 int
 main(int argc, char *argv[])
@@ -203,7 +203,7 @@ main(int argc, char *argv[])
 	drvinit(0);
 	cpureadstats();
 	drvreadstats();
-	ndrives = selectdrives(argc, argv);
+	ndrives = selectdrives(argc, argv, 1);
 	if (ndrives == 0) {
 		/* No drives are selected.  No need to show drive stats. */
 		todo &= ~SHOW_STATS_ALL;
@@ -245,7 +245,7 @@ main(int argc, char *argv[])
 		cpureadstats();
 		drvreadstats();
 
-		ndrives = selectdrives(argc, argv);
+		ndrives = selectdrives(argc, argv, 0);
 	}
 	exit(0);
 }
@@ -614,7 +614,7 @@ out:
 }
 
 static int
-selectdrives(int argc, char *argv[])
+selectdrives(int argc, char *argv[], int first)
 {
 	int	i, maxdrives, ndrives, tried;
 
@@ -663,7 +663,7 @@ selectdrives(int argc, char *argv[])
 	}
 
 #ifdef BACKWARD_COMPATIBILITY
-	if (*argv) {
+	if (first && *argv) {
 		interval = atoi(*argv);
 		if (*++argv)
 			reps = atoi(*argv);



CVS commit: src/usr.sbin/iostat

2022-06-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 17 01:47:45 UTC 2022

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
Fix processing of the archaic arg format (BACKWARD_COMPATIBILITY) so it
doesn't repeat the processing every iteration.  Repeatedly seeing the wait
interval does no harm, but setting the iteration count (reps) over and
over again rather defeats its purpose.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2018-07-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jul 29 21:17:43 UTC 2018

Modified Files:
src/usr.sbin/iostat: iostat.8

Log Message:
Fix mandoc warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/iostat/iostat.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.8
diff -u src/usr.sbin/iostat/iostat.8:1.26 src/usr.sbin/iostat/iostat.8:1.27
--- src/usr.sbin/iostat/iostat.8:1.26	Sun Jul 29 17:03:02 2018
+++ src/usr.sbin/iostat/iostat.8	Sun Jul 29 21:17:43 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: iostat.8,v 1.26 2018/07/29 17:03:02 sevan Exp $
+.\"	$NetBSD: iostat.8,v 1.27 2018/07/29 21:17:43 wiz Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -34,9 +34,7 @@
 .Os
 .Sh NAME
 .Nm iostat
-.Nd report
-.Tn I/O
-statistics
+.Nd report I/O statistics
 .Sh SYNOPSIS
 .Nm
 .Op Fl CdDITxy
@@ -45,9 +43,7 @@ statistics
 .Op Ar drives
 .Sh DESCRIPTION
 .Nm
-displays kernel
-.Tn I/O
-statistics on terminal, disk and CPU operations.
+displays kernel I/O statistics on terminal, disk and CPU operations.
 By default,
 .Nm
 displays one line of statistics averaged over the machine's run time.
@@ -162,7 +158,6 @@ Kilobytes transferred per disk transfer
 transfers per second
 .It MB/s
 Megabytes transferred per second
-.Pp
 .El
 The alternative display format, (selected with
 .Fl D ) ,
@@ -174,7 +169,6 @@ Kilobytes transferred
 Disk transfers
 .It time
 Seconds spent in disk activity
-.Pp
 .El
 With the
 .Fl y



CVS commit: src/usr.sbin/iostat

2018-07-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jul 29 21:17:43 UTC 2018

Modified Files:
src/usr.sbin/iostat: iostat.8

Log Message:
Fix mandoc warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/iostat/iostat.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2018-07-29 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Jul 29 17:03:02 UTC 2018

Modified Files:
src/usr.sbin/iostat: iostat.8

Log Message:
Document "in" field in CPU section
Fix ps(1) Xr raised by mandoc -Tlint


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/iostat/iostat.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.8
diff -u src/usr.sbin/iostat/iostat.8:1.25 src/usr.sbin/iostat/iostat.8:1.26
--- src/usr.sbin/iostat/iostat.8:1.25	Sun Mar  5 23:07:12 2017
+++ src/usr.sbin/iostat/iostat.8	Sun Jul 29 17:03:02 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: iostat.8,v 1.25 2017/03/05 23:07:12 mlelstv Exp $
+.\"	$NetBSD: iostat.8,v 1.26 2018/07/29 17:03:02 sevan Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)iostat.8	8.1 (Berkeley) 6/6/93
 .\"
-.Dd July 9, 2015
+.Dd July 29, 2018
 .Dt IOSTAT 8
 .Os
 .Sh NAME
@@ -201,6 +201,8 @@ and is then shown as zeros.
 % of CPU time in user mode running niced processes
 .It \
 % of CPU time in system mode
+.It \
+% of CPU time in interrupt mode
 .It \
 % of CPU time in idle mode
 .El
@@ -209,7 +211,7 @@ and is then shown as zeros.
 .Xr fstat 1 ,
 .Xr netstat 1 ,
 .Xr nfsstat 1 ,
-.Xr \ 1 ,
+.Xr ps 1 ,
 .Xr systat 1 ,
 .Xr vmstat 1 ,
 .Xr fnmatch 3 ,



CVS commit: src/usr.sbin/iostat

2018-07-29 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Jul 29 17:03:02 UTC 2018

Modified Files:
src/usr.sbin/iostat: iostat.8

Log Message:
Document "in" field in CPU section
Fix ps(1) Xr raised by mandoc -Tlint


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/iostat/iostat.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2018-04-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr  8 11:37:31 UTC 2018

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
Re-evaluate drive selection to catch hog-plug devices.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.66 src/usr.sbin/iostat/iostat.c:1.67
--- src/usr.sbin/iostat/iostat.c:1.66	Sat Sep  9 23:51:58 2017
+++ src/usr.sbin/iostat/iostat.c	Sun Apr  8 11:37:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.66 2017/09/09 23:51:58 mrg Exp $	*/
+/*	$NetBSD: iostat.c,v 1.67 2018/04/08 11:37:31 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.66 2017/09/09 23:51:58 mrg Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.67 2018/04/08 11:37:31 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -210,14 +210,6 @@ main(int argc, char *argv[])
 		if (todo == 0)
 			errx(1, "no drives");
 	}
-	if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y)) {
-		lines = ndrives;
-		hdroffset = 3;
-	} else {
-		lines = 1;
-		hdroffset = 4;
-	}
-
 	tv.tv_sec = interval;
 	tv.tv_nsec = 0;
 
@@ -225,6 +217,14 @@ main(int argc, char *argv[])
 	(void)signal(SIGCONT, sig_header);
 
 	for (hdrcnt = 1;;) {
+		if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y)) {
+			lines = ndrives;
+			hdroffset = 3;
+		} else {
+			lines = 1;
+			hdroffset = 4;
+		}
+
 		if (do_header || (hdrcnt -= lines) <= 0) {
 			do_header = 0;
 			header();
@@ -244,6 +244,8 @@ main(int argc, char *argv[])
 		nanosleep(, NULL);
 		cpureadstats();
 		drvreadstats();
+
+		ndrives = selectdrives(argc, argv);
 	}
 	exit(0);
 }



CVS commit: src/usr.sbin/iostat

2018-04-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr  8 11:37:31 UTC 2018

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
Re-evaluate drive selection to catch hog-plug devices.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2017-09-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Sep  9 23:51:58 UTC 2017

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
two minor fixes for -x and -y mode:
- the header is only 1 line not 2, account for this when calculating
  when to display the next header.
- when ndrives > 1, don't display the header every time, but only when
  the previous one disappears.

now i don't feel the need to run "iostat -x wd0 1 & iostat -c wd1 1"
to get less repeated header output on my display.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2017-09-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Sep  9 23:51:58 UTC 2017

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
two minor fixes for -x and -y mode:
- the header is only 1 line not 2, account for this when calculating
  when to display the next header.
- when ndrives > 1, don't display the header every time, but only when
  the previous one disappears.

now i don't feel the need to run "iostat -x wd0 1 & iostat -c wd1 1"
to get less repeated header output on my display.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.65 src/usr.sbin/iostat/iostat.c:1.66
--- src/usr.sbin/iostat/iostat.c:1.65	Tue Jul  4 21:19:33 2017
+++ src/usr.sbin/iostat/iostat.c	Sat Sep  9 23:51:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.65 2017/07/04 21:19:33 mlelstv Exp $	*/
+/*	$NetBSD: iostat.c,v 1.66 2017/09/09 23:51:58 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.65 2017/07/04 21:19:33 mlelstv Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.66 2017/09/09 23:51:58 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -129,7 +129,7 @@ static int selectdrives(int, char *[]);
 int
 main(int argc, char *argv[])
 {
-	int ch, hdrcnt, ndrives, lines;
+	int ch, hdrcnt, hdroffset, ndrives, lines;
 	struct timespec	tv;
 	struct ttysize ts;
 
@@ -210,10 +210,13 @@ main(int argc, char *argv[])
 		if (todo == 0)
 			errx(1, "no drives");
 	}
-	if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y))
+	if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y)) {
 		lines = ndrives;
-	else
+		hdroffset = 3;
+	} else {
 		lines = 1;
+		hdroffset = 4;
+	}
 
 	tv.tv_sec = interval;
 	tv.tv_nsec = 0;
@@ -222,10 +225,10 @@ main(int argc, char *argv[])
 	(void)signal(SIGCONT, sig_header);
 
 	for (hdrcnt = 1;;) {
-		if (do_header || lines > 1 || (hdrcnt -= lines) <= 0) {
+		if (do_header || (hdrcnt -= lines) <= 0) {
 			do_header = 0;
 			header();
-			hdrcnt = winlines - 4;
+			hdrcnt = winlines - hdroffset;
 		}
 
 		if (!ISSET(todo, SHOW_TOTALS)) {



CVS commit: src/usr.sbin/iostat

2015-10-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Oct 25 02:47:17 UTC 2015

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
extend the "tout" column to 5 characters, it's really common on a modern
machine to have eg, build output way more than  chars/sec.

this doesn't affect the default disk list on an 80-char wide screen.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2015-10-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Oct 25 02:47:17 UTC 2015

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
extend the "tout" column to 5 characters, it's really common on a modern
machine to have eg, build output way more than  chars/sec.

this doesn't affect the default disk list on an 80-char wide screen.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.62 src/usr.sbin/iostat/iostat.c:1.63
--- src/usr.sbin/iostat/iostat.c:1.62	Thu Jul  9 13:26:52 2015
+++ src/usr.sbin/iostat/iostat.c	Sun Oct 25 02:47:17 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.62 2015/07/09 13:26:52 mrg Exp $	*/
+/*	$NetBSD: iostat.c,v 1.63 2015/10/25 02:47:17 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.62 2015/07/09 13:26:52 mrg Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.63 2015/10/25 02:47:17 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -184,7 +184,7 @@ main(int argc, char *argv[])
 	if (ISSET(todo, SHOW_CPU))
 		defdrives -= 16;	/* XXX magic number */
 	if (ISSET(todo, SHOW_TTY))
-		defdrives -= 9;		/* XXX magic number */
+		defdrives -= 10;	/* XXX magic number */
 	defdrives /= 18;		/* XXX magic number */
 
 	drvinit(0);
@@ -279,7 +279,7 @@ header(void)
 
 	/* Sub-Headers. */
 	if (ISSET(todo, SHOW_TTY))
-		printf(" tin tout");
+		printf(" tin  tout");
 
 	if (ISSET(todo, SHOW_STATS_1)) {
 		for (i = 0; i < ndrive; i++)
@@ -468,7 +468,7 @@ display(void)
 	}
 
 	if (ISSET(todo, SHOW_TTY))
-		printf("%4.0f %4.0f", cur.tk_nin / etime, cur.tk_nout / etime);
+		printf("%4.0f %5.0f", cur.tk_nin / etime, cur.tk_nout / etime);
 
 	if (ISSET(todo, SHOW_STATS_1)) {
 		drive_stats(etime);



CVS commit: src/usr.sbin/iostat

2015-07-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Jul  9 13:26:52 UTC 2015

Modified Files:
src/usr.sbin/iostat: iostat.8 iostat.c

Log Message:
support fnmatch(3) patterns for disknames.  eg, iostat wd* works now.
update the default disk number selection to note that it uses the current
terminal size to fit disks, not hard coded 4.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.8
diff -u src/usr.sbin/iostat/iostat.8:1.23 src/usr.sbin/iostat/iostat.8:1.24
--- src/usr.sbin/iostat/iostat.8:1.23	Wed Jun 11 17:01:04 2014
+++ src/usr.sbin/iostat/iostat.8	Thu Jul  9 13:26:52 2015
@@ -1,4 +1,4 @@
-.\	$NetBSD: iostat.8,v 1.23 2014/06/11 17:01:04 joerg Exp $
+.\	$NetBSD: iostat.8,v 1.24 2015/07/09 13:26:52 mrg Exp $
 .\
 .\ Copyright (c) 1985, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	from: @(#)iostat.8	8.1 (Berkeley) 6/6/93
 .\
-.Dd June 11, 2014
+.Dd July 9, 2015
 .Dt IOSTAT 8
 .Os
 .Sh NAME
@@ -142,13 +142,16 @@ characters written to terminals
 .It disks
 Disk operations.
 The header of the field is the disk name and unit number.
-If more than four disk drives are configured in the system,
+If more drives are configured in the system that fit across the
+current display,
 .Nm
-displays only the first four drives.
+displays only those drives that fit on the display.
 To force
 .Nm
-to display specific drives, their names may be supplied on the command
-line.
+to display specific drives, they may be supplied on the command
+line, either as names or
+.Fn fnmatch
+patterns.
 .Pp
 .Bl -tag -width indent -compact
 .It KB/t
@@ -189,6 +192,7 @@ Seconds spent in disk activity
 .Xr \ps 1 ,
 .Xr systat 1 ,
 .Xr vmstat 1 ,
+.Xr fnmatch 3 ,
 .Xr pstat 8
 .Pp
 The sections starting with ``Interpreting system activity'' in

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.61 src/usr.sbin/iostat/iostat.c:1.62
--- src/usr.sbin/iostat/iostat.c:1.61	Wed Jun 11 17:01:04 2014
+++ src/usr.sbin/iostat/iostat.c	Thu Jul  9 13:26:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.61 2014/06/11 17:01:04 joerg Exp $	*/
+/*	$NetBSD: iostat.c,v 1.62 2015/07/09 13:26:52 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT(@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = @(#)iostat.c	8.3 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: iostat.c,v 1.61 2014/06/11 17:01:04 joerg Exp $);
+__RCSID($NetBSD: iostat.c,v 1.62 2015/07/09 13:26:52 mrg Exp $);
 #endif
 #endif /* not lint */
 
@@ -88,6 +88,7 @@ __RCSID($NetBSD: iostat.c,v 1.61 2014/0
 #include string.h
 #include unistd.h
 #include math.h
+#include fnmatch.h
 
 #include drvstats.h
 
@@ -511,7 +512,7 @@ selectdrives(int argc, char *argv[])
 #endif
 		tried++;
 		for (i = 0; i  (int)ndrive; i++) {
-			if (strcmp(cur.name[i], *argv))
+			if (fnmatch(*argv, cur.name[i], 0))
 continue;
 			cur.select[i] = 1;
 			++ndrives;



CVS commit: src/usr.sbin/iostat

2015-07-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Jul  9 13:26:52 UTC 2015

Modified Files:
src/usr.sbin/iostat: iostat.8 iostat.c

Log Message:
support fnmatch(3) patterns for disknames.  eg, iostat wd* works now.
update the default disk number selection to note that it uses the current
terminal size to fit disks, not hard coded 4.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2014-06-11 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jun 11 17:01:04 UTC 2014

Modified Files:
src/usr.sbin/iostat: Makefile iostat.8 iostat.c

Log Message:
Remove KVM related options.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/iostat/Makefile
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/Makefile
diff -u src/usr.sbin/iostat/Makefile:1.24 src/usr.sbin/iostat/Makefile:1.25
--- src/usr.sbin/iostat/Makefile:1.24	Fri Jan  7 03:12:27 2011
+++ src/usr.sbin/iostat/Makefile	Wed Jun 11 17:01:04 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.24 2011/01/07 03:12:27 jakllsch Exp $
+#	$NetBSD: Makefile,v 1.25 2014/06/11 17:01:04 joerg Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include bsd.own.mk
@@ -13,7 +13,7 @@ CPPFLAGS+=-I${NETBSDSRCDIR}/usr.bin/vmst
 # drvstats.c pulled in from ../../usr.bin/vmstat
 SRCS=	drvstats.c iostat.c
 
-DPADD=	${LIBKVM} ${LIBM}
-LDADD=	-lkvm -lm
+DPADD=	${LIBM}
+LDADD=	-lm
 
 .include bsd.prog.mk

Index: src/usr.sbin/iostat/iostat.8
diff -u src/usr.sbin/iostat/iostat.8:1.22 src/usr.sbin/iostat/iostat.8:1.23
--- src/usr.sbin/iostat/iostat.8:1.22	Thu Aug  7 11:25:22 2003
+++ src/usr.sbin/iostat/iostat.8	Wed Jun 11 17:01:04 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: iostat.8,v 1.22 2003/08/07 11:25:22 agc Exp $
+.\	$NetBSD: iostat.8,v 1.23 2014/06/11 17:01:04 joerg Exp $
 .\
 .\ Copyright (c) 1985, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	from: @(#)iostat.8	8.1 (Berkeley) 6/6/93
 .\
-.Dd March 1, 2003
+.Dd June 11, 2014
 .Dt IOSTAT 8
 .Os
 .Sh NAME
@@ -41,8 +41,6 @@ statistics
 .Nm
 .Op Fl CdDITx
 .Op Fl c Ar count
-.Op Fl M Ar core
-.Op Fl N Ar system
 .Op Fl w Ar wait
 .Op Ar drives
 .Sh DESCRIPTION
@@ -106,13 +104,6 @@ transfers, and time spent in transfers.
 Use of this flag disables the default display.
 .It Fl I
 Show the running total values, rather than an average.
-.It Fl M Ar core
-Extract values associated with the name list from the specified core
-instead of the default
-.Dq Pa /dev/mem .
-.It Fl N Ar system
-Extract the name list from the specified system instead of the default
-.Dq Pa /netbsd .
 .It Fl T
 Show tty statistics.
 This is enabled by default unless the
@@ -191,13 +182,6 @@ Seconds spent in disk activity
 % of CPU time in idle mode
 .El
 .El
-.Sh FILES
-.Bl -tag -width /dev/mem -compact
-.It Pa /netbsd
-Default kernel namelist.
-.It Pa /dev/mem
-Default memory file.
-.El
 .Sh SEE ALSO
 .Xr fstat 1 ,
 .Xr netstat 1 ,

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.60 src/usr.sbin/iostat/iostat.c:1.61
--- src/usr.sbin/iostat/iostat.c:1.60	Tue Aug 30 19:06:06 2011
+++ src/usr.sbin/iostat/iostat.c	Wed Jun 11 17:01:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.60 2011/08/30 19:06:06 joerg Exp $	*/
+/*	$NetBSD: iostat.c,v 1.61 2014/06/11 17:01:04 joerg Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT(@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = @(#)iostat.c	8.3 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: iostat.c,v 1.60 2011/08/30 19:06:06 joerg Exp $);
+__RCSID($NetBSD: iostat.c,v 1.61 2014/06/11 17:01:04 joerg Exp $);
 #endif
 #endif /* not lint */
 
@@ -91,9 +91,6 @@ __RCSID($NetBSD: iostat.c,v 1.60 2011/0
 
 #include drvstats.h
 
-/* Namelist and memory files. */
-char	*nlistf, *memf;
-
 int		hz;
 static int	reps, interval;
 static int	todo = 0;
@@ -130,7 +127,7 @@ main(int argc, char *argv[])
 	struct timespec	tv;
 	struct ttysize ts;
 
-	while ((ch = getopt(argc, argv, Cc:dDIM:N:Tw:x)) != -1)
+	while ((ch = getopt(argc, argv, Cc:dDITw:x)) != -1)
 		switch (ch) {
 		case 'c':
 			if ((reps = atoi(optarg)) = 0)
@@ -150,12 +147,6 @@ main(int argc, char *argv[])
 		case 'I':
 			todo |= SHOW_TOTALS;
 			break;
-		case 'M':
-			memf = optarg;
-			break;
-		case 'N':
-			nlistf = optarg;
-			break;
 		case 'T':
 			todo |= SHOW_TTY;
 			break;
@@ -450,8 +441,8 @@ static void
 usage(void)
 {
 
-	(void)fprintf(stderr, usage: iostat [-CdDITx] [-c count] [-M core] 
-	[-N system] [-w wait] [drives]\n);
+	(void)fprintf(stderr, usage: iostat [-CdDITx] [-c count] 
+	[-w wait] [drives]\n);
 	exit(1);
 }
 



CVS commit: src/usr.sbin/iostat

2014-06-11 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jun 11 17:01:04 UTC 2014

Modified Files:
src/usr.sbin/iostat: Makefile iostat.8 iostat.c

Log Message:
Remove KVM related options.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/iostat/Makefile
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2011-08-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Aug 30 19:06:06 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
static + __dead


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.59 src/usr.sbin/iostat/iostat.c:1.60
--- src/usr.sbin/iostat/iostat.c:1.59	Mon Feb 14 02:43:37 2011
+++ src/usr.sbin/iostat/iostat.c	Tue Aug 30 19:06:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.59 2011/02/14 02:43:37 enami Exp $	*/
+/*	$NetBSD: iostat.c,v 1.60 2011/08/30 19:06:06 joerg Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = @(#)iostat.c	8.3 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: iostat.c,v 1.59 2011/02/14 02:43:37 enami Exp $);
+__RCSID($NetBSD: iostat.c,v 1.60 2011/08/30 19:06:06 joerg Exp $);
 #endif
 #endif /* not lint */
 
@@ -94,7 +94,8 @@
 /* Namelist and memory files. */
 char	*nlistf, *memf;
 
-int		hz, reps, interval;
+int		hz;
+static int	reps, interval;
 static int	todo = 0;
 static int	defdrives;
 static int	winlines = 20;
@@ -118,12 +119,10 @@
 static void sig_header(int);
 static volatile int do_header;
 static void header(void);
-static void usage(void);
+__dead static void usage(void);
 static void display(void);
 static int selectdrives(int, char *[]);
 
-int main(int, char *[]);
-
 int
 main(int argc, char *argv[])
 {
@@ -248,7 +247,7 @@
 }
 
 static void
-header()
+header(void)
 {
 	size_t i;
 



CVS commit: src/usr.sbin/iostat

2011-08-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Aug 30 19:06:06 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
static + __dead


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2011-02-13 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Mon Feb 14 02:42:26 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
Put space after comma and around binary operator.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.57 src/usr.sbin/iostat/iostat.c:1.58
--- src/usr.sbin/iostat/iostat.c:1.57	Sun Jan  9 03:35:23 2011
+++ src/usr.sbin/iostat/iostat.c	Mon Feb 14 02:42:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.57 2011/01/09 03:35:23 jakllsch Exp $	*/
+/*	$NetBSD: iostat.c,v 1.58 2011/02/14 02:42:26 enami Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = @(#)iostat.c	8.3 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: iostat.c,v 1.57 2011/01/09 03:35:23 jakllsch Exp $);
+__RCSID($NetBSD: iostat.c,v 1.58 2011/02/14 02:42:26 enami Exp $);
 #endif
 #endif /* not lint */
 
@@ -327,7 +327,7 @@
 		else
 			mbps = 0.0;
 		(void)printf( %5.*f,
-		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
+		MAX(0, 3 - (int)floor(log10(fabs(fmax(1.0, mbps), mbps);
 
 	/* average transfers per second. */
 		(void)printf( %4.0f,
@@ -345,7 +345,7 @@
 			mbps = 0;
 		mbps /= etime;
 		(void)printf( %5.*f ,
-		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
+		MAX(0, 3 - (int)floor(log10(fabs(fmax(1.0, mbps), mbps);
 	}
 }
 



CVS commit: src/usr.sbin/iostat

2011-02-13 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Mon Feb 14 02:43:37 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
A number greater than or equal to 1.0 is a positive number.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.58 src/usr.sbin/iostat/iostat.c:1.59
--- src/usr.sbin/iostat/iostat.c:1.58	Mon Feb 14 02:42:26 2011
+++ src/usr.sbin/iostat/iostat.c	Mon Feb 14 02:43:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.58 2011/02/14 02:42:26 enami Exp $	*/
+/*	$NetBSD: iostat.c,v 1.59 2011/02/14 02:43:37 enami Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = @(#)iostat.c	8.3 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: iostat.c,v 1.58 2011/02/14 02:42:26 enami Exp $);
+__RCSID($NetBSD: iostat.c,v 1.59 2011/02/14 02:43:37 enami Exp $);
 #endif
 #endif /* not lint */
 
@@ -327,7 +327,7 @@
 		else
 			mbps = 0.0;
 		(void)printf( %5.*f,
-		MAX(0, 3 - (int)floor(log10(fabs(fmax(1.0, mbps), mbps);
+		MAX(0, 3 - (int)floor(log10(fmax(1.0, mbps, mbps);
 
 	/* average transfers per second. */
 		(void)printf( %4.0f,
@@ -345,7 +345,7 @@
 			mbps = 0;
 		mbps /= etime;
 		(void)printf( %5.*f ,
-		MAX(0, 3 - (int)floor(log10(fabs(fmax(1.0, mbps), mbps);
+		MAX(0, 3 - (int)floor(log10(fmax(1.0, mbps, mbps);
 	}
 }
 



CVS commit: src/usr.sbin/iostat

2011-02-13 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Mon Feb 14 02:42:26 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
Put space after comma and around binary operator.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2011-02-13 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Mon Feb 14 02:43:37 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
A number greater than or equal to 1.0 is a positive number.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.sbin/iostat

2011-01-08 Thread Martin Husemann
On Sat, Jan 08, 2011 at 05:12:00PM +, Matthias Scheler wrote:
 Why not? It doesn't sound hard to do that based on the manual page.

Because it special cases +0.0  -0.0 and also claims to deal with NaNs.
We problaby should do a naive implementation and conditionalize the man
page claims on architectures where such concepts exists.

Martin


CVS commit: src/usr.sbin/iostat

2011-01-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan  9 02:40:19 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
NetBSD/vax libm now has fmax, use it again.
Also, display average transfer size using dynamic precision too.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.55 src/usr.sbin/iostat/iostat.c:1.56
--- src/usr.sbin/iostat/iostat.c:1.55	Sat Jan  8 02:36:52 2011
+++ src/usr.sbin/iostat/iostat.c	Sun Jan  9 02:40:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.55 2011/01/08 02:36:52 jakllsch Exp $	*/
+/*	$NetBSD: iostat.c,v 1.56 2011/01/09 02:40:19 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = @(#)iostat.c	8.3 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: iostat.c,v 1.55 2011/01/08 02:36:52 jakllsch Exp $);
+__RCSID($NetBSD: iostat.c,v 1.56 2011/01/09 02:40:19 jakllsch Exp $);
 #endif
 #endif /* not lint */
 
@@ -326,7 +326,8 @@
 			1024.0) / (cur.rxfer[dn] + cur.wxfer[dn]);
 		else
 			mbps = 0.0;
-		(void)printf( %5.2f, mbps);
+		(void)printf( %5.*f ,
+		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
 
 	/* average transfers per second. */
 		(void)printf( %4.0f,
@@ -344,7 +345,7 @@
 			mbps = 0;
 		mbps /= etime;
 		(void)printf( %5.*f ,
-		MAX(0,3-(int)floor(log10(fabs(MAX(1.0,mbps), mbps);
+		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
 	}
 }
 



CVS commit: src/usr.sbin/iostat

2011-01-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan  9 03:35:23 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
Fix copy/paste error that resulted in a extra space after the KB/t column.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.56 src/usr.sbin/iostat/iostat.c:1.57
--- src/usr.sbin/iostat/iostat.c:1.56	Sun Jan  9 02:40:19 2011
+++ src/usr.sbin/iostat/iostat.c	Sun Jan  9 03:35:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.56 2011/01/09 02:40:19 jakllsch Exp $	*/
+/*	$NetBSD: iostat.c,v 1.57 2011/01/09 03:35:23 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = @(#)iostat.c	8.3 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: iostat.c,v 1.56 2011/01/09 02:40:19 jakllsch Exp $);
+__RCSID($NetBSD: iostat.c,v 1.57 2011/01/09 03:35:23 jakllsch Exp $);
 #endif
 #endif /* not lint */
 
@@ -326,7 +326,7 @@
 			1024.0) / (cur.rxfer[dn] + cur.wxfer[dn]);
 		else
 			mbps = 0.0;
-		(void)printf( %5.*f ,
+		(void)printf( %5.*f,
 		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
 
 	/* average transfers per second. */



CVS commit: src/usr.sbin/iostat

2011-01-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan  9 02:40:19 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
NetBSD/vax libm now has fmax, use it again.
Also, display average transfer size using dynamic precision too.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2011-01-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan  9 03:35:23 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
Fix copy/paste error that resulted in a extra space after the KB/t column.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2011-01-07 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Jan  8 02:36:52 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
NetBSD/vax does not implement fmax(3), substitute with existing MAX() macro.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.54 src/usr.sbin/iostat/iostat.c:1.55
--- src/usr.sbin/iostat/iostat.c:1.54	Fri Jan  7 03:12:27 2011
+++ src/usr.sbin/iostat/iostat.c	Sat Jan  8 02:36:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.54 2011/01/07 03:12:27 jakllsch Exp $	*/
+/*	$NetBSD: iostat.c,v 1.55 2011/01/08 02:36:52 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = @(#)iostat.c	8.3 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: iostat.c,v 1.54 2011/01/07 03:12:27 jakllsch Exp $);
+__RCSID($NetBSD: iostat.c,v 1.55 2011/01/08 02:36:52 jakllsch Exp $);
 #endif
 #endif /* not lint */
 
@@ -344,7 +344,7 @@
 			mbps = 0;
 		mbps /= etime;
 		(void)printf( %5.*f ,
-		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
+		MAX(0,3-(int)floor(log10(fabs(MAX(1.0,mbps), mbps);
 	}
 }
 



CVS commit: src/usr.sbin/iostat

2011-01-07 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Jan  8 02:36:52 UTC 2011

Modified Files:
src/usr.sbin/iostat: iostat.c

Log Message:
NetBSD/vax does not implement fmax(3), substitute with existing MAX() macro.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/iostat

2011-01-06 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Jan  7 03:12:27 UTC 2011

Modified Files:
src/usr.sbin/iostat: Makefile iostat.c

Log Message:
Maintain 5-character width of MB/s column by dynamically adjusting the
decimal precision.

This should work until disk transfer rates exceed 9 MB/s.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/iostat/Makefile
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/Makefile
diff -u src/usr.sbin/iostat/Makefile:1.23 src/usr.sbin/iostat/Makefile:1.24
--- src/usr.sbin/iostat/Makefile:1.23	Fri Apr 21 13:46:37 2006
+++ src/usr.sbin/iostat/Makefile	Fri Jan  7 03:12:27 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.23 2006/04/21 13:46:37 yamt Exp $
+#	$NetBSD: Makefile,v 1.24 2011/01/07 03:12:27 jakllsch Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include bsd.own.mk
@@ -13,7 +13,7 @@
 # drvstats.c pulled in from ../../usr.bin/vmstat
 SRCS=	drvstats.c iostat.c
 
-DPADD=	${LIBKVM}
-LDADD=	-lkvm
+DPADD=	${LIBKVM} ${LIBM}
+LDADD=	-lkvm -lm
 
 .include bsd.prog.mk

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.53 src/usr.sbin/iostat/iostat.c:1.54
--- src/usr.sbin/iostat/iostat.c:1.53	Wed Apr 15 10:05:41 2009
+++ src/usr.sbin/iostat/iostat.c	Fri Jan  7 03:12:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.53 2009/04/15 10:05:41 lukem Exp $	*/
+/*	$NetBSD: iostat.c,v 1.54 2011/01/07 03:12:27 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = @(#)iostat.c	8.3 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: iostat.c,v 1.53 2009/04/15 10:05:41 lukem Exp $);
+__RCSID($NetBSD: iostat.c,v 1.54 2011/01/07 03:12:27 jakllsch Exp $);
 #endif
 #endif /* not lint */
 
@@ -87,6 +87,7 @@
 #include stdlib.h
 #include string.h
 #include unistd.h
+#include math.h
 
 #include drvstats.h
 
@@ -99,6 +100,8 @@
 static int	winlines = 20;
 static int	wincols = 80;
 
+#define	MAX(a,b)	(((a)(b))?(a):(b))
+
 #define	ISSET(x, a)	((x)  (a))
 #define	SHOW_CPU	(10)
 #define	SHOW_TTY	(11)
@@ -339,7 +342,9 @@
 			(double)(1024 * 1024);
 		else
 			mbps = 0;
-		(void)printf( %5.2f , mbps / etime);
+		mbps /= etime;
+		(void)printf( %5.*f ,
+		MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps), mbps);
 	}
 }
 



CVS commit: src/usr.sbin/iostat

2011-01-06 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Jan  7 03:12:27 UTC 2011

Modified Files:
src/usr.sbin/iostat: Makefile iostat.c

Log Message:
Maintain 5-character width of MB/s column by dynamically adjusting the
decimal precision.

This should work until disk transfer rates exceed 9 MB/s.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/iostat/Makefile
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.