]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
Changed log output for "popped subevents" case. Now frequency of warning is downscale...
authorhadaq <hadaq>
Fri, 12 Aug 2011 20:49:45 +0000 (20:49 +0000)
committerhadaq <hadaq>
Fri, 12 Aug 2011 20:49:45 +0000 (20:49 +0000)
Some small code corrections.
JAM

hadaq/evtbuild.c

index 77fab6bb0dcf0ea5f58b6267321f7aac9ceff337..05cd5c66f769856da0b535e0302c2045ca908eb8 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.151 2011-08-10 11:55:41 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.152 2011-08-12 20:49:45 hadaq Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #define SYSLOG_NAMES
@@ -53,6 +53,8 @@ static RFILE *fRemote = NULL;
 #define DAQVERSION 2                   /* needed by Hydra unpackers */
 
 #define RUNID_INFO_DT  600             /* time in s until not available runid info is logged  */
+#define LOST_SUBEVT_LIMIT 10000        /* number of popped subevents per trigger sequence until warning */
+#define LOST_SUBEVT_TERM  10   /* terminate after this number of lost sub warnings per trigger sequence */
 
 #define NEVTIDS 64UL                   /* must be 2^n */
 #define NEVTIDS_IN_FILE 0UL            /* must be 2^n */
@@ -295,7 +297,7 @@ int isMismatchCritical(TheArgs *theArgs, TheStats *my)
 
        if (theArgs->maxTrigMismatch == -1) {
                theArgs->maxTrigMismatch = 30;  /* JAM: set reasonable default if not specified */
-               sprintf(msglog, "<I> Critical trigger mismatch ratio takes default of %d % ", theArgs->maxTrigMismatch);
+               sprintf(msglog, "<I> Critical trigger mismatch ratio takes default of %d %% ", theArgs->maxTrigMismatch);
                storeLogInfo(theArgs, msglog);
                /*return retVal; */
        }
@@ -1105,9 +1107,9 @@ int main(int argc, char *argv[])
 
        int brokenEvtCnt = 0;
        unsigned long popCnt = 0;
+       unsigned long popTermCnt = 0;
 
        currId = 0;
-       int popMaster = 0;
 
        while (setjmp(terminateJmp) == 0) {
                void *evt;
@@ -1185,7 +1187,7 @@ int main(int argc, char *argv[])
 
                evt = newEvt(EvtDecoding_64bitAligned, EvtId_data);
                popCnt = 0;                             /* Counter of popped up subevents */
-               popMaster = 1;                  /* flag to pop subevent from master stream i=0 */
+               popTermCnt = 0;                 /* defines termination condition for popCnt */
                for (i = 0; i < theArgs->nrOfMsgs && !evtIsBroken; i += step) {
                        uint32_t trigNr;
                        uint32_t trigTag;
@@ -1273,7 +1275,7 @@ int main(int argc, char *argv[])
 
                                        evt = Evt_appendSubEvt(evt, subEvt);
                                }
-                               HadTuQueue_pop(hadTuQueue[i]);  /* delay pop of master stream until broken checked */
+                               HadTuQueue_pop(hadTuQueue[i]);
                                step = 1;
                        } else if (trigNr < currTrigNr) {
                                if (theArgs->debugOptsCnt) {
@@ -1285,17 +1287,22 @@ int main(int argc, char *argv[])
                                HadTuQueue_pop(hadTuQueue[i]);
                                step = 0;
                                popCnt++;
-                               if (popCnt > 10000) {
+                               if (popCnt >= LOST_SUBEVT_LIMIT) {
                                        if (theArgs->debugOptsCnt)
                                                Debug_printPopTrigMismatch(theArgs, theStats, theDebug, i);
 
-                                       /* JAM: do not bail out, but display problem message.
-                                        * Termination should be done by real discarded events amount
-                                        * Or by human operator...*/
-                                       sprintf(msglog, "<W> Subevent stream %d has popped  nr:%d queue entries to sync with master stream!", i,
-                                                       popCnt);
-                                       storeLogInfo(theArgs, msglog);
-                                       /* goto bailOut1; */
+                                       /* JAM: do not bail out immediately, but display problem message first.
+                                        * Scale down warning message frequency:*/
+                                       if ((popCnt % LOST_SUBEVT_LIMIT) == 0) {
+                                               sprintf(msglog, "<W> Subevent stream %d has popped  nr:%d queue entries to sync with master stream!", i,
+                                                               popCnt);
+                                               storeLogInfo(theArgs, msglog);
+                                               popTermCnt++;
+                                       }
+                                       if (popTermCnt > LOST_SUBEVT_TERM) {
+                                               storeLogInfo(theArgs, "<E> too many lost subevents. Exiting now!");
+                                               goto bailOut1;
+                                       }
                                }
                        } else {
                                if (theArgs->debugOptsCnt) {