]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
1. Change MAXINPATH to 100 subsystems. 2. Change 32 subsystems to 100 subsystems...
authorhadaq <hadaq>
Mon, 31 Mar 2008 17:48:20 +0000 (17:48 +0000)
committerhadaq <hadaq>
Mon, 31 Mar 2008 17:48:20 +0000 (17:48 +0000)
hadaq/netmem.c

index 81f5e1105307bfbce85bbe94147fb8dd01b43963..f0a0a363ccfacea629874e7e8bd9b4ad4f31b13c 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/netmem.c,v 6.29 2007-10-05 09:17:26 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/netmem.c,v 6.30 2008-03-31 17:48:20 hadaq Exp $";
 
 
 #define _POSIX_C_SOURCE 199309L
@@ -19,7 +19,7 @@ static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hada
 #include "nettrans.h"
 #include "shmtrans.h"
 
-#define MAXINPATH 32
+#define MAXINPATH 100
 
 typedef struct TheArgsS {
        char inPathS[MAXINPATH][PARAM_MAX_NAME_LEN];
@@ -159,7 +159,7 @@ static char *unit(unsigned long v)
 
 static void statsDump(TheArgs *theArgs, NetTrans **my, int interval)
 {
-       static unsigned long lastBR[32];
+       static unsigned long lastBR[MAXINPATH];
        static time_t lastTime = 0;
        time_t dT;
        int i;
@@ -205,7 +205,7 @@ static void storeInfoStart(const char *n, time_t t, TheArgs *my)
        desParam(p);
 }
 
-static void storeInfoStop(const char *n, time_t t, Worker *w)
+static void storeInfoStop(const char *n, time_t t, Worker *w, TheArgs * my)
 {
        Param pS, *p = &pS;
        int i;
@@ -213,7 +213,7 @@ static void storeInfoStop(const char *n, time_t t, Worker *w)
 
        conSetupParam(p, getenv("DAQ_SETUP"));
 
-       for (i = 0; i < 32 && strcmp(w->statistics[i].name, "") != 0; i++) {
+       for (i = 0; i < my->nrOfMsgs*5+1 && strcmp(w->statistics[i].name, "") != 0; i++) {
                Param_storeInt(p, n, w->statistics[i].name, w->statistics[i].value);
        }
        strftime(s, 20, "%Y-%m-%dT%H:%M:%S", localtime(&t));
@@ -297,7 +297,16 @@ int main(int argc, char *argv[])
                }
                else{
                  /* otherwise use variable queue size */
-                 hadTuSize[i] = theArgs->varQSize[i] - HadTu_hdrSize();
+                 /* hadTuSize[i] = theArgs->varQSize[i] - HadTu_hdrSize(); */
+                 hadTuSize[i] = 51200;
+                 /* This 50 kB must be bigger than a size of a message which should usually 
+                  * be less than 32kB (UDP_packet_size - water_mark). However some HUGE messages can appear.
+                  * Those HUGE messages must be below hadTuSize!!! Otherwise the code will crash. 
+                  *
+                  * 50 kB  = 51200  Bytes 
+                  * 100 kB = 102400 Bytes 
+                  * 500 kB = 512000 Bytes 
+                  */
                }
        }
        storeInfoStart(argv[0], time(NULL), theArgs);
@@ -316,17 +325,28 @@ int main(int argc, char *argv[])
                                }
                        }
 
-                       msgsCompleted = NetTrans_multiRecv(netTrans, hadTu, hadTuSize, theArgs->nrOfMsgs);
+/*                      msgsCompleted = NetTrans_multiRecv(netTrans, hadTu, hadTuSize, theArgs->nrOfMsgs); */
+/*                     for (i = 0; i < theArgs->nrOfMsgs; i++) { */
+/*                             if ((msgsCompleted & (1 << i)) != 0) { */
+/*                                     ShmTrans_send(shmTrans[i]); */
+/*                                     hadTu[i] = NULL; */
+/*                             } */
+/*                     } */
 
+                       fd_set *fdSet;
+                       fdSet = NetTrans_multiReceive(netTrans, hadTu, hadTuSize, theArgs->nrOfMsgs);
                        for (i = 0; i < theArgs->nrOfMsgs; i++) {
-                               if ((msgsCompleted & (1 << i)) != 0) {
+                                if (FD_ISSET(netTrans[i]->fd, fdSet)) {
+                                 if (assembleMsg(netTrans[i], hadTu[i], hadTuSize[i])) {
                                        ShmTrans_send(shmTrans[i]);
                                        hadTu[i] = NULL;
+                                 }
                                }
-                       }
+                       }                       
+
                }
        }
-       storeInfoStop(argv[0], time(NULL), worker);
+       storeInfoStop(argv[0], time(NULL), worker, theArgs);
        statsDump(theArgs, netTrans, 0);
 
        for (i = 0; i < theArgs->nrOfMsgs; i++) {