From owner-freebsd-bugs@freebsd.org Mon Jun 25 05:07:05 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 554A710248EB for ; Mon, 25 Jun 2018 05:07:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id E462B8B18B for ; Mon, 25 Jun 2018 05:07:04 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: by mailman.ysv.freebsd.org (Postfix) id A09D810248EA; Mon, 25 Jun 2018 05:07:04 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DC0010248E9 for ; Mon, 25 Jun 2018 05:07:04 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 0CFE18B18A for ; Mon, 25 Jun 2018 05:07:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 7908DD6819F for ; Mon, 25 Jun 2018 15:06:52 +1000 (AEST) Date: Mon, 25 Jun 2018 15:06:52 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org cc: bugs@freebsd.org Subject: Re: [Bug 201685] top(1) with -m io produces garbage output for first update In-Reply-To: Message-ID: <20180625145141.O945@besplex.bde.org> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=9cW_t1CCXrUA:10 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=91WeFuBBAAAA:8 a=Q-rwypIFDiZQEZH7DaMA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=A7AYyeJ0r3_PDf1lba3H:22 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2018 05:07:05 -0000 On Sun, 24 Jun 2018 a bug that does't want replies@freebsd.org wrote: > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201685 > > --- Comment #4 from cstdenis@ctgameinfo.com --- > I encountered this error because I was trying to log periodic snapshots of top > output as part of tracking down some system issues. > > i.e. (/root/datestamp.sh; /usr/bin/top -j -t -mio -ototal) >> > /var/log/top_io.log > > Having it do a "dummy" run before outputting would be a great fix and make that > kind of logging possible. As it is, the above command is useless. The only bug here is misformatting of large values. top -m io just starts by displaying the counts since boot time. These can be very large after a long uptime. top uses fixed field widths, and has no space available for wider dynamic widths anyway, so it misaligns large values. The fix is not to display values in dehumanized (scientific) format like systat does by default and some utilities do when directed to do so by a -[hH] (dehumanize) flag. I use this feature to log benchmarks. top -SH -m io -o write 1000 gives non-interactive output. This is logged at the beginning and end of the benchmark. Only the delta-counts are of interest. These are hard to manage and I don't have any good scripts to manage them, but sometimes look at a couple of lines and compare the values. Any dehumanized output would break the resolutions. Counts of 1000000 and 1000001 would be indistinguishable if displayed as 1M. Bruce