Subject: Re: libkvmstats???
To: Brian C. Grayson <bgrayson@ece.utexas.edu>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-kern
Date: 02/03/1998 15:41:08
Brian C. Grayson writes:
[...]
>   Has anyone thought about adding a new library, like
> libkvmstats, that would contain a nice sysctl()/swapctl()-like
> interface to kernel statistics?  Then our code to some of the
> various system utilities, and other third-party programs like
> top and xosview, wouldn't contain as much direct kernel-munging
> that has to be changed when the kernel internals change (like the
> swap stuff, which required changes to all sorts of utilities).  

Well, just personally, and just thinking about the network statistics:
Giving aggregate bytes in/out over all interfaces is not useful at
all.  I'd want per-interface info, and I'd want both bytes and
packets, and if I'm ever watching for anything unusual, I'd really
really want error counts as well.

If you're only concerned about singly-homed hosts, I guess
aggregtating over interfaces isn't so bad.  But many of us seem
to use NetBSD as routers, often with widely disparate bandwidth,
so it's not an idle point.

Oh yes, from a design perspective, its arguably a bad idea for the
kernel to keep aggregate statistics over multiple interfaces, in
addition to the per-interface statistics we already need: you still
need to go to the kernel to get either, and why invite the possibility
of inconsistency ? ;)



Darren Reed replies:

>Perhaps a pstat(2) or pstat(3) equivalent ?

Hm. I dont see how that would really help with networking statistics
or troubleshooting.  I think one really wants a MIB that apps can
walk. I dont care if it's a sysctl MIB or (egad) an SNMP-style MIB, or
something else, but one wants it.

For networking apps, one really wants a uniform way to register
extensions to the `standard' MIB outside the kernel in such a way that
suitbaly aware apps can ask for and get `nonstandard', or protocol-,
media-, or interface- specific info.

Here, if its not clear, I'm thinking of (a) netstat and
             (b) longer-term, of adding SNMP agents to NetBSD.

Apart from consistency/update issues, I dont see why the existing
sysctl interface couldn't handle it.  OTOH, I'm sure we've had this
discussion before, so I've probably just forgotten the reason :).