/adm/daemons/usage_d.c usage_d.c is the daemon object that keeps track of how many users have been playing the MUD, how many objects are loaded, and how much CPU and memory are being used. The daemon uses the appropriate efuns to count the number of users and objects and the amount of the memory and CPU every 2 minutes. It keeps track of running sum of those counts. Every 20 minutes, it calculates the average value for the last 10 samples, and it stores that average in an array. It keeps track of the last 20 averages and can print them or graph them. The daemon defines three important functions. The first of these is sample(). sample() counts the number of users and objects on, and the memory and CPU use, and stores the answers in running totals. It then call_outs() itself, so that there is always one version of sample() pending in the call_out chain. The length of time between samples is given by the #define CALL_TIME, and comes set at two minutes. The second function is update_history. It is called from sample() when #NUM_AVERAGE of samples have been taken. It takes the running totals from sample(), divides by NUM_AVERAGE to get averages, and stores them in the four arrays that hold that data. Those arrays are NUM_FOO long, and the daemon keeps a pointer to the current entry. When a new set of averages is generated, first the pointer is advanced (so that it points to the _oldest_ entry) and then the new data is copied into the array, replacing the oldest data. Both of the defines are in usage_d.c and can be altered. The third is graph_data. This function is called from the _graph command. It takes a string argument which is one of the four tracked quantities, and prints out a nice graph of the data. Author - Mobydick, 7-3-93.