From dan@dan.emsphone.com  Thu Aug 22 09:16:15 2002
Return-Path: <dan@dan.emsphone.com>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 41EDA37B400
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Aug 2002 09:16:15 -0700 (PDT)
Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B623743E72
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Aug 2002 09:16:14 -0700 (PDT)
	(envelope-from dan@dan.emsphone.com)
Received: (from dan@localhost)
	by dan.emsphone.com (8.12.5/8.12.5) id g7MGGDMm072702;
	Thu, 22 Aug 2002 11:16:13 -0500 (CDT)
	(envelope-from dan)
Message-Id: <200208221616.g7MGGDMm072702@dan.emsphone.com>
Date: Thu, 22 Aug 2002 11:16:13 -0500 (CDT)
From: Dan Nelson <dnelson@allantgroup.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] Add queue depth to systat -v disk table
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         41902
>Category:       bin
>Synopsis:       [PATCH] Add queue depth to systat -v disk table
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 22 09:20:02 PDT 2002
>Closed-Date:    Mon Jun 14 21:54:03 GMT 2004
>Last-Modified:  Mon Jun 14 21:54:03 GMT 2004
>Originator:     Dan Nelson
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
The Allant Group
>Environment:
System: FreeBSD dan.emsphone.com 5.0-CURRENT FreeBSD 5.0-CURRENT #181: Thu Jul 25 14:15:12 CDT 2002 zsh@dan.emsphone.com:/usr/src/sys/i386/compile/DANSMP i386



It's often useful to know the CTQ depth of your drives when they're
being used.  The following patch adds that to systat -v output.

Disks   da0   cd0   cd1   fd0 pass0 pass1 pass2           intrn
KB/t   5.92  0.00  0.00  0.00  0.00  0.00  0.00    114064 buf
tps     102     0     0     0     0     0     0       809 dirtybuf
MB/s   0.59  0.00  0.00  0.00  0.00  0.00  0.00     65950 desiredvnodes
% busy   40     0     0     0     0     0     0     65978 numvnodes
queued   11     0     0     0     0     0     0     37194 freevnodes

Index: vmstat.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/systat/vmstat.c,v
retrieving revision 1.52
diff -u -p -r1.52 vmstat.c
--- vmstat.c	6 Jun 2002 23:01:50 -0000	1.52
+++ vmstat.c	22 Aug 2002 15:47:05 -0000
@@ -337,12 +337,7 @@ labelkre()
 	mvprintw(DISKROW + 2, DISKCOL, "tps");
 	mvprintw(DISKROW + 3, DISKCOL, "MB/s");
 	mvprintw(DISKROW + 4, DISKCOL, "%% busy");
-	/*
-	 * For now, we don't support a fourth disk statistic.  So there's
-	 * no point in providing a label for it.  If someone can think of a
-	 * fourth useful disk statistic, there is room to add it.
-	 */
-	/* mvprintw(DISKROW + 4, DISKCOL, " msps"); */
+	mvprintw(DISKROW + 5, DISKCOL, "queued");
 	j = 0;
 	for (i = 0; i < num_devices && j < MAXDRIVES; i++)
 		if (dev_select[i].selected) {
@@ -848,6 +843,7 @@ dinfo(dn, lc, now, then)
 	long double transfers_per_second;
 	long double kb_per_transfer, mb_per_second;
 	long double elapsed_time, device_busy;
+	long double busy_count;
 	int di;
 
 	di = dev_select[dn].position;
@@ -859,6 +855,8 @@ dinfo(dn, lc, now, then)
 	    then ? then->dinfo->devices[di].busy_time :
 	    now->dinfo->devices[di].dev_creation_time);
 
+	busy_count = now->dinfo->devices[di].busy_count;
+
 	if (devstat_compute_statistics(&now->dinfo->devices[di], then ?
 	    &then->dinfo->devices[di] : NULL, elapsed_time,
 	    DSM_KB_PER_TRANSFER, &kb_per_transfer, DSM_TRANSFERS_PER_SECOND,
@@ -881,4 +879,5 @@ dinfo(dn, lc, now, then)
 	putlongdouble(transfers_per_second, DISKROW + 2, lc, 5, 0, 0);
 	putlongdouble(mb_per_second, DISKROW + 3, lc, 5, 2, 0);
 	putlongdouble(device_busy * 100 / elapsed_time, DISKROW + 4, lc, 5, 0, 0);
+	putlongdouble(busy_count, DISKROW + 5, lc, 5, 0, 0);
 }
>Description:
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:

From: Dan Nelson <dnelson@allantgroup.com>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: bin/41902: [PATCH] Add queue depth to systat -v disk table
Date: Thu, 22 Aug 2002 11:25:47 -0500

 And here's the same patch for -STABLE:
 
 Index: vmstat.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/systat/vmstat.c,v
 retrieving revision 1.38.2.4
 diff -u -p -r1.38.2.4 vmstat.c
 --- vmstat.c	12 Mar 2002 19:50:23 -0000	1.38.2.4
 +++ vmstat.c	22 Aug 2002 16:17:10 -0000
 @@ -340,12 +336,7 @@ labelkre()
  	mvprintw(DISKROW + 2, DISKCOL, "tps");
  	mvprintw(DISKROW + 3, DISKCOL, "MB/s");
  	mvprintw(DISKROW + 4, DISKCOL, "%% busy");
 -	/*
 -	 * For now, we don't support a fourth disk statistic.  So there's
 -	 * no point in providing a label for it.  If someone can think of a
 -	 * fourth useful disk statistic, there is room to add it.
 -	 */
 -	/* mvprintw(DISKROW + 4, DISKCOL, " msps"); */
 +	mvprintw(DISKROW + 5, DISKCOL, "queued");
  	j = 0;
  	for (i = 0; i < num_devices && j < MAXDRIVES; i++)
  		if (dev_select[i].selected) {
 @@ -813,6 +804,7 @@ dinfo(dn, c, now, then)
  	long double transfers_per_second;
  	long double kb_per_transfer, mb_per_second;
  	long double elapsed_time, device_busy;
 +	long double busy_count;
  	int di;
  
  	di = dev_select[dn].position;
 @@ -825,6 +817,8 @@ dinfo(dn, c, now, then)
  				     then->dinfo->devices[di].busy_time :
  				     now->dinfo->devices[di].dev_creation_time);
  
 + 	busy_count = now->dinfo->devices[di].busy_count;
 + 
  	if (compute_stats(&now->dinfo->devices[di], then ?
  			  &then->dinfo->devices[di] : NULL, elapsed_time,
  			  NULL, NULL, NULL,
 @@ -847,4 +841,5 @@ dinfo(dn, c, now, then)
  	putlongdouble(transfers_per_second, DISKROW + 2, c, 5, 0, 0);
  	putlongdouble(mb_per_second, DISKROW + 3, c, 5, 2, 0);
  	putlongdouble(device_busy * 100 / elapsed_time, DISKROW + 4, c, 5, 0, 0);
 +	putlongdouble(busy_count, DISKROW + 5, c, 5, 0, 0);
  }
State-Changed-From-To: open->closed 
State-Changed-By: bms 
State-Changed-When: Mon Jun 14 21:53:46 GMT 2004 
State-Changed-Why:  
Superceded by gstat(8). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41902 
>Unformatted:
