"top" is a great tool - very old. And lacking in many ways, 20+years after
it first appeared.
"proc" is my version of top. I wrote it many many years ago for Solaris,
so it could do what *I* wanted. I've had this tool for a long time. I
ported it to Linux, and have been happy with it.
Why is it better? Because it does color. It crams more data into the
screen real estate. It uses a better sorting algorithm (there are lots
to choose from), and highlights memory deltas.
"proc" is available from my tools area (next door to dtrace).
Why am I bothering to talk about proc?
Because I realised as CPUs get faster, and with 8 cores on an i7,
drilling down and understanding whats going on in a system requires
more esoteric tools.
So, whats wrong with "proc"? For one thing, its easy to see something
on screen which is of interest, but, on the next screen update, it might have
disappeared. This can be annoying - as machines get bigger, more
processes running, the screen real estate cannot show everything at once.
Sometimes you want to go *backwards* and rewind what you just saw.
Well, that requires a bit of re-engineering. But its done. By default
you can cycle back upto 20 mins of history. History is stored in
/tmp/proc; by the time we factor in the process table, the amount of
data is quite staggering (about 1GB of data per hour). This includes
the key process attributes, along with extensions for /proc/pid/wchan,
/proc/pid/stack etc. (Nearly everything is kept, but not absolutely everything;
e.g. signal masks are not stored). And this includes the threads.
We also keep /proc/meminfo, /proc/vmstat and many more.
Theres so much data, that actually visually monitoring it is quite
difficult. Just staring at /proc/meminfo has so many fields,
one cannot understand/comprehend what is happening from one second
to the next.
Even with history, its not comprehendable.
So, the second major update to "proc" is graphics. The ability
to see, in graphical format, what is happening to the various key stats
is very educational and illuminating.
The implementation of graphs is interesting. Rather than creating
an X11 application or KDE or GNOME, I decided to implement this
inside the terminal emulator. "fcterm" is my emulator of choice -
and fcterm was recently enhanced to support various escape sequences to
do line and rectangle drawing. By using simple printf/escape-sequences,
anything can be drawn - sufficient for drawing graphs.
[I have a sampler in the fcterm/ctw distribution, available on
my site, written in Perl, to show just about every /proc entry
as a graph. Its crude, but effective, but quickly shows that dumping
all graphs onto a page just overwhelms; that is why proc was enhanced].
I have just uploaded proc-b21, for you to play with (but you must
use it inside fcterm; I havent validated what it does in another
xterm). It is still a work in progress, so dont bother reporting
bugs to me yet.
I will upload a few images in the next blog post.