]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
Try: flush all queues when encountering too many discarded subevents at synchronizati...
authorhadaq <hadaq>
Tue, 16 Aug 2011 10:54:41 +0000 (10:54 +0000)
committerhadaq <hadaq>
Tue, 16 Aug 2011 10:54:41 +0000 (10:54 +0000)
JAM

hadaq/evtbuild.c

index d8efa84bca0e8afc7b2aaadac569b39bf7ebd3fa..c4fb600ae5813bb1ceb2df6cb3b828767769edb5 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.153 2011-08-14 14:18:39 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.154 2011-08-16 10:54:41 hadaq Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #define SYSLOG_NAMES
@@ -53,8 +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 50000        /* number of popped subevents per trigger sequence until warning */
-#define LOST_SUBEVT_TERM  20   /* terminate after this number of lost sub warnings per trigger sequence */
+#define LOST_SUBEVT_LIMIT 10000        /* number of popped subevents per trigger sequence until warning */
+#define LOST_SUBEVT_DROP  2            /* drop all queue contents 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 */
@@ -296,7 +296,7 @@ int isMismatchCritical(TheArgs *theArgs, TheStats *my)
        int retVal = 0;
 
        if (theArgs->maxTrigMismatch == -1) {
-               theArgs->maxTrigMismatch = 30;  /* JAM: set reasonable default if not specified */
+               theArgs->maxTrigMismatch = 90;  /* JAM: set reasonable default if not specified */
                sprintf(msglog, "<I> Critical trigger mismatch ratio takes default of %d %% ", theArgs->maxTrigMismatch);
                storeLogInfo(theArgs, msglog);
                /*return retVal; */
@@ -874,7 +874,7 @@ static int rfio_closeConnection(TheArgs *theArgs)
 /* BUGBUG bailOut not proper yet */
 int main(int argc, char *argv[])
 {
-       int i;
+       int i, q;
        TheArgs theArgsS, *theArgs = &theArgsS;
        TheStats theStatsS, *theStats = &theStatsS;
        TheDebug theDebugS, *theDebug = &theDebugS;
@@ -1302,9 +1302,21 @@ int main(int argc, char *argv[])
                                                storeLogInfo(theArgs, msglog);
                                                popTermCnt++;
                                        }
-                                       if (popTermCnt > LOST_SUBEVT_TERM) {
-                                               storeLogInfo(theArgs, "<E> too many lost subevents. Exiting now!");
-                                               goto bailOut1;
+                                       if (popTermCnt > LOST_SUBEVT_DROP) {
+                                               /*  storeLogInfo(theArgs, "<E> too many lost subevents. Exiting now!");
+                                                  goto bailOut1; */
+
+                                               /* throw away all queues and start again: */
+                                               storeLogInfo(theArgs, "<E> too many lost subevents. Dropping all queues!");
+                                               for (q = 0; q < theArgs->nrOfMsgs; q++) {
+                                                       HadTuQueue_clear(hadTuQueue[q]);
+                                                       desHadTuQueue(hadTuQueue[q]);
+                                                       free(hadTuQueue[q]);
+                                                       hadTuQueue[q] = NULL;
+                                                       ShmTrans_free(shmTrans[q]);
+                                               }
+                                               i = 0;  /* start again with evaluating other double buffer */
+                                               step = 1;
                                        }
                                }
                        } else {