From owner-svn-src-head@FreeBSD.ORG Wed Nov 5 02:31:50 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4F1F1065670; Wed, 5 Nov 2008 02:31:50 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 238938FC14; Wed, 5 Nov 2008 02:31:49 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from kobe.laptop (adsl92-78.kln.forthnet.gr [77.49.59.78]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id mA52VcjN011611 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 5 Nov 2008 04:31:43 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id mA52Vb1H001412; Wed, 5 Nov 2008 04:31:37 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id mA52VbkF001411; Wed, 5 Nov 2008 04:31:37 +0200 (EET) (envelope-from keramida@freebsd.org) From: Giorgos Keramidas To: Diomidis Spinellis In-Reply-To: (Diomidis Spinellis's message of "Tue, 4 Nov 2008 22:30:07 +0200") Date: Wed, 05 Nov 2008 04:23:02 +0200 Message-ID: <87tzamgbcp.fsf@kobe.laptop> References: <200811041802.mA4I2aVk003708@svn.freebsd.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-ID: mA52VcjN011611 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.305, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.09, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@freebsd.org X-Spam-Status: No Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r184645 - head/usr.bin/vmstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Nov 2008 02:31:50 -0000 On Tue, 4 Nov 2008 22:30:07 +0200, Diomidis Spinellis wrote: >On Nov 4, 2008, at 8:02 PM, Giorgos Keramidas wrote: >> Author: keramida (doc committer) >> Date: Tue Nov 4 18:02:35 2008 >> New Revision: 184645 >> URL: http://svn.freebsd.org/changeset/base/184645 >> >> Log: >> Repeat vmstat header after window.rows instead of a hardcoded 20. >> >> Use ioctl() to get the window size in vmstat(8), and force a new >> header to be prepended to the output every time the current window >> size changes. Change the number of lines before each header to the >> current lines of the terminal when the terminal is resized, so that >> the full terminal length can be used for output lines. >> >> Inspired by: svn change 175562 (same feature for iostat) >> Reviewed by: ru (who fixed some of my bugs too) > > Thanks! This functionality is generally useful and tricky to code in a > correct way. Should we perhaps package it in a library function, so > that all header-printing commands can benefit from it, without > repeating the code? That's what I thought when I had to write almost the same code a second time. Once is ok, twice is almost ok, but if we find it repeated all over the place a library function would definitely be nice :) One of the utilities that includes a similar `repeated output' mode that I was planning to patch next is procstat(1). Right now procstat prints the header once, and then forgets about it. When the header scrolls off the terminal it's gone for good. The code of procstat is quite different that vmstat and iostat though, so I'll have to think a bit about the best way to make a library function out of the header display code and link all three of them to the same code.