From: hadaq Date: Wed, 10 Aug 2011 11:45:07 +0000 (+0000) Subject: Removed again wrong bugfix for subevent sync (nice try...). X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=178a99fd595da8873c526a793a36c4f0291c0aef;p=daqdata.git Removed again wrong bugfix for subevent sync (nice try...). Disabled bailing out when too many subevents are popped in one queue for a warning message. Provided default value of 30% to ensure that a reasonable critical event discarding condition is used if not specified in command line. --- diff --git a/hadaq/evtbuild.c b/hadaq/evtbuild.c index 8855263..d53079b 100644 --- a/hadaq/evtbuild.c +++ b/hadaq/evtbuild.c @@ -1,4 +1,4 @@ -static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.149 2011-08-09 14:56:08 hadaq Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.150 2011-08-10 11:45:07 hadaq Exp $"; #define _POSIX_C_SOURCE 199309L #define SYSLOG_NAMES @@ -258,8 +258,8 @@ unsigned long getRunId(TheArgs *my) struct timespec tv = { 0, 1e+8 }; static time_t t0 = 0; + t0 = time(NULL); time_t t, dT; - while (my->epicsCtrl && myRunId == 0) { sprintf(buf, "daq_evtbuild%s", my->shmname); @@ -294,7 +294,10 @@ int isMismatchCritical(TheArgs *theArgs, TheStats *my) int retVal = 0; if (theArgs->maxTrigMismatch == -1) { - return retVal; + theArgs->maxTrigMismatch = 0.3; /* JAM: set reasonable default if not specified */ + sprintf(msglog, " Critical trigger mismatch ratio takes default of %f", theArgs->maxTrigMismatch); + storeLogInfo(theArgs, msglog); + /*return retVal; */ } /* min file size to start checking */ @@ -1270,9 +1273,7 @@ int main(int argc, char *argv[]) evt = Evt_appendSubEvt(evt, subEvt); } - if (i > 0) { - HadTuQueue_pop(hadTuQueue[i]); /* delay pop of master stream until broken checked */ - } + HadTuQueue_pop(hadTuQueue[i]); /* delay pop of master stream until broken checked */ step = 1; } else if (trigNr < currTrigNr) { if (theArgs->debugOptsCnt) { @@ -1283,13 +1284,18 @@ int main(int argc, char *argv[]) /* BUGBUG subevt discarded, not in statistic */ HadTuQueue_pop(hadTuQueue[i]); step = 0; - popMaster = 0; /* do not pop subevent of master channel in this case. needed for next cycle */ - failTrigNr = trigNr; /* remember skipped trigger number for debug output */ popCnt++; if (popCnt > 10000) { if (theArgs->debugOptsCnt) Debug_printPopTrigMismatch(theArgs, theStats, theDebug, i); - goto bailOut1; + + /* JAM: do not bail out, but display problem message. + * Termination should be done by real discarded events amount + * Or by human operator...*/ + sprintf(msglog, " Subevent stream %d has popped nr:%d queue entries to sync with master stream!", i, + popCnt); + storeLogInfo(theArgs, msglog); + /* goto bailOut1; */ } } else { if (theArgs->debugOptsCnt) { @@ -1306,23 +1312,6 @@ int main(int argc, char *argv[]) } } - /* New JAM: treat case that master stream has lost a packet */ - if (popMaster) { - /* Regular case: delayed pop of last master stream entry after check ok */ - HadTuQueue_pop(hadTuQueue[0]); - if (HadTuQueue_empty(hadTuQueue[0])) { - desHadTuQueue(hadTuQueue[0]); - free(hadTuQueue[0]); - hadTuQueue[0] = NULL; - ShmTrans_free(shmTrans[0]); - } - } else { - /* display error and keep last event in hope for later synchronization */ - sprintf(msglog, " Master message stream has missed trigger sequence nr:%d. Kept subevent nr %d in master queue", - failTrigNr, currTrigNr); - storeLogInfo(theArgs, msglog); - } - if (!evtIsBroken) { if (theArgs->debugOptsCnt) {