Fri Jul 28 12:03:33 2023 UTC ()
ostat: use standard option order (AaBb...)

Fix macro usage while here


(wiz)
diff -r1.29 -r1.30 src/usr.sbin/iostat/iostat.8
diff -r1.70 -r1.71 src/usr.sbin/iostat/iostat.c

cvs diff -r1.29 -r1.30 src/usr.sbin/iostat/iostat.8 (expand / switch to unified diff)

--- src/usr.sbin/iostat/iostat.8 2023/07/28 09:18:58 1.29
+++ src/usr.sbin/iostat/iostat.8 2023/07/28 12:03:33 1.30
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: iostat.8,v 1.29 2023/07/28 09:18:58 mrg Exp $ 1.\" $NetBSD: iostat.8,v 1.30 2023/07/28 12:03:33 wiz Exp $
2.\" 2.\"
3.\" Copyright (c) 1985, 1991, 1993 3.\" Copyright (c) 1985, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
5.\" 5.\"
6.\" Redistribution and use in source and binary forms, with or without 6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions 7.\" modification, are permitted provided that the following conditions
8.\" are met: 8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright 9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer. 10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the 12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution. 13.\" documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors 14.\" 3. Neither the name of the University nor the names of its contributors
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE. 28.\" SUCH DAMAGE.
29.\" 29.\"
30.\" from: @(#)iostat.8 8.1 (Berkeley) 6/6/93 30.\" from: @(#)iostat.8 8.1 (Berkeley) 6/6/93
31.\" 31.\"
32.Dd July 28, 2023 32.Dd July 28, 2023
33.Dt IOSTAT 8 33.Dt IOSTAT 8
34.Os 34.Os
35.Sh NAME 35.Sh NAME
36.Nm iostat 36.Nm iostat
37.Nd report I/O statistics 37.Nd report I/O statistics
38.Sh SYNOPSIS 38.Sh SYNOPSIS
39.Nm 39.Nm
40.Op Fl CdDITxXyz 40.Op Fl CDdITXxyz
41.Op Fl c Ar count 41.Op Fl c Ar count
42.Op Fl H Ar height 42.Op Fl H Ar height
43.Op Fl W Ar width 43.Op Fl W Ar width
44.Op Fl w Ar wait 44.Op Fl w Ar wait
45.Op Ar drives 45.Op Ar drives
46.Sh DESCRIPTION 46.Sh DESCRIPTION
47.Nm 47.Nm
48displays kernel I/O statistics on terminal, disk and CPU operations. 48displays kernel I/O statistics on terminal, disk and CPU operations.
49By default, 49By default,
50.Nm 50.Nm
51displays one line of statistics averaged over the machine's run time. 51displays one line of statistics averaged over the machine's run time.
52The use of 52The use of
53.Fl c 53.Fl c
@@ -55,169 +55,169 @@ or @@ -55,169 +55,169 @@ or
55.Fl w 55.Fl w
56presents successive lines averaged over the 56presents successive lines averaged over the
57.Ar wait 57.Ar wait
58period. 58period.
59The 59The
60.Fl I 60.Fl I
61option causes 61option causes
62.Nm 62.Nm
63to print raw, unaveraged values (totals). 63to print raw, unaveraged values (totals).
64.Pp 64.Pp
65Only the last disk option specified 65Only the last disk option specified
66.Fl ( d , 66.Fl ( d ,
67.Fl D , 67.Fl D ,
68.Fl x , 
69.Fl X , 68.Fl X ,
 69.Fl x ,
70or 70or
71.Fl y ) 71.Fl y )
72is used. 72is used.
73.Pp 73.Pp
74The options are as follows: 74The options are as follows:
75.Bl -tag -width XNXsystemX 75.Bl -tag -width XNXsystemX
 76.It Fl C
 77Show CPU statistics.
 78This is enabled by default unless any of the
 79.Fl D ,
 80.Fl d ,
 81.Fl T ,
 82.Fl X ,
 83.Fl x ,
 84or
 85.Fl y
 86flags are used.
