From owner-svn-src-head@freebsd.org Wed Jul 1 03:47:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 076DA35C46D; Wed, 1 Jul 2020 03:47:00 +0000 (UTC) (envelope-from csjp@ion.sqrt.ca) Received: from ion.sqrt.ca (ion.sqrt.ca [192.73.242.220]) by mx1.freebsd.org (Postfix) with ESMTP id 49xRxG5c1Fz4JBy; Wed, 1 Jul 2020 03:46:58 +0000 (UTC) (envelope-from csjp@ion.sqrt.ca) Received: by ion.sqrt.ca (Postfix, from userid 1000) id 8EFCA81A16; Tue, 30 Jun 2020 20:46:52 -0700 (PDT) Date: Tue, 30 Jun 2020 20:46:52 -0700 From: csjp@ion.sqrt.ca To: "Piotr P. Stefaniak" Cc: "Christian S.J. Peron" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r358181 - head/usr.sbin/pstat Message-ID: <20200701034652.GA1094@ion.sqrt.ca> References: <202002202112.01KLCAKx000852@repo.freebsd.org> <20200622215315.GC28243@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200622215315.GC28243@freefall.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Rspamd-Queue-Id: 49xRxG5c1Fz4JBy X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of csjp@ion.sqrt.ca has no SPF policy when checking 192.73.242.220) smtp.mailfrom=csjp@ion.sqrt.ca X-Spamd-Result: default: False [3.08 / 15.00]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.42)[0.416]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[sqrt.ca]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.92)[0.921]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_SPAM_LONG(0.85)[0.848]; FROM_NO_DN(0.00)[]; R_SPF_NA(0.00)[no SPF record]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:36236, ipnet:192.73.242.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2020 03:47:00 -0000 Piotr, Thanks for the heads up. I will fix this shortly. On Mon, Jun 22, 2020 at 11:53:15PM +0200, Piotr P. Stefaniak wrote: > On 2020-02-20 21:12:10, Christian S.J. Peron wrote: > >Author: csjp > >Date: Thu Feb 20 21:12:10 2020 > >New Revision: 358181 > >URL: https://svnweb.freebsd.org/changeset/base/358181 > > > >Log: > > - Implement -h (human readable) for the size of the underlying block disk. > > Currently, the size of the swap device is unconditionally reported using > > blocks, even if -h has been used. > > - While here, switch to CONVERT_BLOCKS() instead of CONVERT() which will > > avoid overflowing size counters (in human readable form see: r196244) > > - Update the column headers to reflect that a size is being reported instead > > of the block size units being used > > > > Before: > > > > $ swapinfo > > Device 1K-blocks Used Avail Capacity > > /dev/gpt/swapfs 1048576 0 1048576 0% > > In the above, the "1K-blocks" and "1048576" line up because both the > header and the value have field width of hlen which is always set by > getbsize(&hlen, &blocksize). In other words, the header name sets the > width for the column. It is especially apparent when you compare output > with BLOCKSIZE=1000000000 and BLOCKSIZE=1K. > > > After: > > > > $ swapinfo -h > > Device Size Used Avail Capacity > > /dev/gpt/swapfs 1.0G 0B 1.0G 0% > > Here the width for the header is sizeof "Size" and the width for values > of the size is 8, so the header and the values don't make up a column. > > Since field width for all values of Size, Used, and Avail are hardcoded > to 8 as well as the column headers, I think the best suggestion I can > give is to change it like this: > > @@ -475,7 +475,7 @@ print_swap_header(void) > if (humanflag) { > header = SIZEHDR; > - hlen = sizeof(SIZEHDR); > + hlen = 8; /* as the hardcoded field width of values */ > } else { > header = getbsize(&hlen, &blocksize); > } > > Although 8 seems to me a bit high. And too bad that humanize_number() is > locale-agnostic. > > > Differential Revision: https://reviews.freebsd.org/D23758 > > Reviewed by: kevans > > MFC after: 3 weeks > > > >Modified: > > head/usr.sbin/pstat/pstat.c