cpu.tk
Plot CPU usage as a stacked Bar chart
C. W. Wright 5/3/1998
C. W. Wright
www.web-span.com
Plot CPU usage as a stacked bar chart. Will only run on systems
that have /proc/stat ( Linux )
INSTALLATION
1) untar, 2) determine where your wish lives, 3) edit cpu.tk and
fix the #!/usr/bin/wish -f to agree with your system, 4) Make
cpu.tk readable/executable, 5) run it as ./cpu.tk
DESCRIPTION
The data are taken from /proc/stat cpu line which gives the
total ticks used by user, nice, system, and the idle loop. The idle
Parameter doesn't seem to work. The program works by 1) reading
the /proc/stat first line, 2) waiting a bit, 3) subtracting the values
acquired from each read and 4) adding them up for a total and then
dividing the total into each of them to get the percentage of time
used by each, then 5) drawing a stacked bar chart of the results.
As it is, Green is IDLE time, Blue SYSTEM, and RED is USER.
The display may be rescaled by dragging it to a different size. It
actually loads the system *less* than "top". Change the "interval"
variable to the number of milliseconds you want the program to update.
This program was quickly hacked together using tcl7.6/tk4.2 without
any special library. It would be *much* simpler done with the
BLT library as it already has a stacked bar chart command.