matt massie wrote:
matt-
it would be insanely cool if we get ganglia ported to win32 but don't get
down on yourself. just have fun with it. i'm interested to see how
cygwin will simulate the /proc directory. how do you get the system
metrics from windows?
The /proc directory is not as useful on other architectures, which usually
rely on reading kernel memory directly in order to get this info. First
you do a system call to get the memory offsets of the kernel variables you
want to read, then an open(), then a read(), then a close(). Whereas the
Linux procfs interface is kind enough to provide you with a filesystem
interface, so you just keep reading in a file which procfs updates whenever
it feels like it (since it's in kernel space).
Solaris has a useful interface called kstat that actually makes this
process a bit more complicated and flaky. First you build the name for the
class of kvar you want, then you request a kstat chain, then you have to
walk the (linked-list, basically) chain until your kvar shows up. Then ya
pull it out and either close() the chain or keep it around and do a
refresh() on the next cycle. There are some annoying catches in there,
too, and I had problems with kstat chains either going stale or closing
prematurely. I'm sure it had something to do with my atrocious code. :)
Anyway, no one asked for a lecture but I thought I'd share how some metrics
were collected on other systems in the hopes that this will help porters
and would-be porters.