License: GPL
They can help on servers to keep track of problematic programs, that use a high CPU load.
The numbers I use are examples, you can edit the scripts, to modify intervall, duration, and CPU usage.
logcpu checks every hour, if a program uses more than 70% CPU load.
If yes, a second script is run, logprocess.
It checks for an hour every minute, if the CPU load continuously remains over the desired value.
If yes, it is added to /root/cpulog.txt.
Example (with shorter timings for testing):
So 22. Nov 14:30:42 GMT-8 2009 - 20% - 16396 tty1 SLl 29:42 ./PuppyBrowser
So 22. Nov 14:30:43 GMT-8 2009 - 19% - 28824 pts/1 SLl+ 3:06 mplayer-mt.bin -lavdopts threads=2 /mnt/sda6/filme-sda6/gesehen/Starship_Troopers_09.09.20_23-15_pro7_135_TVOON_DE.mpg.HQ.avi
So 22. Nov 14:32:50 GMT-8 2009 - 20% - 16396 tty1 SLl 30:03 ./PuppyBrowser
So 22. Nov 14:32:50 GMT-8 2009 - 19% - 28824 pts/1 SLl+ 3:30 mplayer-mt.bin -lavdopts threads=2 /mnt/sda6/filme-sda6/gesehen/Starship_Troopers_09.09.20_23-15_pro7_135_TVOON_DE.mpg.HQ.avi
So 22. Nov 14:34:57 GMT-8 2009 - 20% - 16396 tty1 SLl 30:24 ./PuppyBrowser
Almost the same is achieved with "monitorcpu".
But here the program is not added to a logfile, but instead it will be killed.
To stop them, type:
killall logcpu
killall logprocess
or:
killall monitorcpu
killall monitorprocess
I also included start/stop scripts for /etc/init.d (to run them when Puppy starts).
So if you copy those, you could use
/etc/init.d/logcpu start
/etc/init.d/logcpu stop
Mark