/* This code is the Statistics/Rates task */ #include #include #include #include /* getenv, exit */ #include #include #include #include "common.h" #include "message.h" #include "stats.h" #include "netvar.h" void MERGE_ZeroStats(); int * StatsMem[NUMCOUNTERS]; /* MAXCOUNTERS + (MAXCOUNTERS * (NUMLINKS+2)); MAXOUNTERS=64 NUMLINKS=64 */ int * RatesMem[NUMCOUNTERS]; int Counts[NUMCOUNTERS]; char message [160]; /* message logger message buffer */ /* --------------------------------------------------------------------- */ void MERGE_Stats() { int i, j; int ScratchNetInt; int *delay; int *MERGE_State; int maxcounters=MAXCOUNTERS; int numcounters=NUMCOUNTERS; printf("MERGE Statistics thread starting\n"); signal_block(); // mask off signals handled by the main thread // adjust priority - run just above main data acquisition program nice(-2); // initialise Stats Rates NetVar arrays readNetInt("MERGE_Stats", 0, 1, &ScratchNetInt); for (i=1; i<(numcounters/maxcounters); i++) { sprintf(message,"MERGE_Stats%d",i); readNetInt(message, 0, 1, &ScratchNetInt); } readNetInt("MERGE_Rates", 0, 1, &ScratchNetInt); for (i=1; i<(numcounters/maxcounters); i++) { sprintf(message,"MERGE_Rates%d",i); readNetInt(message, 0, 1, &ScratchNetInt); } for(i=0;i