76.It Fl c Ar count 87.It Fl c Ar count
77Repeat the display 88Repeat the display
78.Ar count 89.Ar count
79times. 90times.
80Unless the 91Unless the
81.Fl I 92.Fl I
82flag is in effect, the first display is for the time since a reboot and 93flag is in effect, the first display is for the time since a reboot and
83each subsequent report is for the time period since the last display. 94each subsequent report is for the time period since the last display.
84If no 95If no
85.Ar wait 96.Ar wait
86interval is specified, the default is 1 second. 97interval is specified, the default is 1 second.
87.It Fl C 
88Show CPU statistics. 
89This is enabled by default unless any of the 
90.Fl d , 
91.Fl D , 
92.Fl T , 
93.Fl x , 
94.Fl X , 
95or 
96.Fl y 
97flags are used. 
98.It Fl d 
99Show disk statistics. 
100This is the default. 
101Displays 
102number of transfers per second, 
103kilobytes per transfer, 
104and 
105megabytes transferred per second. 
106Use of this flag disables the default display of CPU and tty statistics. 
107.It Fl D 98.It Fl D
108Show alternative disk statistics. 99Show alternative disk statistics.
109Displays 100Displays
110number of transfers, 101number of transfers,
111kilobytes transferred, 102kilobytes transferred,
112and 103and
113time spent in transfers, 104time spent in transfers,
114during the 105during the
115.Ar wait 106.Ar wait
116period (or since boot with 107period (or since boot with
117.Fl I ) . 108.Fl I ) .
118Use of this flag disables the default display. 109Use of this flag disables the default display.
 110.It Fl d
 111Show disk statistics.
 112This is the default.
 113Displays
 114number of transfers per second,
 115kilobytes per transfer,
 116and
 117megabytes transferred per second.
 118Use of this flag disables the default display of CPU and tty statistics.
119.It Fl H Ar height 119.It Fl H Ar height
120Set the page size (length, or height) explicitly, as the number of lines, 120Set the page size (length, or height) explicitly, as the number of lines,
121.Ar height . 121.Ar height .
122If not set, the page length is taken from the environment variable 122If not set, the page length is taken from the environment variable
123.Ev LINES 123.Ev LINES
124if set, or from the terminal (window) size, if output is to a terminal 124if set, or from the terminal (window) size, if output is to a terminal
125and its size is set, 125and its size is set,
126and otherwise defaults to 20. 126and otherwise defaults to 20.
127If explicitly set to zero, pages are considered to be infinitely long. 127If explicitly set to zero, pages are considered to be infinitely long.
128This parameter determines the frequency at which repeated headers are output. 128This parameter determines the frequency at which repeated headers are output.
129If the value is greater than zero, but too small for the header, along with 129If the value is greater than zero, but too small for the header, along with
130one output set, then a new header will be produced for each set of output. 130one output set, then a new header will be produced for each set of output.
131.It Fl I 131.It Fl I
132Show the running total values, rather than an average. 132Show the running total values, rather than an average.
133.ig ii 133.ig ii
134.It Fl i 134.It Fl i
135Like 135Like
136.Fl I 136.Fl I
137except the totals shown are those since 137except the totals shown are those since
138.Nm 138.Nm
139started running, rather than since the system booted. 139started running, rather than since the system booted.
140In this case the first output would necessarily be zero, 140In this case the first output would necessarily be zero,
141so is suppressed. 141so is suppressed.
142Consequently this option produces no output if neither 142Consequently this option produces no output if neither
143.Fl w 
144nor 
145.Fl c 143.Fl c
 144nor
 145.Fl w
146is given. 146is given.
147.ii 147.ii
148.It Fl T 148.It Fl T
149Show tty statistics. 149Show tty statistics.
150This is enabled by default unless one, or more, of the 150This is enabled by default unless one, or more, of the
151.Fl C , 151.Fl C ,
152.Fl d , 
153.Fl D , 152.Fl D ,
154.Fl x , 153.Fl d ,
155.Fl X , 154.Fl X ,
 155.Fl x ,
