From owner-freebsd-bugs@FreeBSD.ORG Thu May 10 06:30:05 2007 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 [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7DB7516A402 for ; Thu, 10 May 2007 06:30:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 608AA13C455 for ; Thu, 10 May 2007 06:30:05 +0000 (UTC) (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 l4A6U5ma044273 for ; Thu, 10 May 2007 06:30:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l4A6U5Of044272; Thu, 10 May 2007 06:30:05 GMT (envelope-from gnats) Resent-Date: Thu, 10 May 2007 06:30:05 GMT Resent-Message-Id: <200705100630.l4A6U5Of044272@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, Dan Nelson Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4BB0916A400 for ; Thu, 10 May 2007 06:23:10 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.freebsd.org (Postfix) with ESMTP id 1669613C45D for ; Thu, 10 May 2007 06:23:00 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.1/8.13.8) id l4A6C6rA016282; Thu, 10 May 2007 01:12:06 -0500 (CDT) (envelope-from dan) Message-Id: <200705100612.l4A6C6rA016282@dan.emsphone.com> Date: Thu, 10 May 2007 01:12:06 -0500 (CDT) From: Dan Nelson To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/112559: [PATCH] make iostat -Ix work 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: Thu, 10 May 2007 06:30:05 -0000 >Number: 112559 >Category: bin >Synopsis: [PATCH] make iostat -Ix work >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu May 10 06:30:04 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Dan Nelson >Release: FreeBSD 6.2-STABLE i386 >Organization: The Allant Group >Environment: System: FreeBSD dan.emsphone.com 6.2-STABLE FreeBSD 6.2-STABLE #434: Wed Jan 24 11:11:58 CST 2007 zsh@dan.emsphone.com:/usr/src-6/sys/i386/compile/DANSMP i386 >Description: The code to print the extended device stats doesn't take the -I flag into account. >How-To-Repeat: >Fix: With the following patch, "iostat -xI" will print per-interval I/O statistics instead of per-second ones (which means the first line shows totals since boot). Applies cleanly to HEAD and RELENG-6. Index: iostat.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/iostat/iostat.c,v retrieving revision 1.32 diff -u -p -r1.32 iostat.c --- iostat.c 6 Feb 2007 20:29:40 -0000 1.32 +++ iostat.c 10 May 2007 06:02:03 -0000 @@ -656,6 +656,8 @@ devstats(int perf_select, long double et long double transfers_per_second, transfers_per_second_read, transfers_per_second_write; long double kb_per_transfer, mb_per_second, mb_per_second_read, mb_per_second_write; u_int64_t total_bytes, total_transfers, total_blocks; + u_int64_t total_bytes_read, total_transfers_read; + u_int64_t total_bytes_write, total_transfers_write; long double busy_pct; u_int64_t queue_len; long double total_mb; @@ -670,7 +672,10 @@ devstats(int perf_select, long double et if (Cflag > 0) printf(" cpu "); printf("\n"); - printf("device r/s w/s kr/s kw/s wait svc_t %%b "); + if (Iflag == 0) + printf("device r/s w/s kr/s kw/s wait svc_t %%b "); + else + printf("device r/i w/i kr/i kw/i wait svc_t %%b "); if (Tflag > 0) printf("tin tout "); if (Cflag > 0) @@ -690,7 +695,11 @@ devstats(int perf_select, long double et if (devstat_compute_statistics(&cur.dinfo->devices[di], havelast ? &last.dinfo->devices[di] : NULL, etime, DSM_TOTAL_BYTES, &total_bytes, + DSM_TOTAL_BYTES_READ, &total_bytes_read, + DSM_TOTAL_BYTES_WRITE, &total_bytes_write, DSM_TOTAL_TRANSFERS, &total_transfers, + DSM_TOTAL_TRANSFERS_READ, &total_transfers_read, + DSM_TOTAL_TRANSFERS_WRITE, &total_transfers_write, DSM_TOTAL_BLOCKS, &total_blocks, DSM_KB_PER_TRANSFER, &kb_per_transfer, DSM_TRANSFERS_PER_SECOND, &transfers_per_second, @@ -731,12 +740,21 @@ devstats(int perf_select, long double et mb_per_second_read > ((long double).0005)/1024 || mb_per_second_write > ((long double).0005)/1024 || busy_pct > 0.5) { - printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4qu %5.1Lf %3.0Lf ", - devname, transfers_per_second_read, - transfers_per_second_write, - mb_per_second_read * 1024, - mb_per_second_write * 1024, queue_len, - ms_per_transaction, busy_pct); + if (Iflag == 0) + printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4qu %5.1Lf %3.0Lf ", + devname, transfers_per_second_read, + transfers_per_second_write, + mb_per_second_read * 1024, + mb_per_second_write * 1024, queue_len, + ms_per_transaction, busy_pct); + else + printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4qu %5.1Lf %3.0Lf ", + devname, (long double)total_transfers_read, + (long double)total_transfers_write, + (long double)total_bytes_read / 1024, + (long double)total_bytes_write / 1024, queue_len, + ms_per_transaction, busy_pct); + if (firstline) { /* * If this is the first device >Release-Note: >Audit-Trail: >Unformatted: