From owner-freebsd-hackers@FreeBSD.ORG Tue Sep 18 11:15:26 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D548106564A for ; Tue, 18 Sep 2012 11:15:26 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by mx1.freebsd.org (Postfix) with ESMTP id AD3B98FC08 for ; Tue, 18 Sep 2012 11:15:25 +0000 (UTC) Received: by wibhi8 with SMTP id hi8so3027658wib.13 for ; Tue, 18 Sep 2012 04:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=9DGX+uJIsFSEf7XRfMFdkDI/cTUk8PuN3Pptf0cdMNg=; b=se2dSoTXAm2C9V63Cd2btXNoE4u47VKyKIOCurse1c8nENwZfP+BwHY2HfP60AzKiT T/RnUjvkStoAeph4Jo5Azl8ax+kG9/2pjLpgIseHpdoCnqLZ/ZLGv8xp/c2szg+eRmsZ mXqryhp1LE1GISWY8AeSTwffAUPMsRdfew3akP/CAxfAYLNvt741BsAYLUReWzhvY0fD w71UeU/GAlo+reBA4S5aL3s43qaJ1w+GU5sFjUN+zYpgG4tqT0P2HIgJnmM04/Ab9xfW 7CCmKbIZpLJ9kz1o8nFtDbxc1hyVsxT4dAuHVYGllY7ONsKR31mTWjLMuOpUlkfvCrGJ zEmw== Received: by 10.181.13.164 with SMTP id ez4mr22579450wid.21.1347966924362; Tue, 18 Sep 2012 04:15:24 -0700 (PDT) Received: from localhost ([95.69.174.83]) by mx.google.com with ESMTPS id cu1sm22311343wib.6.2012.09.18.04.15.22 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Sep 2012 04:15:23 -0700 (PDT) Sender: Mikolaj Golub Date: Tue, 18 Sep 2012 14:15:20 +0300 From: Mikolaj Golub To: freebsd-hackers@freebsd.org Message-ID: <20120918111519.GB66984@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Changing `iostat -Ix' output X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2012 11:15:26 -0000 Hi, I don't like very much what `iostat -Ix' outputs and would like to change this. A typical output: % iostat -Ix extended device statistics device r/i w/i kr/i kw/i qlen svc_t %b ada0 5599136.0 3953193.0 39982760.0 86819866.5 0 15.1 16 cd0 552.0 0.0 4.3 0.0 0 0.0 0 pass0 333.0 0.0 166.5 0.0 0 0.0 0 pass1 2.0 0.0 1.0 0.0 0 0.0 0 Parameters like r/i, kr/i (total io operations/kbytes) are very useful. They allow to use `iostat -Ix' to collect IO statistics running it periodically (from cron or some monitoring tool) and calculate average amount of operations or bytes per second at the specified period subtracting the current value from the previous one and dividing by time period. But you can't do the same with % busy, which is very useful IO characteristics. Average % busy at the specified period could be calculated storing total busy time for the device at time t1, total busy time at t2 and then subtracting the last value from the first (to get busy time at this period) and dividing by the time period. Currently iostat(8) does not provide 'total busy time' statistics. I use sysutils/devstat for this but it would be nice if iostat(8) itself provide such functionality. I propose for `iostat -Ix` to output total busy time instead of % busy, and also total duration of transactions instead of average duration (to be able to calculate average duration for the period between two iostat runs). http://people.freebsd.org/~trociny/iostat.total_busy_time.1.patch Average duration and % busy are still available via `iostat -x`. Here is an output example % ./iostat -Ix; sleep 60; ./iostat -Ix extended device statistics device r/i w/i kr/i kw/i qlen tdur sb ada0 5599785.0 3961913.0 39985960.5 86902385.5 0 144055.5 35966.5 cd0 554.0 0.0 4.3 0.0 0 0.0 9.5 pass0 336.0 0.0 168.0 0.0 0 0.0 17.5 pass1 2.0 0.0 1.0 0.0 0 0.0 0.0 extended device statistics device r/i w/i kr/i kw/i qlen tdur sb ada0 5599922.0 3963177.0 40002608.0 86958230.5 0 144074.4 35970.5 cd0 554.0 0.0 4.3 0.0 0 0.0 9.5 pass0 336.0 0.0 168.0 0.0 0 0.0 17.5 pass1 2.0 0.0 1.0 0.0 0 0.0 0.0 So, for ada0, % busy for that period was 100 * (35970.5 - 35966.5) / 60 = 6. And service time (assuming that only read and write operations were serviced) was 1000 * (144074.4 - 144055.5) / (5599922 - 5599785 + 3963177 - 3961913) = 13.4 msec. What do you think about this? -- Mikolaj Golub