Re: RFC: Sorting in top -m io

From: Dan Nelson <dnelson_at_allantgroup.com>
Date: Thu, 8 Jul 2004 12:49:01 -0500
In the last episode (Jul 08), Giorgos Keramidas said:
> On 2004-07-08 12:07, Dan Nelson <dnelson_at_allantgroup.com> wrote:
> > In the last episode (Jul 08), Alfred Perlstein said:
> > > * Giorgos Keramidas <keramida_at_freebsd.org> [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_at_allantgroup.com
Received on Thu Jul 08 2004 - 15:49:12 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:00 UTC