From nobody@FreeBSD.org  Tue Oct 30 07:22:40 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 97FAC16A417
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 30 Oct 2007 07:22:40 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 8698613C481
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 30 Oct 2007 07:22:40 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l9U7Md0q065927
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 30 Oct 2007 07:22:39 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.1/8.14.1/Submit) id l9U7Mdge065926;
	Tue, 30 Oct 2007 07:22:39 GMT
	(envelope-from nobody)
Message-Id: <200710300722.l9U7Mdge065926@www.freebsd.org>
Date: Tue, 30 Oct 2007 07:22:39 GMT
From: chifeng <chifeng@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: iostat can't display IO current vlaue in first line
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         117664
>Category:       amd64
>Synopsis:       iostat can't display IO current vlaue in first line
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-amd64
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 30 07:30:02 UTC 2007
>Closed-Date:    Fri Nov 02 20:04:47 UTC 2007
>Last-Modified:  Fri Nov 02 20:04:47 UTC 2007
>Originator:     chifeng
>Release:        FreeBSD6.2-Release-p8
>Organization:
Platform Computing
>Environment:
FreeBSD cnxabuild.asia.corp.platform.com 6.2-RELEASE-p8 FreeBSD 6.2-RELEASE-p8 #0: Tue Oct 16 12:32:14 CST 2007     root@xabuild.asia.corp.platform.com:/usr/obj/usr/src/sys/PLATFORM  amd64
>Description:
When I write a shell script plugin for munin, I hope get a current value of IO statistics. But iostat can't do it, it first statistics that are printed are avaraged over the system uptime. If I use "iostat -c 2 | tail -1 " command, this will wait 2s at least. 
so I think for iostat first line, 1) iostat should be display current value, 2) have a parameter to display current value at least. 

# iostat -c 5
      tty             ad2             cpu
 tin tout  KB/t tps  MB/s  us ni sy in id
   0    2 16.48   1  0.01   0  0  0  0 100
   0  130 63.63 782 48.60   0  0 14  1 85
   0  104 62.68 594 36.38   2  0 24  0 73
   0   77 62.75 663 40.63   0  0 16  0 83
   0   67 24.65 1568 37.76   0  0 18  1 80
# iostat
      tty             ad2             cpu
 tin tout  KB/t tps  MB/s  us ni sy in id
   0    2 17.52   1  0.01   0  0  0  0 100
>How-To-Repeat:
iostat command.
>Fix:
:-( I don't know how to fix it.

>Release-Note:
>Audit-Trail:

From: John Baldwin <jhb@freebsd.org>
To: freebsd-amd64@freebsd.org
Cc: chifeng <chifeng@gmail.com>, freebsd-gnats-submit@freebsd.org
Subject: Re: amd64/117664: iostat can't display IO current vlaue in first line
Date: Wed, 31 Oct 2007 13:53:35 -0400

 On Tuesday 30 October 2007 03:22:39 am chifeng wrote:
 > 
 > >Number:         117664
 > >Category:       amd64
 > >Synopsis:       iostat can't display IO current vlaue in first line
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       low
 > >Responsible:    freebsd-amd64
 > >State:          open
 > >Quarter:        
 > >Keywords:       
 > >Date-Required:
 > >Class:          change-request
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Tue Oct 30 07:30:02 UTC 2007
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     chifeng
 > >Release:        FreeBSD6.2-Release-p8
 > >Organization:
 > Platform Computing
 > >Environment:
 > FreeBSD cnxabuild.asia.corp.platform.com 6.2-RELEASE-p8 FreeBSD 
 6.2-RELEASE-p8 #0: Tue Oct 16 12:32:14 CST 2007     
 root@xabuild.asia.corp.platform.com:/usr/obj/usr/src/sys/PLATFORM  amd64
 > >Description:
 > When I write a shell script plugin for munin, I hope get a current value of 
 IO statistics. But iostat can't do it, it first statistics that are printed 
 are avaraged over the system uptime. If I use "iostat -c 2 | tail -1 " 
 command, this will wait 2s at least. 
 > so I think for iostat first line, 1) iostat should be display current value, 
 2) have a parameter to display current value at least. 
 
 There isn't a 'current value' for iostat to dump.  The kernel just keeps 
 running counts and iostat simulates a current value by saving the values each 
 time and computing a delta for each line after the first.  However, for the 
 first line there is no saved value so it cannot compute a delta.  Probably 
 you need to write your own plugin that saves the previous values and computes 
 deltas when queried similar to how iostat behaves.
 
 -- 
 John Baldwin

From: Peter Jeremy <peterjeremy@optushome.com.au>
To: chifeng <chifeng@gmail.com>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: amd64/117664: iostat can't display IO current vlaue in first
	line
Date: Wed, 31 Oct 2007 17:15:45 +1100

 --RtGa12sjXv8gVUZO
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On Tue, Oct 30, 2007 at 07:22:39AM +0000, chifeng wrote:
 >When I write a shell script plugin for munin, I hope get a current value o=
 f IO statistics. But iostat can't do it, it first statistics that are print=
 ed are avaraged over the system uptime. If I use "iostat -c 2 | tail -1 " c=
 ommand, this will wait 2s at least.=20
 >so I think for iostat first line, 1) iostat should be display current valu=
 e, 2) have a parameter to display current value at least.=20
 
 This is generic, rather than amd64-specific.
 
 I believe you misunderstand iostat.  There is no "current value" as
 you desire.  There are a variety of system counters that get updated
 when various events occur and iostat reports the change in those
 counters over the specified interval.  The only way to determine the
 system activity, averaged over two seconds, is to sample the counters,
 wait two seconds, sample the counters again and reports the differences.
 
 I suggest you start a thread on (eg) freebsd-questions explaining what
 you are trying to achieve and someone there may be able to assist.
 
 In the meantime, you might like to investigate the sysutils/bsdsar port.
 
 --=20
 Peter
 
 --RtGa12sjXv8gVUZO
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.4 (FreeBSD)
 
 iD8DBQFHKB2R/opHv/APuIcRAgjnAKC2fZKFT+KqzqhxMZs1gLjdMEtFtgCgpcS2
 qczp7GBEzowYSmYd0Igprfg=
 =CEyw
 -----END PGP SIGNATURE-----
 
 --RtGa12sjXv8gVUZO--
State-Changed-From-To: open->closed 
State-Changed-By: jhb 
State-Changed-When: Fri Nov 2 20:04:23 UTC 2007 
State-Changed-Why:  
As detailed in followup, this is just a property of the counters and the way 
iostat works. 

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