From: hadaq Date: Thu, 17 Jun 2010 13:45:01 +0000 (+0000) Subject: size added to debug. Sergey. X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=927000c38675b1ea8321c64d98022de63d7ef85f;p=daqdata.git size added to debug. Sergey. --- diff --git a/hadaq/evtbuild.c b/hadaq/evtbuild.c index 5a72626..21a3980 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.110 2010-06-16 16:11:18 hadaq Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.111 2010-06-17 13:45:01 hadaq Exp $"; #define _POSIX_C_SOURCE 199309L #define SYSLOG_NAMES @@ -87,6 +87,7 @@ typedef struct TheArgsS { int debug_trignr; int debug_errbit; int debug_word; + int debug_size; unsigned long isStandalone; unsigned long priority; @@ -139,6 +140,7 @@ typedef struct TheStatsS { unsigned long *trigNr[MAXINPATH]; unsigned long *errBit[MAXINPATH]; unsigned long *debugWord[MAXINPATH]; + unsigned long *debugSize[MAXINPATH]; unsigned long *evtsRes; unsigned long *evtbuildBuff[MAXINPATH]; unsigned long *nrOfMsgs; @@ -155,6 +157,9 @@ typedef struct TheDebugS { unsigned long *debugWords[MAXINPATH]; unsigned long debugWordsS[MAXINPATH][MAXDEBUGEVTS]; unsigned long debugWordsCnt[MAXINPATH]; + unsigned long *debugSizes[MAXINPATH]; + unsigned long debugSizesS[MAXINPATH][MAXDEBUGEVTS]; + unsigned long debugSizesCnt[MAXINPATH]; unsigned long evtsLastBuilt[MAXINPATH]; } TheDebug; @@ -355,9 +360,11 @@ static void initDebug(TheDebug * theDebug) theDebug->evtsBroken[i] = theDebug->evtsBrokenS[i]; theDebug->errBits[i] = theDebug->errBitsS[i]; theDebug->debugWords[i] = theDebug->debugWordsS[i]; + theDebug->debugSizes[i] = theDebug->debugSizesS[i]; theDebug->evtsBrokenCnt[i] = 0; theDebug->errBitsCnt[i] = 0; theDebug->debugWordsCnt[i] = 0; + theDebug->debugSizesCnt[i] = 0; theDebug->evtsLastBuilt[i] = 0; } } @@ -415,6 +422,7 @@ static void argsDefault(TheArgs *my) my->debug_trignr = 0; my->debug_errbit = 0; my->debug_word = 0; + my->debug_size = 0; for (i = 0; i < PARAM_MAX_ARRAY_LEN; i++) { my->debugOpts[i] = my->debugOptsS[i]; @@ -652,6 +660,8 @@ static int argsCheck(TheArgs *my) my->debug_errbit = 1; } else if (strcmp(my->debugOpts[i], "word") == 0) { my->debug_word = 1; + } else if (strcmp(my->debugOpts[i], "size") == 0) { + my->debug_size = 1; } else { printf("Error: wrong argument is given in the option -D|--debug.\n"); return 1; @@ -728,8 +738,8 @@ static int fillDebug(TheArgs *theArgs, TheStats *theStats, TheDebug * theDebug, int j; if (strcmp(evtStatus, "pop") == 0) { - if (theDebug->evtsBrokenCnt[i] == MAXDEBUGEVTS || - theDebug->errBitsCnt[i] == MAXDEBUGEVTS || theDebug->debugWordsCnt[i] == MAXDEBUGEVTS) + if (theDebug->evtsBrokenCnt[i] == MAXDEBUGEVTS || theDebug->errBitsCnt[i] == MAXDEBUGEVTS || + theDebug->debugWordsCnt[i] == MAXDEBUGEVTS || theDebug->debugSizesCnt[i] == MAXDEBUGEVTS) return MAXDEBUGEVTS; j = theDebug->evtsBrokenCnt[i]; @@ -737,15 +747,17 @@ static int fillDebug(TheArgs *theArgs, TheStats *theStats, TheDebug * theDebug, theDebug->evtsBroken[i][j] = (*theStats->trigNr[i]); theDebug->errBits[i][j] = (*theStats->errBit[i]); theDebug->debugWords[i][j] = (*theStats->debugWord[i]); + theDebug->debugSizes[i][j] = (*theStats->debugSize[i]); theDebug->evtsBrokenCnt[i]++; theDebug->errBitsCnt[i]++; theDebug->debugWordsCnt[i]++; + theDebug->debugSizesCnt[i]++; } else if (strcmp(evtStatus, "broken") == 0) { int k; for (k = 0; k < i; k++) { - if (theDebug->evtsBrokenCnt[k] == MAXDEBUGEVTS || + if (theDebug->evtsBrokenCnt[k] == MAXDEBUGEVTS || theDebug->debugSizesCnt[i] == MAXDEBUGEVTS || theDebug->errBitsCnt[k] == MAXDEBUGEVTS || theDebug->debugWordsCnt[k] == MAXDEBUGEVTS) return MAXDEBUGEVTS; @@ -754,10 +766,12 @@ static int fillDebug(TheArgs *theArgs, TheStats *theStats, TheDebug * theDebug, theDebug->evtsBroken[k][j] = (*theStats->trigNr[k]); theDebug->errBits[k][j] = (*theStats->errBit[k]); theDebug->debugWords[k][j] = (*theStats->debugWord[k]); + theDebug->debugSizes[k][j] = (*theStats->debugSize[k]); theDebug->evtsBrokenCnt[k]++; theDebug->errBitsCnt[k]++; theDebug->debugWordsCnt[k]++; + theDebug->debugSizesCnt[k]++; } } else { printf("fillDebug: Event has unknown status!\n"); @@ -814,6 +828,19 @@ static void printDebug(TheArgs *theArgs, TheStats *theStats, TheDebug * theDebug printf("\n"); } + /* Print sizes */ + if (theArgs->debug_size) { + printf("%7s", "size"); + for (i = 0; i < theArgs->nrOfMsgs; i++) { + if (j < theDebug->debugSizesCnt[i]) { + printf(" %08x", theDebug->debugSizes[i][j]); + } else { + printf("%9s", "-"); + } + } + printf("\n"); + } + /* Print error bits */ if (theArgs->debug_errbit) { printf("%7s", "errBit"); @@ -1878,6 +1905,12 @@ int main(int argc, char *argv[]) sprintf(buf, "debugWord%d", i); theStats->debugWord[i] = Worker_addStatistic(worker, buf); } + for (i = 0; i < theArgs->nrOfMsgs; i++) { + char buf[WORKER_MAX_NAME_LEN]; + + sprintf(buf, "debugSize%d", i); + theStats->debugSize[i] = Worker_addStatistic(worker, buf); + } } /* Add statistic for fill levels of buffers. */ @@ -1990,8 +2023,10 @@ int main(int argc, char *argv[]) (*theStats->trigNr[i]) = SubEvt_trigNr(subEvt); (*theStats->errBit[i]) = SubEvt_errBit(subEvt); - if (theArgs->debugOptsCnt) + if (theArgs->debugOptsCnt) { (*theStats->debugWord[i]) = SubEvt_debugWord(subEvt); + (*theStats->debugSize[i]) = SubEvt_size(subEvt); + } if (i == 0) { currTrigNr = SubEvt_trigNr(subEvt) >> 8;