]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
errBitStat added. Sergey.
authorhadaq <hadaq>
Thu, 28 Oct 2010 17:02:07 +0000 (17:02 +0000)
committerhadaq <hadaq>
Thu, 28 Oct 2010 17:02:07 +0000 (17:02 +0000)
hadaq/evtbuild.c

index 71e281b6f01eb819800b81a38537b5f146135aa1..0f0afbbfb96f8fed8bddbbabe2c1ce0fb578124d 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.139 2010-10-11 15:42:32 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.140 2010-10-28 17:02:07 hadaq Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #define SYSLOG_NAMES
@@ -982,6 +982,7 @@ int main(int argc, char *argv[])
                sprintf(buf, "evtId%d", i);
                theStats->evtId[i] = Worker_addStatistic(worker, buf);
        }
+
        for (i = 0; i < theArgs->nrOfMsgs; i++) {
                char buf[WORKER_MAX_NAME_LEN];
 
@@ -1011,6 +1012,30 @@ int main(int argc, char *argv[])
                }
        }
 
+       /* 
+        * Statistics of ErrorBits: Maximally five different errorBit
+        * patterns can be monitored.
+        */
+       for (i = 0; i < 5; i++) {
+               char buf[WORKER_MAX_NAME_LEN];
+               sprintf(buf, "errBitPtrn%d", i);
+               theStats->errBitPtrn[i] = Worker_addStatistic(worker, buf);
+       }
+
+       for (i = 0; i < theArgs->nrOfMsgs; i++) {
+               char buf[WORKER_MAX_NAME_LEN];
+               sprintf(buf, "errBitStat1_%d", i);
+               theStats->errBitStat0[i] = Worker_addStatistic(worker, buf);
+               sprintf(buf, "errBitStat2_%d", i);
+               theStats->errBitStat1[i] = Worker_addStatistic(worker, buf);
+               sprintf(buf, "errBitStat3_%d", i);
+               theStats->errBitStat2[i] = Worker_addStatistic(worker, buf);
+               sprintf(buf, "errBitStat4_%d", i);
+               theStats->errBitStat3[i] = Worker_addStatistic(worker, buf);
+               sprintf(buf, "errBitStat5_%d", i);
+               theStats->errBitStat4[i] = Worker_addStatistic(worker, buf);
+       }
+
        /* Add statistic for fill levels of buffers. */
        for (i = 0; i < theArgs->nrOfMsgs; i++) {
                char buf[WORKER_MAX_NAME_LEN];
@@ -1132,6 +1157,39 @@ int main(int argc, char *argv[])
 
                        (*theStats->trigNr[i]) = SubEvt_trigNr(subEvt);
                        (*theStats->errBit[i]) = SubEvt_errBit(subEvt);
+
+                       int ptrn;
+                       for (ptrn = 0; ptrn < ERRBITPTRNMAX; ptrn++) {
+                               if ((*theStats->errBitPtrn[ptrn]) == 0) {
+                                       (*theStats->errBitPtrn[ptrn]) = SubEvt_errBit(subEvt);
+                                       if (ptrn == 0)
+                                               (*theStats->errBitStat0[i])++;
+                                       else if (ptrn == 1)
+                                               (*theStats->errBitStat1[i])++;
+                                       else if (ptrn == 2)
+                                               (*theStats->errBitStat2[i])++;
+                                       else if (ptrn == 3)
+                                               (*theStats->errBitStat3[i])++;
+                                       else if (ptrn == 4)
+                                               (*theStats->errBitStat4[i])++;
+
+                                       break;
+                               } else if ((*theStats->errBitPtrn[ptrn]) == SubEvt_errBit(subEvt)) {
+                                       if (ptrn == 0)
+                                               (*theStats->errBitStat0[i])++;
+                                       else if (ptrn == 1)
+                                               (*theStats->errBitStat1[i])++;
+                                       else if (ptrn == 2)
+                                               (*theStats->errBitStat2[i])++;
+                                       else if (ptrn == 3)
+                                               (*theStats->errBitStat3[i])++;
+                                       else if (ptrn == 4)
+                                               (*theStats->errBitStat4[i])++;
+
+                                       break;
+                               }
+                       }
+
                        if (theArgs->debugOptsCnt) {
                                (*theStats->debugWord[i]) = SubEvt_debugWord(subEvt);
                                (*theStats->debugSize[i]) = SubEvt_size(subEvt);