From: Jörn Adamczewski-Musch Date: Tue, 29 Apr 2014 06:28:06 +0000 (+0200) Subject: netmem: Added more detailled error output of missing subsystem from non delivered... X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=097d7326038991ecc81edbbfcd5f1fbd80d22704;p=daqdata.git netmem: Added more detailled error output of missing subsystem from non delivered port number evtuild: extended trigger number mask to 20 bits --- diff --git a/hadaq/evtbuild.c b/hadaq/evtbuild.c index a4617d5..36c53fc 100644 --- a/hadaq/evtbuild.c +++ b/hadaq/evtbuild.c @@ -1279,8 +1279,8 @@ int main(int argc, char *argv[]) } if (i == 0) { - currTrigNr = (SubEvt_trigNr(subEvt) >> 8) & 0xffff; - /* JAM: use only 16 bit as workaround for TRB2/3 differences*/ + currTrigNr = (SubEvt_trigNr(subEvt) >> 8) & 0xfffff; + /* JAM: use only 20 bit as workaround for TRB2/3 differences*/ currTrigTag = SubEvt_trigNr(subEvt) & 0xff; if (theArgs->evtId != 0) @@ -1313,8 +1313,8 @@ int main(int argc, char *argv[]) } - trigNr = (SubEvt_trigNr(subEvt) >> 8) & 0xffff; - /* JAM: use only 16 bit as workaround for TRB2/3 differences*/ + trigNr = (SubEvt_trigNr(subEvt) >> 8) & 0xfffff; + /* JAM: use only 20 bit as workaround for TRB2/3 differences*/ trigTag = SubEvt_trigNr(subEvt) & 0xff; #ifdef TRIGNO_DEBUG diff --git a/hadaq/netmem.c b/hadaq/netmem.c index 7911b97..192b715 100644 --- a/hadaq/netmem.c +++ b/hadaq/netmem.c @@ -20,6 +20,11 @@ static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hada #include "shmtrans.h" #define MAXINPATH 100 +#define DESCLEN 64 + + + + static char msglog[300]; @@ -61,6 +66,19 @@ typedef struct TheStatsS { unsigned long *coreNr; } TheStats; +typedef struct dataSourceMapS { + unsigned long portNr; /* input port number*/ + unsigned long subId; /* subevent id*/ + char description[DESCLEN]; /* description of data sender hub*/ + +} dataSourceMap; + + + +static dataSourceMap theDataSenders[MAXINPATH]; +static int maxdatasource=0; + + static jmp_buf terminateJmp; void sigHandler(int sig) @@ -319,10 +337,86 @@ void storeLogInfo(TheArgs *theArgs, const char *msg) } } + + +static void InitDataSenders() +{ + int i; + FILE* fp; + char *line = NULL; + size_t len = 0; + ssize_t read; + int subid; + int port; + int on; + char descriptor [DESCLEN]; + char dummy [DESCLEN]; + + for(i=0; i< MAXINPATH; ++i) + { + theDataSenders[i].portNr=0; + theDataSenders[i].subId=0; + snprintf(theDataSenders[i].description, MAXINPATH, "unknown sender"); + } + + + + + /* TODO: get subid and descriptions from hadesaq/main/data_sources.db + we add manually the port lsb here*/ + fp = fopen("data_sources_ports.db", "r"); + if(fp==NULL) + { + printf ("Could not read map of data sources data_sources_ports.db. \n"); + return; + } + i=0; + + while ((read = getline(&line, &len, fp)) != -1) { + + /*printf("Retrieved line of length %zu :\n", read); + printf("%s", line);*/ + if (line[0]=='#') continue; + sscanf (line, "%x %d %x %s %s", &subid, &on, &port, descriptor, dummy); + theDataSenders[i].subId=subid; + theDataSenders[i].portNr=port; + snprintf(theDataSenders[i].description, DESCLEN, descriptor); + printf ("i:%d (0x%x), port:0x%x descriptor=%s \n",i,subid, port, descriptor); + ++i; + if(i>MAXINPATH) break; + } + maxdatasource=i; + free(line); + fclose(fp); + + +} + +/* find out subeventid and data sender description JAM*/ +static void getDataSender(unsigned portNum, unsigned int* subid, char* description) +{ +int i; +for(i=0; inrOfMsgs; i++) { if (dataSources[i] == 0) { - sprintf(msglog, " daq_netmem: source %d, port %lu: no data received.", i, theArgs->portNr[i]); + /* here more precise information which source failed JAM*/ + getDataSender(theArgs->portNr[i],&subid,descriptor); + + sprintf(msglog, " daq_netmem: source %d, port %lu (0x%x) => subevent 0x%x (%s): no data received.", + i, theArgs->portNr[i], theArgs->portNr[i], subid, descriptor); fprintf(stderr, "%s\n", msglog); storeLogInfo(theArgs, msglog); @@ -621,7 +719,7 @@ int main(int argc, char *argv[]) openlog(argv[0], LOG_PID | LOG_PERROR, LOG_LOCAL0); setlogmask(LOG_UPTO(LOG_INFO)); - + InitDataSenders(); argsDefault(theArgs); argsFromParam(theArgs, argc, argv); if (0 > argsFromCL(theArgs, argc, argv)) {