home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!sdd.hp.com!think.com!cayman!brad
- From: brad@cuba.cayman (Brad Parker)
- Newsgroups: comp.unix.bsd
- Subject: iostat & wd.c (small patch)
- Message-ID: <BRAD.92Sep6134203@cuba.cayman>
- Date: 6 Sep 92 17:42:03 GMT
- Sender: news@cayman.COM
- Organization: You must be kidding...
- Lines: 250
- Nntp-Posting-Host: cuba
-
-
- I was curious how my two IDE drives where doing under 386BSD, so I
- added missing support for some kernel globals used by iostat. I also
- changed the stock net2 iostat to report "kbytes" like sunos.
-
- I did not get "msps" (ms per seek) working since I don't know how to
- eastimate the "words per second" rate of an IDE drive. The calculation
- seems a bit hokey to me anyway i.e.
-
- busy_time - known_xfer_rate_per_wds*words_xfered -> "seek" overhead
-
- This seems like an "interesting" number but I don't get how to
- calculate the known xfer rate since this is highly cpu dependant for a
- non-dma IDE controller (right?). If I'm lost or clueless on this,
- please send me a note. I'm not very IDE literate.
-
- I verifed the resulting numbers with a little test program and a known
- MS-DOS disk speed checker. I got between 300kbytes/sec and 900kbytes/sec
- depending on the size of the "userland" i/o request (this, to the raw
- device, of course).
-
- -brad
-
- diff -c -r1.2 wd.c
- *** /tmp/,RCSt1000115 Sun Sep 6 13:27:01 1992
- --- wd.c Sun Sep 6 10:22:41 1992
- ***************
- *** 54,59 ****
- --- 54,60 ----
- #include "uio.h"
- #include "malloc.h"
- #include "machine/cpu.h"
- + #include "sys/dkstat.h"
- #include "i386/isa/isa_device.h"
- #include "i386/isa/icu.h"
- #include "i386/isa/wdreg.h"
- ***************
- *** 430,435 ****
- --- 431,444 ----
- wdtab.b_active = 1; /* mark controller active */
- wdc = du->dk_port;
-
- + /* instrumentation */
- + if (du->dk_unit >= 0 && du->dk_skip == 0) {
- + dk_busy |= 1 << du->dk_unit;
- + ++dk_seek[du->dk_unit];
- + ++dk_xfer[du->dk_unit];
- + dk_wds[du->dk_unit] += bp->b_bcount >> 6;
- + }
- +
- /* if starting a multisector transfer, or doing single transfers */
- if (du->dk_skip == 0 || (du->dk_flags & DKFL_SINGLE)) {
- if (wdtab.b_errcnt && (bp->b_flags & B_READ) == 0)
- ***************
- *** 598,603 ****
- --- 607,616 ----
-
- wdxfer[du->dk_unit]++;
- if (wdtab.b_active) {
- +
- + if (du->dk_unit >= 0)
- + dk_busy &=~ (1 << du->dk_unit);
- +
- if ((bp->b_flags & B_ERROR) == 0) {
- du->dk_skip++; /* Add to successful sectors. */
- if (wdtab.b_errcnt && (du->dk_flags & DKFL_QUIET) == 0)
- diff -c -r1.1 iostat.c
- *** /tmp/,RCSt1000121 Sun Sep 6 13:27:50 1992
- --- iostat.c Sun Sep 6 11:01:56 1992
- ***************
- *** 311,317 ****
- (void)printf(" cpu\n tin tout");
- for (i = 0; i < dk_ndrive; i++)
- if (dr_select[i])
- ! (void)printf(" sps tps msps ");
- (void)printf(" us ni sy id\n");
- }
-
- --- 311,317 ----
- (void)printf(" cpu\n tin tout");
- for (i = 0; i < dk_ndrive; i++)
- if (dr_select[i])
- ! (void)printf(" bps tps msps ");
- (void)printf(" us ni sy id\n");
- }
-
- ***************
- *** 324,333 ****
- for (dn = 0; dn < dk_ndrive; ++dn) {
- if (!dr_select[dn])
- continue;
- ! words = cur.dk_wds[dn] * 32; /* words xfer'd */
- ! (void)printf("%4.0f", /* sectors */
- ! words / (DEV_BSIZE / 2) / etime);
-
- (void)printf("%4.0f", cur.dk_xfer[dn] / etime);
-
- if (dk_wpms[dn] && cur.dk_xfer[dn]) {
- --- 324,334 ----
- for (dn = 0; dn < dk_ndrive; ++dn) {
- if (!dr_select[dn])
- continue;
- ! words = cur.dk_wds[dn] * 32; /* words = 32*64 byte xfer's */
- ! (void)printf("%4.0f", /* kbytes/second */
- ! (words / 512) / etime);
-
- + /* transfers/second */
- (void)printf("%4.0f", cur.dk_xfer[dn] / etime);
-
- if (dk_wpms[dn] && cur.dk_xfer[dn]) {
- ***************
- *** 342,347 ****
- --- 343,357 ----
- } else
- msps = 0;
- (void)printf("%5.1f ", msps);
- +
- + #ifdef DEBUG
- + if (dn == 1) {
- + printf("\nwords %.2f, dk_wpms %d\n",
- + words, dk_wpms[dn]);
- + printf("etime %.2f, atime %.2f, xtime %.2f, itime %.2f\n",
- + etime, atime, xtime, itime);
- + }
- + #endif
- }
- }
-
- Return-Path: root@faster
- Delivery-Date: Sun, 06 Sep 92 13:28:39 -0400
- Return-Path: root@faster
- Return-Path: <root@faster>
- Received: from faster by stemwinder (4.1/SMI-4.1)
- id AA02174; Sun, 6 Sep 92 13:28:38 EDT
- Received: by faster (AA00143); Sun, 6 Sep 92 13:30:49 -0400
- Date: Sun, 6 Sep 92 13:30:49 -0400
- From: Charlie Root <root@faster>
- Message-Id: <9209061730.AA00143@faster>
- To: brad@stemwinder
-
-
- diff -c -r1.2 wd.c
- *** /tmp/,RCSt1000115 Sun Sep 6 13:27:01 1992
- --- wd.c Sun Sep 6 10:22:41 1992
- ***************
- *** 54,59 ****
- --- 54,60 ----
- #include "uio.h"
- #include "malloc.h"
- #include "machine/cpu.h"
- + #include "sys/dkstat.h"
- #include "i386/isa/isa_device.h"
- #include "i386/isa/icu.h"
- #include "i386/isa/wdreg.h"
- ***************
- *** 430,435 ****
- --- 431,444 ----
- wdtab.b_active = 1; /* mark controller active */
- wdc = du->dk_port;
-
- + /* instrumentation */
- + if (du->dk_unit >= 0 && du->dk_skip == 0) {
- + dk_busy |= 1 << du->dk_unit;
- + ++dk_seek[du->dk_unit];
- + ++dk_xfer[du->dk_unit];
- + dk_wds[du->dk_unit] += bp->b_bcount >> 6;
- + }
- +
- /* if starting a multisector transfer, or doing single transfers */
- if (du->dk_skip == 0 || (du->dk_flags & DKFL_SINGLE)) {
- if (wdtab.b_errcnt && (bp->b_flags & B_READ) == 0)
- ***************
- *** 598,603 ****
- --- 607,616 ----
-
- wdxfer[du->dk_unit]++;
- if (wdtab.b_active) {
- +
- + if (du->dk_unit >= 0)
- + dk_busy &=~ (1 << du->dk_unit);
- +
- if ((bp->b_flags & B_ERROR) == 0) {
- du->dk_skip++; /* Add to successful sectors. */
- if (wdtab.b_errcnt && (du->dk_flags & DKFL_QUIET) == 0)
- diff -c -r1.1 iostat.c
- *** /tmp/,RCSt1000121 Sun Sep 6 13:27:50 1992
- --- iostat.c Sun Sep 6 11:01:56 1992
- ***************
- *** 311,317 ****
- (void)printf(" cpu\n tin tout");
- for (i = 0; i < dk_ndrive; i++)
- if (dr_select[i])
- ! (void)printf(" sps tps msps ");
- (void)printf(" us ni sy id\n");
- }
-
- --- 311,317 ----
- (void)printf(" cpu\n tin tout");
- for (i = 0; i < dk_ndrive; i++)
- if (dr_select[i])
- ! (void)printf(" bps tps msps ");
- (void)printf(" us ni sy id\n");
- }
-
- ***************
- *** 324,333 ****
- for (dn = 0; dn < dk_ndrive; ++dn) {
- if (!dr_select[dn])
- continue;
- ! words = cur.dk_wds[dn] * 32; /* words xfer'd */
- ! (void)printf("%4.0f", /* sectors */
- ! words / (DEV_BSIZE / 2) / etime);
-
- (void)printf("%4.0f", cur.dk_xfer[dn] / etime);
-
- if (dk_wpms[dn] && cur.dk_xfer[dn]) {
- --- 324,334 ----
- for (dn = 0; dn < dk_ndrive; ++dn) {
- if (!dr_select[dn])
- continue;
- ! words = cur.dk_wds[dn] * 32; /* words = 32*64 byte xfer's */
- ! (void)printf("%4.0f", /* kbytes/second */
- ! (words / 512) / etime);
-
- + /* transfers/second */
- (void)printf("%4.0f", cur.dk_xfer[dn] / etime);
-
- if (dk_wpms[dn] && cur.dk_xfer[dn]) {
- ***************
- *** 342,347 ****
- --- 343,357 ----
- } else
- msps = 0;
- (void)printf("%5.1f ", msps);
- +
- + #ifdef DEBUG
- + if (dn == 1) {
- + printf("\nwords %.2f, dk_wpms %d\n",
- + words, dk_wpms[dn]);
- + printf("etime %.2f, atime %.2f, xtime %.2f, itime %.2f\n",
- + etime, atime, xtime, itime);
- + }
- + #endif
- }
- }
-
- --
- A metaphor is like a simile.
-
- Brad Parker Cayman Systems, Inc., Cambridge, Ma. brad@cayman.com
-