From owner-freebsd-current@FreeBSD.ORG Thu Jul 8 17:49:12 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9C63416A4CF; Thu, 8 Jul 2004 17:49:12 +0000 (GMT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3329343D62; Thu, 8 Jul 2004 17:49:12 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.10/8.12.10) id i68Hn2hA039402; Thu, 8 Jul 2004 12:49:02 -0500 (CDT) (envelope-from dan) Date: Thu, 8 Jul 2004 12:49:01 -0500 From: Dan Nelson To: Giorgos Keramidas Message-ID: <20040708174901.GK57155@dan.emsphone.com> References: <20040707124751.GA66588@orion.daedalusnetworks.priv> <20040708163751.GN95729@elvis.mu.org> <20040708170731.GI57155@dan.emsphone.com> <20040708172725.GA7132@orion.daedalusnetworks.priv> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040708172725.GA7132@orion.daedalusnetworks.priv> X-OS: FreeBSD 5.2-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.6i cc: Alfred Perlstein cc: current@freebsd.org Subject: Re: RFC: Sorting in top -m io X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2004 17:49:12 -0000 In the last episode (Jul 08), Giorgos Keramidas said: > On 2004-07-08 12:07, Dan Nelson wrote: > > In the last episode (Jul 08), Alfred Perlstein said: > > > * Giorgos Keramidas [040708 05:45] wrote: > > > > > > > > The new -m io option of top is cool, but sorting ... > > > > > > I think it's awesome. Go for it. > > > > docs are still missing: manpage, top Usage string, and "?" help all > > need to describe the -m flag and 'm' key. > > Err, yeah. I should have waited. I have a few changes to the manpage > at home. In a couple of hours they should be ready and into shape for > commiting. > > > Since there's room, context-switch info would also be neat to display. > > I'm not sure I can tackle this. I have close to nil experience with > the stuff top uses to extract the useful information from the kernel. > Copy-pasting and tinkering a bit with a few OO-like sort methods > wasn't very hard but for anything else I'll have to read a lot of > stuff :-) It's just extracting stuff out of the rusage struct for each process. Take a look around line 661 of machine.c; you can see it's getting the deltas between two rusage structs for certain members. Just add lines for ru.ru_nvcsw and ru_nivcsw, and fix up the printf on line 674 and the definitions of io_header and io_Proc_format around line 96 to display the fields. -- Dan Nelson dnelson@allantgroup.com