The FooDoo Lounge

Process Watcher 1.1

Description

Process Watcher is an AppleScript application for classic MacOS that periodically logs various things that happen on your computer, such as which processes (programs) are running; which one is in front; and/or how much free memory is available. It logs any changes in the things it's watching by writing a line to a text file. Process Watcher can help you to track crashes and other problems, as well as allowing you to keep an eye on work and usage patterns.

The time between checking can be set by double clicking it when it's already running. This and other values can be set by editing a config file which is used to determine which events get checked. Each of the 4 currently supported events can switched on or off separately, giving you maximum flexibility when matching it to the speed of your system &/or your requirements. Process Watcher can be configured to get free memory and the name of the front process, but not a list of apps for example. It can also be used gather current system information each time it launches.

Using Process Watcher

Just launch it when you want to log a session, or place an alias to it in your Startup Items folder (in the System Folder) to have it run all the time. It makes a new log file every time it runs, in a folder called "log" that it creates inside its own folder. The log files are human understandable - you should be able to work out what is being recorded there - but are also designed so that they can be read by another program.

Performance

Process Watcher will do as little as possible (it only writes an entry if something it's watching has changed) and do it as efficiently as possible. Nonetheless, the time it takes to do its stuff will vary enormously depending on how fast your machine is, the things it's looking for, and which Scripting Additions you have installed. For maximum possible speed, make sure you install the recommended Scripting Additions noted below.

Overall performance is determined in two ways. If it gets in your way by checking too often, set the time between checks to a higher number by double-clicking the already running app and entering the new number in the dialog. This changes the interval for the current session only. To change it for every session, see Changing Settings below. If Process Watcher takes too long to do its checking, one or more functions may need to be turned off.

Getting a list of processes may take too long (interfere with your typing for example) on an older machine, particularly if it needs to use the Finder to do so. That particular function will use Akua Sweets if you have it installed. Using Akua to list processes takes about a third of the time of the Finder.

File read/write operations will use Tanaka's osax 2.0 if it is installed. This maximises speed when writing log entries and reading the config file.

Changing Settings

The config file (called "Process Watcher.cfg" in the folder "cfg") is used by Process Watcher to determine how often to check and which info to collect. Editing it is pretty straightforward and the file is commented, so don't be afraid to try it. Most of the values are used as switches - on/off - excepting 'checkFrequency' which is the time, in seconds, between checking. The default is to check approximately every 5 seconds:

checkFrequency=5

Set this to a higher number if it gets in your way or a lower number for more frequent checks. The other defaults are set to check everything. To turn functions off, just substitute the word "off" for the word "on" after the equals sign. The line below tells Process Watcher to get a list of processes every time it is checking:

logAllProcesses=on

It also accepts "yes" and "1" (one) as on values. To turn it off, just change it to "off", "no", or "0" (zero):

logAllProcesses=off

System Requirements

Minimum: 040 Mac, OS 8.1*, a standard installation of AppleScript.

Recommended: PowerPC (604/G3/G4), MacOS 8.5.1-9.1, Tanaka's Osax 2.x, Akua Sweets.

Process Watcher does not require any extra Scripting Additions but will run faster, possibly considerably so, if the above additions are installed. I recommend MacOS 8.5 or higher mainly because of the great improvements in speed that came with AppleScript 1.3.

* System 7 users: This could well run under system 7.5 or 7.6, but I can't test it at the moment. If you're using a slow 68k machine, it may be unusable though.

Bugs & Limitations

This application has been tested only under OS 9.0.4 and 9.1, on 604 and G4 machines. I'm reasonably confident it will work under any supported hardware/software combination, but please do let me know if you have any hassles with it.

Process Watcher works quickly enough on recent hardware to be able to check everything quite frequently, but it may be of little value on older machines and earlier versions of AppleScript. If you can upgrade your system software to OS 8.5.1 or 8.6, then consider doing so. I find that AppleScript performance is sweetest for me under 9.0.4. Your experience may not reflect this.

It does, unfortunately, appear to leak memory (but only sometimes) when using Akua to get the process list, so if you're wanting it to run continuously for long periods - say more than a couple of weeks - either make sure you don't have Akua installed, turn off logAllProcesses, or increase the memory allocation somewhat.

The log folder can also get pretty big after Process Watcher has been running for a while, so you may want to clean this up at times - deleting any old logs you no longer want. I'm hoping to write an analyst type app that will read the files and summarise them at some stage.

Some people may get occasional problems when running any kind of AppleScript application from the Startup Items folder under OS 9.0.4. If it's a problem for you, the only option is to either upgrade or downgrade your system software.

To force quit any application (unsaved changes, if any, will be lost), hold down these keys - Command + Option + Esc.

Business

Process Watcher is kiteWare and contains some code by Nigel Garvey. Please read the licence before using the software.

Download Process Watcher (120K)

Scripters

My General Terms for Code Use are here. Please read them if you intend to make use of any of the code.

This code is not designed to be modified by the casual scripter. It is intended to be extensible, but adding functions is not completely simple as yet. To recompile it, you will need to repoint the parent property to the run-only library provided in the "lib" folder.

Enjoy...

 

The FooDoo Lounge is Copyright © Richard Morton 2002-2005

|| url: http://www.foodoo.sunreal.com.au/kite/prcwat.html
|| created: 4-Aug-03, 10:29 PM; updated: 4-Aug-03, 11:56 AM
|| size: 18534 bytes