]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
runId access fixed. Sergey.
authorhadaq <hadaq>
Mon, 19 Apr 2010 14:03:18 +0000 (14:03 +0000)
committerhadaq <hadaq>
Mon, 19 Apr 2010 14:03:18 +0000 (14:03 +0000)
hadaq/evtbuild.c

index daf9fc1ce70d8b982a5470f931502fdb04a89935..994ad163103d832a2cd4f1756b5014b816375a12 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.103 2010-04-16 14:20:19 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.104 2010-04-19 14:03:18 hadaq Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #define SYSLOG_NAMES
@@ -301,7 +301,7 @@ static void argsDefault(TheArgs *my)
        strcpy(my->lustrePath, "");
        my->buffStat = 0;
        my->epicsCtrl = 0;
-       my->ebnum = 1;
+       my->ebnum = 0;
        my->ignore = 0;
 
        /* read path from DAQ_SETUP and define full file name */
@@ -742,7 +742,7 @@ static void statsBufferDump(TheArgs *theArgs, TheStats *my, float interval, HadT
 
                                unsigned long runId2print;
                                char buf[_POSIX_PATH_MAX];
-                               sprintf(buf, "%s%s", progName, theArgs->shmname);
+                               sprintf(buf, "%s%s", "daq_evtbuild", theArgs->shmname);
                                Worker_getStatistic(buf, "runId", &runId2print);
                                printf("ioc: RUN Id = %lu  RUN Nr = %lu\n", runId2print, runNr);
                        }
@@ -755,14 +755,28 @@ static void statsBufferDump(TheArgs *theArgs, TheStats *my, float interval, HadT
 unsigned long getRunId(TheArgs *my)
 {
        unsigned long myRunId = 0;
+       char buf[_POSIX_PATH_MAX];
        struct timespec tv = { 0, 1e+8 };
 
+       static time_t t0 = 0;
+       time_t t, dT;
+
        while (my->epicsCtrl && myRunId == 0) {
-               if (Worker_getStatistic("daq_evtbuild", "runId", &myRunId) == -1) {
+
+               sprintf(buf, "daq_evtbuild%s", my->shmname);
+
+               if (Worker_getStatistic(buf, "runId", &myRunId) == -1) {
                        fprintf(stderr, "<E> evtbuild.c: getRunId: Worker_getStatistic: cannot get runId!\n");
                        sleep(1);
                } else {
 
+                       t = time(NULL);
+                       dT = t - t0;
+                       if (dT > 2) {
+                               printf("Still waiting for runId from EPICS IOC...\n");
+                               t0 = t;
+                       }
+
                        if (myRunId == 0)
                                nanosleep(&tv, NULL);
                }