Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Nov 1999 21:56:42 -0800
From:      Arun Sharma <adsharma@home.com>
To:        freebsd-hackers@freebsd.org
Subject:   kstat - an API for gathering kernel stats
Message-ID:  <19991103215642.A31757@home.com>

next in thread | raw e-mail | index | archive | help
I wrote kstat as a way to improve on the current BSD method of getting
kernel statistics, which involves looking up a particular kernel symbol
name and then getting the value from the symbol offset. This makes any
performance monitoring tool or an application that gets kernel stats
non-portable across different kernel versions if for some reason, the names
of these variables happen to change.

kstat derives some ideas from the Solaris kstat API, but is much simpler.
It adds a new system call to the kernel. Any kernel module that wants to
register a counter calls kstat_register, which makes an entry in the
hash table, that maps the counter name to the address of the counter.

A user program makes a system call with this string "cpu.system" to get
the current value of user/system/nice time etc.

A kernel module and a sample application can be downloaded from:

http://members.home.net/adsharma/kstat.tar.gz

Each system call currently costs a hash table lookup. A tool that may
want to repeatedly get the value of the same counter over and over again
may want to avoid that lookup everytime. I have some ideas on how to make
that happen.

Comments and suggestions are welcome.

	-Arun



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991103215642.A31757>