156or 156or
157.Fl y 157.Fl y
158flags are used. 158flags are used.
159.ig uu 159.ig uu
160.It Fl u 160.It Fl u
161When totals are being shown 161When totals are being shown
162.Pq Fl I 162.Pq Fl I
163.ig ii 163.ig ii
164.Po or 164.Po or
165.Fl i Pc 165.Fl i Pc
166.ii 166.ii
167include a column after each relevant output column 167include a column after each relevant output column
168showing the difference between this output and the previous. 168showing the difference between this output and the previous.
169These added columns will be blank in the first displayed output. 169These added columns will be blank in the first displayed output.
170.uu 170.uu
171.It Fl w Ar wait 
172Pause 
173.Ar wait 
174seconds between each display. 
175If no repeat 
176.Ar count 
177is specified, the default is infinity. 
178.It Fl W Ar width 171.It Fl W Ar width
179Set the page width explicitly, as the number of columns of characters, 172Set the page width explicitly, as the number of columns of characters,
180.Ar width . 173.Ar width .
181If not set, the page width is taken from the environment variable 174If not set, the page width is taken from the environment variable
182.Ev COLUMNS 175.Ev COLUMNS
183if set, or from the terminal (window) size, if output is to a terminal 176if set, or from the terminal (window) size, if output is to a terminal
184and its size is set, 177and its size is set,
185and otherwise defaults to 80. 178and otherwise defaults to 80.
186If explicitly set to 0, lines are considered infinitely long. 179If explicitly set to 0, lines are considered infinitely long.
187This width is used only to determine the number of drives to display 180This width is used only to determine the number of drives to display
188by default when no drive list is given. 181by default when no drive list is given.
189In other cases output will be as wide as needed to display the 182In other cases output will be as wide as needed to display the
190data requested. 183data requested.
 184.It Fl w Ar wait
 185Pause
 186.Ar wait
 187seconds between each display.
 188If no repeat
 189.Ar count
 190is specified, the default is infinity.
 191.It Fl X
 192Show limited alternative disk statistics.
 193Displays megabytes transferred, and time spent in transfers, during the
 194.Ar wait
 195period (or since boot with
 196.Fl I ) .
 197Use of this flag disables the default display.
191.It Fl x 198.It Fl x
192Show extended disk statistics. 199Show extended disk statistics.
193Each disk is displayed on a line of its own with all available 200Each disk is displayed on a line of its own with all available
194statistics. 201statistics.
195This option overrides all other display options, and all 202This option overrides all other display options, and all
196disks are displayed unless specific disk names 203disks are displayed unless specific disk names
197are provided as arguments. 204are provided as arguments.
198Additionally, separate read and write statistics are displayed. 205Additionally, separate read and write statistics are displayed.
199The 206The
200.Fl C 207.Fl C
201and 208and
202.Fl T 209.Fl T
203options are ignored with this output format. 210options are ignored with this output format.
204.It Fl X 
205Show limited alternative disk statistics. 
206Displays megabytes transferred, and time spent in transfers, during the 
207.Ar wait 
208period (or since boot with 
209.Fl I ) . 
210Use of this flag disables the default display. 
211.It Fl y 211.It Fl y
212Shows the extended statistics (as with 212Shows the extended statistics (as with
213.Fl x ) 213.Fl x )
214and additional queuing statistics. 214and additional queuing statistics.
215Output does not fit in an 80 column window. 215Output does not fit in an 80 column window.
216The 216The
217.Fl C 217.Fl C
218and 218and
219.Fl T 219.Fl T
220options are ignored with this output format. 220options are ignored with this output format.
221.It Fl z 221.It Fl z
222Replaces drive and CPU statistic outputs that are exactly zero with spaces. 222Replaces drive and CPU statistic outputs that are exactly zero with spaces.
223Note that zero values can still appear \(en this indicates a 223Note that zero values can still appear \(en this indicates a
@@ -344,22 +344,22 @@ option was added in @@ -344,22 +344,22 @@ option was added in
344Collection of queuing values and the 344Collection of queuing values and the
345.Fl y 345.Fl y
346option were added in 346option were added in
347.Nx 8.0 . 347.Nx 8.0 .
348The 348The
349.Fl X 349.Fl X
350option was added in 350option was added in
351.Nx 11.0 . 351.Nx 11.0 .
352The archaic option format: 352The archaic option format:
353.br 353.br
354.ti +3n 354.ti +3n
355.Nm 355.Nm
356.Op Ar drives ... 356.Op Ar drives ...
357.Oo Ar wait Op Ar count Oc 357.Oo Ar wait Oo Ar count Oc Oc
358.br 358.br
359remains supported (the first 359remains supported (the first
360.Ar drive 360.Ar drive
361whose name starts with a digit is taken to be the 361whose name starts with a digit is taken to be the
362.Ar wait 362.Ar wait
363period) but is deprecated, 363period) but is deprecated,
364and may be removed in a future version, 364and may be removed in a future version,
365so should not be used. 365so should not be used.

cvs diff -r1.70 -r1.71 src/usr.sbin/iostat/iostat.c (expand / switch to unified diff)

--- src/usr.sbin/iostat/iostat.c 2023/07/28 09:18:58 1.70
+++ src/usr.sbin/iostat/iostat.c 2023/07/28 12:03:33 1.71
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: iostat.c,v 1.70 2023/07/28 09:18:58 mrg Exp $ */ 1/* $NetBSD: iostat.c,v 1.71 2023/07/28 12:03:33 wiz Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 John M. Vinopal 4 * Copyright (c) 1996 John M. Vinopal
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -61,27 +61,27 @@ @@ -61,27 +61,27 @@
61 * SUCH DAMAGE. 61 * SUCH DAMAGE.
62 */ 62 */
63 63
64#include <sys/cdefs.h> 64#include <sys/cdefs.h>
65#ifndef lint 65#ifndef lint
66__COPYRIGHT("@(#) Copyright (c) 1986, 1991, 1993\ 66__COPYRIGHT("@(#) Copyright (c) 1986, 1991, 1993\
67 The Regents of the University of California. All rights reserved."); 67 The Regents of the University of California. All rights reserved.");
68#endif /* not lint */ 68#endif /* not lint */
69 69
70#ifndef lint 70#ifndef lint
71#if 0 71#if 0
72static char sccsid[] = "@(#)iostat.c 8.3 (Berkeley) 4/28/95"; 72static char sccsid[] = "@(#)iostat.c 8.3 (Berkeley) 4/28/95";
73#else 73#else
74__RCSID("$NetBSD: iostat.c,v 1.70 2023/07/28 09:18:58 mrg Exp $"); 74__RCSID("$NetBSD: iostat.c,v 1.71 2023/07/28 12:03:33 wiz Exp $");
75#endif 75#endif
76#endif /* not lint */ 76#endif /* not lint */
77 77
78#include <sys/types.h> 78#include <sys/types.h>
79#include <sys/ioctl.h> 79#include <sys/ioctl.h>
80#include <sys/sched.h> 80#include <sys/sched.h>
81#include <sys/time.h> 81#include <sys/time.h>
82 82
83#include <err.h> 83#include <err.h>
84#include <ctype.h> 84#include <ctype.h>
85#include <signal.h> 85#include <signal.h>
86#include <stdio.h> 86#include <stdio.h>
87#include <stdlib.h> 87#include <stdlib.h>
@@ -866,27 +866,27 @@ cpustats(void) @@ -866,27 +866,27 @@ cpustats(void)
866 if ((todo & SUPPRESS_ZERO) && cur.cp_time[state] == 0) { 866 if ((todo & SUPPRESS_ZERO) && cur.cp_time[state] == 0) {
867 printf(" %*s", cwidth[state], ""); 867 printf(" %*s", cwidth[state], "");
868 continue; 868 continue;
869 } 869 }
870 printf(" %*.0f", cwidth[state], 870 printf(" %*.0f", cwidth[state],
871 100. * cur.cp_time[state] / ttime); 871 100. * cur.cp_time[state] / ttime);
872 } 872 }
873} 873}
874 874
875static void 875static void
876usage(void) 876usage(void)
877{ 877{
878 878
879 (void)fprintf(stderr, "usage: iostat [-CdDITxXyz] [-c count] " 879 (void)fprintf(stderr, "usage: iostat [-CDdITXxyz] [-c count] "
880 "[-H height] [-W width] [-w wait] [drives]\n"); 880 "[-H height] [-W width] [-w wait] [drives]\n");
881 exit(1); 881 exit(1);
882} 882}
883 883
884static void 884static void
885display(int ndrives) 885display(int ndrives)
886{ 886{
887 double etime; 887 double etime;
888 888
889 /* Sum up the elapsed ticks. */ 889 /* Sum up the elapsed ticks. */
890 etime = cur.cp_etime; 890 etime = cur.cp_etime;
891 891
892 /* 892 /*