So, I'm starting to look at writing and extension that would be much like "top", but without the "rolling display" parts. This is going to be a much bigger pain than I initially thought.
My original idea was to wrap the "top" program by William LeFebvre. Then, I thought I'd just yank out the bits I needed. The problem is I'm having a hard time deciphering some of his code - it's definitely a bit above my head. I may just start from scratch, using his code to get me started and give me ideas as I go.
One funny thing I saw was this bit of code within the boolean.h file:
#define No 0
#define Yes 1
#define Maybe 2
OTOH, if this module is really about displaying, then perhaps you should consider using Proc::ProcessTable to do the grungy ps work.
Re:top of the muffin to you
djberg96 on 2002-11-05T16:39:31
The purpose is to monitor things like load average, process summaries, and overall memory usage - not necessarily the memory usage of individual processes. To the best of my knowledge, Proc::ProcessTable doesn't do that; at least, not without a lot of manual calculations.It won't have any display - it's meant for things like remote health monitoring via, say, a distributed server. I searched CPAN but didn't see anything really designed for that. If there is something (that works on Solaris), I'd love to know about it - preferably something that's a bit more in depth than parsing "ps | sort".
It needs to be cross platform as well (mainly targeting Linux and Solaris). That means that I can simply parse text files out of
/proc on Linux, but have to resort to kstat.h, etc on Solaris. So, I have little choice but to make it an extension. Re:top of the muffin to you
jdporter on 2002-11-05T21:15:29
I see. You want the info that is at the top of top's display, not the itemized-by-process listing.What about vmstat? I'm sure you also know about uptime...
Would it really take a lot of manual calculations to use the info coughed up by Proc::ProcessTable? I would think a series of adds would do it...
Re:top of the muffin to you
djberg96 on 2002-11-06T04:16:30
I see. You want the info that is at the top of top's display, not the itemized-by-process listing.Exactly.
What about vmstat? I'm sure you also know about uptime.
I've been futzing around with vmstat, trying to figure out how it works internally. I actually have an uptime interface, but I left load averages out because, well, they really don't have much to do with system uptime, per se.
Would it really take a lot of manual calculations to use the info coughed up by Proc::ProcessTable? I would think a series of adds would do it...
See my latest entry - my new conundrum is whether or not top is returning correct values (or rather, why it returns the values that it does), because adding up the values results in different values than what top reports.