static char *rcsId =
- "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.83 2008-05-28 14:54:22 hadaq Exp $";
+ "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.84 2008-06-03 10:13:21 hadaq Exp $";
#define _POSIX_C_SOURCE 199309L
unsigned long *evtbuildBuff[MAXINPATH];
unsigned long *nrOfMsgs;
unsigned long *runId;
- unsigned long *evtsCompletePS;
- unsigned long *bytesWrittenPS;
+ unsigned long *evtsCompleteRate;
+ unsigned long *bytesWrittenRate;
+ unsigned long *evtsDiscardedRate;
} TheStats;
static jmp_buf terminateJmp;
static unsigned long lastEvtsComplete;
static unsigned long lastBytesWritten;
+ static unsigned long lastEvtsDisc;
static time_t t_0 = 0;
float buffSize, queueSize;
time_t t, dT;
}
/* Add more statistic for evtsComplete and bytesWritten per second */
- (*my->evtsCompletePS) = (*my->evtsComplete - lastEvtsComplete) / dT;
- (*my->bytesWrittenPS) = (*my->bytesWritten - lastBytesWritten) / dT;
+ if( (*my->evtsComplete) >= lastEvtsComplete )
+ (*my->evtsCompleteRate) = (*my->evtsComplete - lastEvtsComplete) / dT;
+ else
+ (*my->evtsCompleteRate) = (*my->evtsComplete);
+
+ if( (*my->bytesWritten) >= lastBytesWritten)
+ (*my->bytesWrittenRate) = (*my->bytesWritten - lastBytesWritten) / dT;
+ else
+ (*my->bytesWrittenRate) = (*my->bytesWritten);
+
+ if( (*my->evtsDiscarded) >= lastEvtsDisc)
+ (*my->evtsDiscardedRate) = (*my->evtsDiscarded - lastEvtsDisc) / dT;
+ else
+ (*my->evtsDiscardedRate) = (*my->evtsDiscarded);
+
+ lastEvtsComplete = *my->evtsComplete;
+ lastBytesWritten = *my->bytesWritten;
+ lastEvtsDisc = *my->evtsDiscarded;
}
t_0 = t;
}
}
- theStats->evtsDiscarded = Worker_addStatistic (worker, "evtsDiscarded");
- theStats->evtsComplete = Worker_addStatistic (worker, "evtsComplete");
- theStats->evtsCompletePS = Worker_addStatistic (worker, "evtsCompletePS");
- theStats->evtsDataError = Worker_addStatistic (worker, "evtsDataError");
- theStats->evtsTagError = Worker_addStatistic (worker, "evtsTagError");
- theStats->bytesWritten = Worker_addStatistic (worker, "bytesWritten");
- theStats->bytesWrittenPS = Worker_addStatistic (worker, "bytesWrittenPS");
- theStats->runId = Worker_addStatistic (worker, "runId");
- (*theStats->runId) = 0; /* initialize to zero */
+ theStats->evtsDiscarded = Worker_addStatistic (worker, "evtsDiscarded");
+ theStats->evtsDiscardedRate = Worker_addStatistic (worker, "evtsDiscardedRate");
+ theStats->evtsComplete = Worker_addStatistic (worker, "evtsComplete");
+ theStats->evtsCompleteRate = Worker_addStatistic (worker, "evtsCompleteRate");
+ theStats->evtsDataError = Worker_addStatistic (worker, "evtsDataError");
+ theStats->evtsTagError = Worker_addStatistic (worker, "evtsTagError");
+ theStats->bytesWritten = Worker_addStatistic (worker, "bytesWritten");
+ theStats->bytesWrittenRate = Worker_addStatistic (worker, "bytesWrittenRate");
+ theStats->runId = Worker_addStatistic (worker, "runId");
+ (*theStats->runId) = 0; /* initialize to zero */
unsigned long *retVal = NULL;
theStats->evtsRes = (unsigned long *) &retVal;