The FooDoo Lounge

Crash Counter 1.0.1

Description

Crash Counter is a suite of AppleScript scripts and script applications that log start up and shut down/restart of the computer for the purpose of determining how often crashes occur. This information can be subsequently analysed and reported on using the Crash Counter Analyst application. The reports include some current system information, analysis of session data and a summary of all sessions logged. Example log and report files are included.

Installation

Double-click the Installer application to install the Crash Counter package on your startup disk. It is important that the installer is used to install the package - Crash Counter will not work if you copy the files by hand.

Using Crash Counter

Once Crash Counter is installed, session logging is performed automatically each time the machine is started up, restarted, or shut down. You may notice that an application - either Crash Counter Startup or Crash Counter Shutdown - will run at these times. These little applets write the entries to the log file and are located in the Startup Items and Shutdown Items folders of your active System Folder.

When you have some session data to analyse, or would simply like to gather some info on your current system, run the Crash Counter Analyst application to write and display a report. If you don't yet have a log file, point it to the example file included, when it prompts you for a log file to analyse.

If you have more than one startup disk, Crash Counter will only be active on the disk on which it is installed. Install it onto other disks if you wish.

What gets installed

The Crash Counter folder contains the Crash Counter Analyst application, a copy of the Read Me and some sample report and log files.

System Requirements

To use this package you need a Mac running OS 8 or 9* and a standard installation of AppleScript. MacOS 8.5 or higher is recommended.

The scripts do not require any extra Scripting Additions. They will however, make use of Jon's Commands (Version 2.0 or higher) and Tanaka's Osax 2.x if installed.

Jon's Commands is particularly useful for Crash Counter because it provides extra system information for the report files. Both these additions are free (for non-commercial use), well written and, like all scripting additions, do not appear to have any system overheads, i.e. they shouldn't cause instability or slowdowns.

* System 7 users: This was originally designed to work under 7.x, and would probably require only a small amount of tweaking to get at least the main part of it working for English versions of System 7.5 or higher. At a minimum, it would require the scriptable Finder. I can't test it, but it may run as is under System 7.6.

Bugs & Limitations

This suite has been tested under OS 8.1, 8.6, 9.0.4, and 9.1 on 604 and G4 class machines and there are no bugs apparent here at this stage, on the systems I can test it on. Please let me know if you have any problems.

One clear limitation of this system is it may not be much good to you if your machine stays on all the time: It only logs at startup, restart and shutdown. If you don't restart often, or want something more sophisticated, try my Process Watcher package.

Some people may get occasional problems when running any kind of AppleScript application from the Startup Items folder under OS 9.0.4. This is an AppleScript or Finder bug and is rare in my experience, but it does happen & is possibly made more likely by having Virtual Memory on. See the Questions section of this Read Me for info on what to do if Crash Counter Startup crashes when your computer starts up.

Questions you may never have thought of yourself

Can I make multiple log files?

Sure. Just give the current log file a different name or move it. You'll find it in the folder "Log Files" in the Crash Counter folder of the Application Support folder in your System Folder. A new log file will be created next time the computer is shut down or restarted.

How do I turn it off?

To stop logging, open the Extensions Manager control panel and set it to view as packages, using the View menu. Locate the Crash Counter package and uncheck it. Check this box again if you wish to start logging again. There is no need to restart. Alternatively, just pull the apps out of their respective folders.

Why do I need to use the installer?

The installer initialises the Crash Counter Startup and Crash Counter Shutdown applications and makes sure the support files are where they need to be. The applications will error if they are run without first being initialised.

The installer includes source code, so open it up in your favourite script editor if you wish, but don't try to modify it because it won't recompile as it is. See Business for more on what you can and can't do with the code.

What do I do if "Crash Counter Startup" crashes?

In some rare situations the application may crash when run from the Startup Items folder. I've only had it happen 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.

If you want to make sure the startup was logged, open the Log File (in the "Log Files" folder of the "Crash Counter" folder of the "Application Support" folder) and check the last line of the file. If it starts with "Begin session" and is followed by a date and time that corresponds to the most recent startup, then no further action is required. If not, simply go to the Startup Items folder in your system folder and run the application manually by double-clicking it.

What does this thing actually do?

What happens, say at startup, is that the Crash Counter Startup application launches from the Startup Items folder and tells the Crash Counter Engine script to write new a line in the log file. The line might look something like this:

Begin session 02Mar2002 8:29:33 AM

When you shut down or restart, Crash Counter Shutdown launches from the Shutdown Items folder and tells the Crash Counter Engine to write a line like this to the log:

End session 02Mar2002 6:02:21 PM

If your computer crashes, the Crash Counter Shutdown app does not run and the end of the session is not recorded. After the next startup, the log will contain two consecutive beginning entries, so we assume that the machine crashed last time.

The following lines demonstrate what a log of 3 successful sessions and one crash might look like:

Begin session 02Mar2002 8:29:33 AM
End session 02Mar2002 6:02:21 PM
Begin session 03Mar2002 8:22:04 AM
End session 03Mar2002 6:45:48 PM
Begin session 04Mar2002 8:43:12 AM
Begin session 04Mar2002 8:55:29 AM
End session 04Mar2002 5:50:26 PM
Begin session 05Mar2002 8:47:42 AM

When the Crash Counter Analyst application is used to write a report, it reads the log file and performs sophisticated, in depth statistical analysis (I'm kidding, just some simple arithmetic really) on the data. The analysis and summary for the above entries would look like this:

SESSION DATA ANALYSIS:
Total sessions recorded: 4
Crash free sessions recorded: 3
Total time of crash free sessions: 29:03
Average length of crash free sessions: 9:41

Number of crashes: 1
Average session time between crashes: 14:31

SESSION SUMMARY:
Session begun 02Mar2002 8:29:33 AM. Duration, 9:32
Session begun 03Mar2002 8:22:04 AM. Duration, 10:23
Crash during session begun on 04Mar2002 8:43:12 AM
Session begun 04Mar2002 8:43:12 AM. Duration, 9:07

Business

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

Download Crash Counter (101K)

Additional Information for Scripters

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

Enjoy...

 

The FooDoo Lounge is Copyright © Richard Morton 2002-2005

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