The bug mentioned in the Help panel was a very subtle beast. The previous version of TimeMon calculated the running averages for the layered rings by accumulation rather than real averaging. At the beginning of an iteration, we have a value A representing the average from the previous iteration, plus a value S representing the difference between the current sample of the CPU time and the previous iteration's sample. Furthermore, there is a value L representing the number of iterations to average over. The old version calculated A' (the value of A after the current iteration) as: A'=(A*(L-1)+S)/L What's the problem? This assumes that _every_ previous iteration resulting in A as the sample. But, a small amount of thought reveals that some of the iterations resulted in lesser values of S, some in greater. In any case, the new code stores the samples from each iteration so that it can calculate the true averages. Since each sample gives the number of CPU cycles as measured from some time before the program started running (presumably from boot), the time spent between iterations is the difference between the current and previous iteration's samples (which will always be non-negative, BTW). To calculate the average of these differences is merely a matter of calculating the difference between the current iteration's sample and the sample from the starting iteration. The new A' calculation becomes something like: A'=(S[0]-S[1-L])/L Note that there is no reliance on A, just on the actual sample data. Internally, the data is stored in a "ring" of samples and indexed using modulus arithmetic. An index indicates where the next sample should be put, and when the index reaches the end of the array, it wraps around to the beginning. This allows the code to retain the previous L values without having to copy data more than necessary. This is why finding the index of the desired previous sample is more complicated than might be expected. If R is the size of the ring and I is the index of the current sample, the desired previous sample would be at: S[(I-L+R)%R] The +R term is to keep the first argument of the % operator positive.
Copyright ©1993, 1994 Scott Hess All Rights Reserved. Installing TimeMon3.1 Installation should be trivial. Drag&drop to copy it where you want it, and run it. Put it on your dock set to autolaunch, if you like. I put it right under the NeXT icon, where it's easy to find. If the program doesn't work because table() isn't found. Unfortunately, TimeMon3.1 uses an undocumented Mach feature. It used to be documented under NS2.1. Sort of. I refer to the table() function, which allows user programs to query certain kernel data structures without having to be setgid-kmem. Under NS3.0 the relevant include file is apparently no longer available, which means that I had to include some code from the NS2.1 file in loadave.c. This situation concerns me, since it means that perhaps in the next release, not only will the include file be gone, so will the kernel interface, in which case TimeMon can no longer use it. Since that interface is sort of the point of the program ... anyhow, I've included an escape hatch. If TimeMon is compiled with CFLAGS=-DKMEM and installed setgid-kmem (chgrp kmem TimeMon ; chmod g+s TimeMon), then it will use the tried-and-true method of poking around in kernel memory to find the information. Installing TimeMon setgid-kmem is a security risk. Only do this if TimeMon no longer links correctly due to absence of the table() function. How To Find Scott Home: Scott Hess 12901 Upton Avenue South, #326 Burnsville, MN 55337 (612) 895-1208 Office (Yes, I really have an office): Scott Hess 101 West Burnsville Parkway Suite 108F Burnsville, MN 55337 (612) 890-1332 shess@winternet.com or scott@gac.edu This is the small print. All products or trademarks mentioned in this program are trademarks of their respective trademark holders. Notably, NeXT and NeXTSTEP are trademarks of NeXT Computer, Inc.. TimeMon is Copyright © 1991, 1992, 1993, 1994 by Scott Hess. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that this copyright notice appear in all copies. Scott Hess makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. This is the really small print. And this is the really small print.
Copyright ©1993, 1994 Scott Hess All Rights Reserved. Welcome to TimeMon3.2 TimeMon gives a graphical representation of where the CPU cycles are going. It's coarse, but better than nothing. TimeMon3.2 requires NeXTSTEP3.0 or better, and can run on NeXT, Intel, and HP PA-RISC hardware. TimeMon3.2 made minor updates in the source code, and fixed a bug with the lagFactor which caused the inner ring to work incorrectly. Also, the ability to use separate sets of defaults for color and monochrome machines was added. TimeMon3.1 added color support and fixed a significant bug in previous versions' calculation of the CPU average times. See the README.BUGFIX that comes with the source code. Amazingly enough, the buggy version came up with almost the same results, even though it was incorrect. Sigh. TimeMon3.1 also does a hide when autolaunched, so that it doesn't aquire focus when you login. What Am I Seeing? There are three general usages of CPU time under Unix. System time is that time spent within the kernel. User time is that time spent executing a user's programs, but not within the kernel. Nice time is user time that has been set to a low priority. There is also one other type of CPU time ± idle time. This is time during which there is no productive work to do, so your machine essentially twiddles its thumbs at a high speed. Lucky enough, the NeXT supplies four ``colors'', which maps well to the four types of timing information. Black is for system time, dark gray for user, light gray for nice, and white for idle time. You can change these colors using the ``wells'' at the top of this panel. TimeMon displays this information within the program's icon. There are three rings displayed. The innermost ring is updated according to the Update Period, which specifies the number of seconds between updates, and Lag Time which specifies how many update periods should be averaged together for the innermost ring. The middle ring is an average of the last Layer Factor update periods, and the outer ring is an average of the values over the course of the square of the Layer Factor update periods. The values in the fields are automagically stored in the user's defaults database. The difference between Lag Time and Layer Factor are subtle but useful. Both values cause the program to average information over some period of execution, resulting in a more stable display. Lag Time should give a short amount of time useful to even out the ``bumps'' on the innermost ring. A Lag Time of zero can result in a very dynamic display. A similar effect could be achieved by increasing the Update Period. TimeMon has been extensively tuned to use as few CPU cycles as possible. But, if you feel the need to pause it, click the Pause menu item. Otherwise, adjust your Update Period to a higher value so that it updates less often Other Very Important Information Here we get into a blatant advert. While I'm not writing TimeMon, I spend some of my time developing shareware programs, and some of my time doing custom programming for random clients (or is that random programming for custom clients?). http://www.winternet.com/~shess/ is my WWW home page and contains links to the following packages. One program which I've been developing and distributing is a vt100 terminal emulator named Stuart. Stuart is extremely similar to Terminal under NeXTSTEP2.0 and 3.0 ± check Terminal's Info panel to see why. I've added nearly a billion features to Stuart, though. As of December 1994, Stuart2.4 is still the latest released version. You can download Stuart from the archive site sonata.cc.purdue.edu under the directory /pub/next/2.0-release/demos, filename Stuart2.4.tar.Z. There are newer unreleased versions of Stuart on the archive site ftp.winternet.com under /users/shess. These versions include Intel and HPPA support. Another package of mine is TickleServices. TickleServices is a NeXTSTEP Services menu framework. It includes a scripting language which can be used to write services, and a slew of ``example'' services, some of which are worth the registration price on their own. The latest version is TickleServices1.11, which includes support for NeXT, Intel, and HPPA. TickleServices1.11.tar.gz is available on ftp.cs.orst.edu under /software/NeXT/demos/programming. If you cannot use anonymous ftp from your site, feel free to contact me. Likewise, if you need versions of these programs for new hardware or old operating systems, let me know. How To Find Scott Home: Scott Hess 12901 Upton Avenue South, #326 Burnsville, MN 55337 (612) 895-1208 Office (Yes, I really have an office): Scott Hess 101 West Burnsville Parkway Suite 108E Burnsville, MN 55337 (612) 890-1332 shess@winternet.com or scott@gac.edu This is the small print. All products or trademarks mentioned in this program are trademarks of their respective trademark holders. Notably, NeXT and NeXTSTEP are trademarks of NeXT Computer, Inc., while DEC and VT100 are trademarks of Digital Equipment Corporation. Communicae is a trademark of Active Ingredients, Inc. TimeMon is Copyright © 1991, 1992, 1993, 1994 by Scott Hess. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that this copyright notice appear in all copies. Scott Hess makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. This is the really small print. And this is the really small print.
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.