Added debug output for discarded messages in netmem. To debug lost own trigger type...
authorJörn Adamczewski-Musch <j.adamczewski@gsi.de>
Tue, 6 May 2014 16:07:55 +0000 (18:07 +0200)
committerJörn Adamczewski-Musch <j.adamczewski@gsi.de>
Tue, 6 May 2014 16:07:55 +0000 (18:07 +0200)
hadaq/netmem.c
hadaq/nettrans.c
hadaq/nettrans.h

index 192b715eb26b25c90415831b315ae5bc3bcc3940..b8222f2218afe6cb2fbbe7f33968a5bd15c2b5ed 100644 (file)
@@ -460,6 +460,8 @@ static int checkDataSources(TheArgs *theArgs, TheStats *theStats)
                                }
                        }
 
+                       
+
                        if (go2exit)
                                return -1;
 
@@ -865,10 +867,21 @@ int main(int argc, char *argv[])
                        NetTrans_multiReceive(netTrans, fdSet, theArgs->nrOfMsgs);
                        for (i = 0; i < theArgs->nrOfMsgs; i++) {
                                if (FD_ISSET(netTrans[i]->fd, fdSet)) {
-                                       if (assembleMsg(netTrans[i], hadTu[i], hadTuSize[i])) {
+                                 if (assembleMsg(netTrans[i], hadTu[i], hadTuSize[i])) {
                                                ShmTrans_send(shmTrans[i]);
                                                hadTu[i] = NULL;
                                        }
+                                 else if (netTrans[i]->discardflag!=0)
+                                   {
+                                     unsigned subid=0;
+                                     char descriptor[DESCLEN]; 
+                                     getDataSender(theArgs->portNr[i],&subid,descriptor);
+                                     sprintf(msglog," <W> Input:%d, port:0x%x subevent:0x%x(%s) - %s",  i,theArgs->portNr[i],subid,descriptor, netTrans[i]->discardmessage);
+                                     storeLogInfo(theArgs, msglog);
+                                     netTrans[i]->discardflag=0;
+
+                                   }
+
                                }
                        }
 
index db1b5ab8a7a3502aecdbfee6626840b0ecdda9fa..d7cc964ea4ac92d5ec500c6d69277d5a63ff0b89 100644 (file)
@@ -24,6 +24,10 @@ static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hada
 #include "worker.h"
 #include "nettrans.h"
 
+static char* transmsglog[300];
+
+#define LOGDISCARDEDMESSAGEINTERVAL 100
+
 static int min(int a, int b)
 {
        return a < b ? a : b;
@@ -343,10 +347,31 @@ int assembleMsg(NetTrans *my, void *hadTu, size_t size)
        } else {
                size_t size;
 
+
                size = adjustedSize(my, hadTu);
 
                if (my->offset != size || memcmp(HadTu_end(hadTu), hadTu, 32)) {
-                       (*my->msgsDiscarded)++;
+                
+                       (*my->msgsDiscarded)++;
+                       /* JAM: put here debug output for discarded multieventqueue messages:*/
+                       if(((*my->msgsDiscarded) % LOGDISCARDEDMESSAGEINTERVAL)==0)
+                         {
+                           int cursor=0; 
+                           my->discardflag=1;
+                           if(my->offset != size)
+                             {
+                              
+                               cursor=sprintf(my->discardmessage, "assembleMsg: msg %d discarded because packetoffset%d != hadtu size:%d ", (*my->msgsDiscarded), my->offset, size);
+                             }
+                             if( memcmp(HadTu_end(hadTu), hadTu, 32))
+                               {                                 
+                                 sprintf((my->discardmessage+cursor), "assembleMsg: msg %d discarded because mismatch of hadtu header and trailer", (*my->msgsDiscarded));
+                               }                             
+
+                         }
+                       
+
+
                        retVal = 0;
                } else {
                        (*my->msgsReceived)++;
index 1471daeaf725b528fd34e89d6dbdbdcaa381f80b..791604083a1b0501eab1d40a16706ba34698e0d5 100644 (file)
@@ -38,6 +38,8 @@ typedef struct NetTransS {
        unsigned long *msgsReceived;
        unsigned long *msgsDiscarded;
        unsigned long *bytesReceived;
+        int discardflag;
+        char discardmessage[512];
 } NetTrans;
 
 int NetTrans_invariant(const NetTrans *my);