From owner-freebsd-bugs@FreeBSD.ORG Wed Dec 28 21:20:04 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9E02116A41F for ; Wed, 28 Dec 2005 21:20:04 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0EC7643D55 for ; Wed, 28 Dec 2005 21:20:04 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id jBSLK3xe042730 for ; Wed, 28 Dec 2005 21:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id jBSLK3Hb042729; Wed, 28 Dec 2005 21:20:03 GMT (envelope-from gnats) Resent-Date: Wed, 28 Dec 2005 21:20:03 GMT Resent-Message-Id: <200512282120.jBSLK3Hb042729@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Robert Cousins Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9044816A41F for ; Wed, 28 Dec 2005 21:16:39 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 032AF43D46 for ; Wed, 28 Dec 2005 21:16:39 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id jBSLGcG9059202 for ; Wed, 28 Dec 2005 21:16:38 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id jBSLGcNW059201; Wed, 28 Dec 2005 21:16:38 GMT (envelope-from nobody) Message-Id: <200512282116.jBSLGcNW059201@www.freebsd.org> Date: Wed, 28 Dec 2005 21:16:38 GMT From: Robert Cousins To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: bin/91034: minor fix to iostat so that columns line up with 128KB xfers X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2005 21:20:04 -0000 >Number: 91034 >Category: bin >Synopsis: minor fix to iostat so that columns line up with 128KB xfers >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Dec 28 21:20:03 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Robert Cousins >Release: 6.0 >Organization: Cousins Consulting >Environment: FreeBSD hammer.home.rcousins.com 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Tue Dec 13 17:37:31 PST 2005 rec@hammer.home.rcousins.com:/usr/src/sys/amd64/compile/HAMMER amd64 >Description: Iostat's output can be kind of ugly under USF2 with 128KB transfers. Here is an example: tty ad0 ad1 cpu tin tout KB/t tps MB/s KB/t tps MB/s us ni sy in id 0 60 0.00 0 0.00 0.00 0 0.00 50 0 0 0 50 0 180 0.00 0 0.00 128.00 8 1.00 48 0 0 0 51 0 61 0.00 0 0.00 0.00 0 0.00 50 0 0 0 50 0 60 0.00 0 0.00 0.00 0 0.00 49 0 0 0 51 The problem comes from the KB/t column which goes one character too wide. The patch I'm submitting notices when this value is >= 100 and drops from 2 decimals to 1 in this case. The result is an output like this: tty ad0 ad1 cpu tin tout KB/t tps MB/s KB/t tps MB/s us ni sy in id 0 60 0.00 0 0.00 0.00 0 0.00 50 0 0 0 50 0 180 0.00 0 0.00 128.0 8 1.00 48 0 0 0 51 0 61 0.00 0 0.00 0.00 0 0.00 50 0 0 0 50 0 60 0.00 0 0.00 0.00 0 0.00 49 0 0 0 51 I find this much easier to read. (A better fix would be to drop down to 1 decimal digit for all values but I figured that would be up to you, not me.) >How-To-Repeat: Run 'iostat 1' on any machine with periodic (bursty) I/O on a file system. The results will be as shown above. >Fix: My fix is trivial but functional. You probably have a better way to do it. *** old_iostat.c Wed Dec 28 13:01:20 2005 --- iostat.c Wed Dec 28 13:02:21 2005 *************** *** 696,707 **** msdig, ms_per_transaction); } else { ! if (Iflag == 0) printf(" %5.2Lf %3.0Lf %5.2Lf ", kb_per_transfer, transfers_per_second, mb_per_second); ! else { total_mb = total_bytes; total_mb /= 1024 * 1024; --- 696,713 ---- msdig, ms_per_transaction); } else { ! if (Iflag == 0) { ! if (kb_per_transfer < 100.) printf(" %5.2Lf %3.0Lf %5.2Lf ", kb_per_transfer, transfers_per_second, mb_per_second); ! else ! printf(" %5.1Lf %3.0Lf %5.2Lf ", ! kb_per_transfer, ! transfers_per_second, ! mb_per_second); ! } else { total_mb = total_bytes; total_mb /= 1024 * 1024; >Release-Note: >Audit-Trail: >Unformatted: