Commit Graph

103 Commits

Author SHA1 Message Date
mrg a0065a57e4 fix rev 1.70: -X is 1 line output, avoids printing the header too often. 2023-10-30 19:43:33 +00:00
wiz 00f0c4df28 ostat: use standard option order (AaBb...)
Fix macro usage while here
2023-07-28 12:03:33 +00:00
mrg 1101fff970 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.)
2023-07-28 09:18:58 +00:00
kre 643b5abf47 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.
2022-06-18 11:33:13 +00:00
kre 02531ad2c6 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.
2022-06-17 01:47:45 +00:00
wiz 10fabe8c03 Fix mandoc warnings. 2018-07-29 21:17:43 +00:00
sevan 0a9053f0f4 Document "in" field in CPU section
Fix ps(1) Xr raised by mandoc -Tlint
2018-07-29 17:03:02 +00:00
mlelstv 3103bce53a Re-evaluate drive selection to catch hog-plug devices. 2018-04-08 11:37:31 +00:00
mrg e7f4cf6f3c 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.
2017-09-09 23:51:58 +00:00
mlelstv 245a1a4599 Use I/O timestamps to compute disk statistics for better precision.
Disk statistics are collected in a fixed size array, that got corrupted
when a disk was detached. Adapt by skipping entries of detached disks
and detect reused disknames at the array end.
2017-07-04 21:19:33 +00:00
mlelstv ba576b71a7 Enhance disk metrics by calculating a weighted sum that is incremented
by the number of concurrent I/O requests. Also introduce a new disk_wait()
function to measure requests waiting in a bufq.
iostat -y now reports data about waiting and active requests.

So far only drivers using dksubr and dk, ccd, wd and xbd collect data about
waiting requests.
2017-03-05 23:07:12 +00:00
mrg 80a4e936b5 extend the "tout" column to 5 characters, it's really common on a modern
machine to have eg, build output way more than 9999 chars/sec.

this doesn't affect the default disk list on an 80-char wide screen.
2015-10-25 02:47:17 +00:00
mrg bdd303d7a7 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.
2015-07-09 13:26:52 +00:00
joerg 24bd8eb084 Remove KVM related options. 2014-06-11 17:01:04 +00:00
joerg 5f1d0b022e static + __dead 2011-08-30 19:06:06 +00:00
enami e8824b0da4 A number greater than or equal to 1.0 is a positive number. 2011-02-14 02:43:37 +00:00
enami 5a1e40df4f Put space after comma and around binary operator. 2011-02-14 02:42:26 +00:00
jakllsch a96fe1437c Fix copy/paste error that resulted in a extra space after the KB/t column. 2011-01-09 03:35:23 +00:00
jakllsch 65d4cff419 NetBSD/vax libm now has fmax, use it again.
Also, display average transfer size using dynamic precision too.
2011-01-09 02:40:19 +00:00
jakllsch 208ac54ed2 NetBSD/vax does not implement fmax(3), substitute with existing MAX() macro. 2011-01-08 02:36:52 +00:00
jakllsch 5637a88e80 Maintain 5-character width of MB/s column by dynamically adjusting the
decimal precision.

This should work until disk transfer rates exceed 99999 MB/s.
2011-01-07 03:12:27 +00:00
lukem 107925002e Fix -Wsign-compare issues 2009-04-15 10:05:41 +00:00
lukem 9c1945664c Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 13:36:57 +00:00
christos 5f1a365390 add parens. 2007-06-24 23:25:13 +00:00
simonb 53211cb1ae Since the swapping of tk_nin and tk_nout was moved to its own
function (tkswap()), actually call this function.

Fixes problems where the tin/tout fields showed total tty IO since
boot instead of just what has happened in the last second.
2006-07-26 03:33:02 +00:00
yamt 8613dc06f0 update a comment. 2006-04-21 13:46:37 +00:00
blymn 906131e6f3 Update to use the new kernel io statistics. 2006-04-14 13:14:57 +00:00
dsl 9f26f448bf Need to read and swap cpustats separately from the dkstats.
I wonder how many more programs use the code in vmstat/dkstats.c
2006-02-12 22:11:54 +00:00
yamt 16b7c5d1dd print a header on each outputs if and only if the output has 2 or more lines. 2006-02-12 11:23:31 +00:00
yamt 895fec49e1 reset hdrcnt whenever printing a header. 2006-01-08 08:47:16 +00:00
blymn 132bb1fe89 Add tape statistics. 2005-08-07 12:32:38 +00:00
mrg d6989eccf4 apply the patch from PR#30680: always print the header in extended
(-x) mode, as it is much easier to see what is going on.
2005-07-07 22:31:45 +00:00
dsl cfe7f80ff0 Add (unsigned char) cast to ctype functions 2004-10-29 20:51:11 +00:00
dbj c4278791eb for -x -I output, use just MB instead of MB/s in header 2004-02-25 03:39:14 +00:00
wiz d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
agc 326b2259b7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22366, verified by myself.
2003-08-07 11:25:11 +00:00
mrg 134561f7df - convert header() away from a signal function (it does all sorts of stdio
and more) and use a little sig_header() helper.
- in selectdrives() make sure we don't overwrite some arrays.  this makes
"iostat 1" work again on my really wide screens where defdrives (number that
can fit) was > ndrives (number of drives), rather than dump core trying to
print (char *)1...
2003-08-04 01:05:44 +00:00
simonb c71be29ffd Use the terminal width to choose the default number of drives listed.
Suggested by matt green and (indirectly) enami tsugutomo.
2003-07-02 13:47:57 +00:00
simonb 329fb18071 Pinch code from vmstat to get the number of lines of the terminal, and
show the header once per screen instead of fixed at every 22 lines.
2003-07-02 13:20:14 +00:00
simonb 2f35689ef7 Bump the width of the MB/s and t/s fields and show only 3 drives by
default.  The default display now fits in 80 columns, and looks much
better on modern systems.
2003-07-02 08:35:48 +00:00
drochner 96b62d8a69 no need to #include <sys/dkstat.h> 2003-06-11 17:26:31 +00:00
wiz 1f2ca5e686 Increase width now we mention flag arguments. 2003-05-01 15:29:24 +00:00
jmmv bee0be0e17 In the options list, show which ones require an argument.
New sentence, new line.
2003-05-01 15:10:58 +00:00
wiz c434363e30 Bump date for recent change. 2003-03-17 08:16:10 +00:00
enami 70378aeac7 - Account the number of lines consumed so that -xw displays header
frequently enough.
- As we are initializing dk_select to 0 (via dkinit), no need to check it.
- Re-order the code in display() to highlight the fact that -x is
  exclusive with others.
- If user really specified some drives and none of them are found,
  just bail out rather than falling back to default behaviour.
- Other misc. cosmetic changes while I'm here.
2003-03-01 07:40:58 +00:00
enami 51a7567d63 Sync with the behaviour change. 2003-03-01 07:35:41 +00:00
christos d0ee51001e PR/20435: KOIE Hidetaka: iostat -x ignores drive selection. 2003-03-01 05:38:11 +00:00
enami 0ad4042cc2 ... and fix typos which makes wrong display. 2002-11-02 06:35:30 +00:00
enami a65c9b21f2 Cosmetic changes. 2002-11-02 06:32:10 +00:00
simonb c79652b287 Print a newline between lines in -x mode. 2002-11-01 14:02:21 +00:00