00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "muxevent.h"
00012 #include "mech.h"
00013 #include "mech.events.h"
00014
00015 #define MAX_EVENTS 100
00016
00017 extern char *muxevent_names[];
00018
00019 int muxevent_exec_count[MAX_EVENTS];
00020
00021 void muxevent_count_initialize()
00022 {
00023 int i;
00024
00025 for(i = 0; i < MAX_EVENTS; i++)
00026 muxevent_exec_count[i] = 0;
00027 }
00028 static int muxevent_mech_event[] = {
00029 0, 1, 0, 1, 1, 1, 1, 1, 1, 0,
00030 1, 0, 1, 1, 0, 1, 1, 0, 0, 1,
00031 1, 1, 1, 0, 0, 0, 0, 0, 0, 1,
00032 1, 0, 1, 1, 1, 0, 1, 1, 0, 1,
00033 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00034 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00035 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00036 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
00037 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
00038 };
00039
00040 void debug_EventTypes(dbref player, void *data, char *buffer)
00041 {
00042 int i, j, k, tot = 0;
00043
00044 if(buffer && *buffer) {
00045 int t[MAX_EVENTS];
00046 int tot_ev = 0;
00047
00048 for(i = 0; i < MAX_EVENTS; i++) {
00049 t[i] = i;
00050 tot_ev += muxevent_exec_count[i];
00051 }
00052 for(i = 0; i < (MAX_EVENTS - 1); i++)
00053 for(j = i + 1; j < MAX_EVENTS; j++)
00054 if(muxevent_exec_count[t[i]] > muxevent_exec_count[t[j]]) {
00055 int s = t[i];
00056
00057 t[i] = t[j];
00058 t[j] = s;
00059 }
00060
00061 notify(player, "Event history (by use)");
00062 for(i = 0; i < MAX_EVENTS; i++)
00063 if(muxevent_exec_count[t[i]])
00064 notify_printf(player, "%-3d%-20s%10d %.3f%%", t[i],
00065 muxevent_names[t[i]], muxevent_exec_count[t[i]],
00066 ((float) 100.0 * muxevent_exec_count[t[i]] /
00067 (tot_ev ? tot_ev : 1)));
00068
00069 return;
00070 }
00071 notify(player, "Events by type: ");
00072 notify(player, "-------------------------------");
00073 k = muxevent_last_type();
00074 for(i = 0; i <= k; i++) {
00075 j = muxevent_count_type(i);
00076 if(!j)
00077 continue;
00078 tot += j;
00079 notify_printf(player, "%-20s%d", muxevent_names[i], j);
00080 }
00081 if(tot)
00082 notify(player, "-------------------------------");
00083 notify_printf(player, "%d total", tot);
00084 }
00085
00086 void prerun_event(MUXEVENT * e)
00087 {
00088 }
00089
00090 void postrun_event(MUXEVENT * e)
00091 {
00092 }