]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
genrunid.db is a separate record now. Sergey Yurevich
authorhadaq <hadaq>
Mon, 23 Jun 2008 13:31:01 +0000 (13:31 +0000)
committerhadaq <hadaq>
Mon, 23 Jun 2008 13:31:01 +0000 (13:31 +0000)
ebctrl/ioc/db/evtbuild.db
ebctrl/ioc/ebctrlApp/Db/Makefile
ebctrl/ioc/ebctrlApp/Db/genrunid.db
ebctrl/ioc/ebctrlApp/src/evtbuild.c
ebctrl/ioc/ebctrlApp/src/genrunid.c
ebctrl/ioc/iocBoot/iocebctrl/envPaths
ebctrl/ioc/iocBoot/iocebctrl/st.cmd

index f36c9272b5c68f8162eb4b9ce45735423f8318cd..9e836228dca8c9894fba36e9868066e640597cee 100644 (file)
@@ -25,6 +25,8 @@ record(genSub,"HAD:$(eb)") {
     field(FTH,"LONG")\r
     field(FTI,"LONG")\r
     field(FTJ,"LONG")\r
+    field(FTK,"LONG")\r
+    field(FTL,"STRING")\r
     field(FTVA,"LONG")\r
     field(FTVB,"LONG")\r
     field(FTVC,"LONG")\r
@@ -35,6 +37,8 @@ record(genSub,"HAD:$(eb)") {
     field(FTVH,"LONG")\r
     field(FTVI,"LONG")\r
     field(FTVJ,"LONG")\r
+    field(FTVK,"LONG")\r
+    field(FTVL,"SRTING")\r
     field(NOA,"50")\r
     field(NOB,"50")\r
     field(NOC,"50")\r
@@ -45,6 +49,8 @@ record(genSub,"HAD:$(eb)") {
     field(NOH,"50")\r
     field(NOI,"50")\r
     field(NOJ,"50")\r
+    field(NOK,"50")\r
+    field(NOL,"50")\r
     field(NOVA,"1")\r
     field(NOVB,"1")\r
     field(NOVC,"1")\r
@@ -55,72 +61,100 @@ record(genSub,"HAD:$(eb)") {
     field(NOVH,"1")\r
     field(NOVI,"1")\r
     field(NOVJ,"1")\r
+    field(NOVK,"1")\r
+    field(NOVL,"1")\r
     field(OUTA,"HAD:$(eb):nrOfMsgs PP NMS")\r
     field(OUTB,"HAD:$(eb):byteWrit PP NMS")    \r
-    field(OUTC,"HAD:$(eb):evtsComp PP NMS")\r
-    field(OUTD,"HAD:$(eb):evtsDisc PP NMS")\r
-    field(OUTE,"HAD:$(eb):evtsDataErr PP NMS")\r
-    field(OUTF,"HAD:$(eb):evtsTagErr PP NMS")  \r
-    field(OUTG,"HAD:$(eb):evtbuildBuff PP NMS")\r
+    field(OUTC,"HAD:$(eb):evtComp PP NMS")\r
+    field(OUTD,"HAD:$(eb):evtDisc PP NMS")\r
+    field(OUTE,"HAD:$(eb):evtDataErr PP NMS")\r
+    field(OUTF,"HAD:$(eb):evtTagErr PP NMS")   \r
+    field(OUTG,"HAD:$(eb):ebBuff PP NMS")\r
     field(OUTH,"HAD:$(eb):status PP NMS")\r
-    field(OUTI,"HAD:$(eb):evtsCompletePS PP NMS")\r
-    field(OUTJ,"HAD:$(eb):bytesWrittenPS PP NMS")      \r
+    field(OUTI,"HAD:$(eb):evtCRate PP NMS")\r
+    field(OUTJ,"HAD:$(eb):byteWRate PP NMS")   \r
+    field(OUTK,"HAD:$(eb):evtDRate PP NMS")\r
+    field(OUTL,"HAD:$(eb):byteWRateStr PP NMS")\r
 }\r
+\r
+record(stringin,"HAD:$(eb):byteWRateStr")\r
+{\r
+    field(DTYP,"Soft Channel")\r
+    field(SCAN,"Passive")\r
+    field(INP,"Constant")\r
+}\r
+\r
 record(longin,"HAD:$(eb):nrOfMsgs")\r
 {\r
     field(DTYP,"Soft Channel")\r
     field(SCAN,"Passive")\r
     field(INP,"Constant")\r
 }\r
+\r
 record(longin,"HAD:$(eb):byteWrit")\r
 {\r
     field(DTYP,"Soft Channel")\r
     field(SCAN,"Passive")\r
     field(INP,"Constant")\r
 }\r
-record(longin,"HAD:$(eb):evtsComp")\r
+\r
+record(longin,"HAD:$(eb):evtComp")\r
 {\r
     field(DTYP,"Soft Channel")\r
     field(SCAN,"Passive")\r
     field(INP,"Constant")\r
 }\r
-record(longin,"HAD:$(eb):evtsDisc")\r
+\r
+record(longin,"HAD:$(eb):evtDisc")\r
 {\r
     field(DTYP,"Soft Channel")\r
     field(SCAN,"Passive")\r
     field(INP,"Constant")\r
 }\r
-record(longin,"HAD:$(eb):evtsDataErr")\r
+\r
+record(longin,"HAD:$(eb):evtDataErr")\r
 {\r
     field(DTYP,"Soft Channel")\r
     field(SCAN,"Passive")\r
     field(INP,"Constant")\r
 }\r
-record(longin,"HAD:$(eb):evtsTagErr")\r
+\r
+record(longin,"HAD:$(eb):evtTagErr")\r
 {\r
     field(DTYP,"Soft Channel")\r
     field(SCAN,"Passive")\r
     field(INP,"Constant")\r
 }\r
+\r
 record(longin,"HAD:$(eb):status")\r
 {\r
     field(DTYP,"Soft Channel")\r
     field(SCAN,"Passive")\r
     field(INP,"Constant")\r
 }\r
-record(longin,"HAD:$(eb):evtsCompletePS")\r
+\r
+record(longin,"HAD:$(eb):evtCRate")\r
 {\r
     field(DTYP,"Soft Channel")\r
     field(SCAN,"Passive")\r
     field(INP,"Constant")\r
 }\r
-record(longin,"HAD:$(eb):bytesWrittenPS")\r
+\r
+record(longin,"HAD:$(eb):byteWRate")\r
 {\r
     field(DTYP,"Soft Channel")\r
     field(SCAN,"Passive")\r
     field(INP,"Constant")\r
 }\r
-record(waveform,"HAD:$(eb):evtbuildBuff")\r
+\r
+record(longin,"HAD:$(eb):evtDRate")\r
+{\r
+    field(DTYP,"Soft Channel")\r
+    field(SCAN,"Passive")\r
+    field(INP,"Constant")\r
+}\r
+\r
+record(waveform,"HAD:$(eb):ebBuff")\r
 {\r
     field(DTYP,"Soft Channel")\r
     field(SCAN,"Passive")\r
@@ -128,14 +162,7 @@ record(waveform,"HAD:$(eb):evtbuildBuff")
     field(NELM,"100")\r
     field(FTVL,"LONG")\r
 }\r
-record(sub,"HAD:genRunId") {\r
-                field(DESC, "subroutine")\r
-                field(SCAN, "1 second")\r
-                field(INPA, "HAD:$(eb):byteWrit")\r
-                field(INPB, "HAD:$(eb):status")\r
-                field(INAM, "genRunId_init")\r
-                field(SNAM, "genRunId_proc")\r
-}\r
+\r
 record(sub,"HAD:writeRunId") {\r
                 field(DESC, "subroutine")\r
                 field(SCAN, "1 second")\r
index 4bd02a7306db6cff0b66a07d79cf7cc17717da96..c31c4d5492dceb0cf51b700b0a1b47a07f03030c 100644 (file)
@@ -12,6 +12,7 @@ include $(TOP)/configure/CONFIG
 # databases, templates, substitutions like this
 DB += evtbuild.db
 DB += netmem.db
+DB += genrunid.db
 DB += user.substitutions
 DB += userHost.substitutions
 
index 2818a712d689ed32d59985330727db125de0aa41..e3fbd6dfd72959e1d6802420d02e2b745939aa31 100644 (file)
@@ -5,4 +5,4 @@ record(sub,"HAD:genRunId") {
                 field(INPB, "HAD:$(eb):status")\r
                 field(INAM, "genRunId_init")\r
                 field(SNAM, "genRunId_proc")\r
-}\r
\ No newline at end of file
+}
\ No newline at end of file
index c5d627d96f40aa3eb13726916c1b2fb8939ba3c2..c9cb986ab4367e686652789ebf066b73c7502cc7 100644 (file)
@@ -33,7 +33,7 @@ long evtbuild_init( struct genSubRecord *pgsub )
 
 long evtbuild_proc( struct genSubRecord *pgsub )
 {
-  
+
   unsigned long *out[11];
   static unsigned long temp[10] = {0};
   int i;
@@ -57,18 +57,20 @@ long evtbuild_proc( struct genSubRecord *pgsub )
   if( Worker_getStatistic( "daq_evtbuild", "nrOfMsgs", out[0] ) == -1) {
     *out[7] = 0; /* status: Event Builder is off */
     if(evtbuildDebug)
-      printf("Worker_getStatistic failed for nrOfMsgs!\n");
+      printf("<E> evtbuild.c: Worker_getStatistic failed for nrOfMsgs!\n");
   }
   else {
     *out[7] = 1; /* status: Event Builder is on */
-    if(evtbuildDebug)
-      printf("Worker_getStatistic::nrOfMsgs = %lu\n", (*out[0]));
+    if(evtbuildDebug) {
+      printf("<E> evtbuild.c: Worker_getStatistic::nrOfMsgs = %lu\n", (*out[0]));
+      printf("<E> evtbuild.c: status = %lu\n", (*out[7]));
+    }
   }
 
   if( Worker_getStatistic( "daq_evtbuild", "bytesWritten", out[1] ) == -1) {
     *out[9] = 0; /* zero data rate */
     if(evtbuildDebug)
-      printf("Worker_getStatistic failed for bytesWritten!\n");
+      printf("<E> evtbuild.c: Worker_getStatistic failed for bytesWritten!\n");
   }
   else {
     /* calculate data rate and convert from Bytes to kB */
@@ -86,7 +88,7 @@ long evtbuild_proc( struct genSubRecord *pgsub )
   if( Worker_getStatistic( "daq_evtbuild", "evtsComplete", out[2] ) == -1) {
     *out[8] = 0; /* zero evtComp rate  */
     if(evtbuildDebug)
-      printf("Worker_getStatistic failed for evtsComplete!\n");
+      printf("<E> evtbuild.c: Worker_getStatistic failed for evtsComplete!\n");
   }
   else{
     if( ((long)(*out[2]) - (long)temp[2]) >= 0 )
@@ -100,10 +102,10 @@ long evtbuild_proc( struct genSubRecord *pgsub )
   if( Worker_getStatistic( "daq_evtbuild", "evtsDiscarded", out[3] ) == -1) {
     *out[10] = 0; /* zero evtDisc rate */
     if(evtbuildDebug)
-      printf("Worker_getStatistic failed for evtsDiscarded!\n");
+      printf("<E> evtbuild.c: Worker_getStatistic failed for evtsDiscarded!\n");
   }
   else {
-    if( (*out[3] - temp[3]) > 0 )
+    if( ((long)(*out[3]) - (long)temp[3]) > 0 )
       *out[10] = *out[3] - temp[3]; /* calculate evtDisc rate */
     else
       *out[10] = *out[3];
@@ -113,11 +115,11 @@ long evtbuild_proc( struct genSubRecord *pgsub )
 
   if( Worker_getStatistic( "daq_evtbuild", "evtsDataError", out[4] ) == -1)
     if(evtbuildDebug)
-      printf("Worker_getStatistic failed for evtsDataError!\n");
+      printf("<E> evtbuild.c: Worker_getStatistic failed for evtsDataError!\n");
 
   if( Worker_getStatistic( "daq_evtbuild", "evtsTagError", out[5] ) == -1)
     if(evtbuildDebug)
-      printf("Worker_getStatistic failed for evtsTagError!\n");
+      printf("<E> evtbuild.c: Worker_getStatistic failed for evtsTagError!\n");
 
   char buf[100];
   for( i=0; i<(*out[0]); i++ ) {
@@ -126,7 +128,7 @@ long evtbuild_proc( struct genSubRecord *pgsub )
 
     if( Worker_getStatistic( "daq_evtbuild", buf, out[6] ) == -1) { 
       if(evtbuildDebug)
-       printf("evtbuild.c: Worker_getStatistic failed for %s!\n", buf);
+       printf("<E> evtbuild.c: Worker_getStatistic failed for %s!\n", buf);
     }
     else {
       if(evtbuildDebug) 
index 264fe5d7e559e5c04f014942f01dccd539457229..35ace325c4c58f541f6ae1ed843cc3cd87aa0018 100644 (file)
@@ -26,33 +26,26 @@ long genRunId_proc( struct subRecord *psub )
   int status      = 0;
   struct timeval tv;
 
-  /*  Get HOSTNAME (name of a local machine) and
-   *      EBMASTER (name of the Event Builder Master).
+  /*  EBTYPE is a type of the IOC: master/slave.
+   *  EBTYPE is set up in st.cmd
    *  The Event Builder Master synchronizes other Event Builders,
    *  which means that only the Master should generate the runId. 
    */
 
-  char* hostname = getenv( "HOSTNAME" );
-  if( hostname == NULL ) {
-    hostname = "HOST_UNDEFINED";
+  char* ebtype = getenv("EBTYPE");
+  if( ebtype == NULL ) {
+    ebtype = "slave";
     if(genrunidDebug)
-      fprintf( stderr, "<E> genrunid.c: env variable HOSTNAME is undefined!\n");
+      fprintf( stderr, "<E> genrunid.c: EBTYPE env variable is undefined! Must be master/slave\n");
   }
 
-  char* ebmaster = getenv( "EBMASTER" );
-  if( ebmaster == NULL ) {
-    ebmaster = "MASTER_UNDEFINED";
-    if(genrunidDebug)
-      fprintf( stderr, "<E> genrunid.c: env variable EBMASTER is undefined!\n");
-  }
-
-  /*  If a local machine name is the name of the Event Builder Master,
+  /*  If this IOC is a master,
    *  generate the runId and put it to a VAL (to be read by other IOCs).
    */
 
-  if( strcmp(ebmaster,hostname) != 0 ) {
+  if( strcmp(ebtype,"master") != 0 ) {
     if(genrunidDebug)
-      printf( "<D> genrunid.c: %s is not a master (%s).\n", hostname, ebmaster);
+      printf( "<D> genrunid.c: the IOC is a %s.\n", ebtype);
   }
   else{
 
@@ -62,7 +55,7 @@ long genRunId_proc( struct subRecord *psub )
     if( status == 0 ) {
       if( genrunidDebug ) {
        printf( "genrunid.c: Event Builder is off, status: %d\n", status );
-       printf( "genrunid.c: Check permissions of EB shared memory segment\n");
+       printf( "genrunid.c: You might check permissions of EB shared memory segment.\n");
        /*
         *  One of the reasons for this message might be closed permissions
         *  for (/dev/shm/daq_evtbuild.shm) shared memory access. 
@@ -98,7 +91,7 @@ long genRunId_proc( struct subRecord *psub )
     
     if( genrunidDebug )
       printf( "<D> genrunid.c: runId = %lu runIdOld = %lu\n", runId, runIdOld );
-  } /* end of EBMASTER condition */
+  } /* end of EBTYPE condition */
 
   return(0);
 }
index 6950d1f36bf7c4e8f249e156924d9e16aa919099..279023c9f2d6de21b20a26b700c3af35667982b6 100644 (file)
@@ -1,4 +1,4 @@
 epicsEnvSet(ARCH,"linux-x86")
 epicsEnvSet(IOC,"iocebctrl")
-epicsEnvSet(TOP,"/home/scs/daq/ebctrl/ioc")
+epicsEnvSet(TOP,"/home/scs/yurevich/ebctrl/ioc")
 epicsEnvSet(EPICS_BASE,"/home/scs/base-3.14.9")
index efd71ffe5a0a24c674c2ad14b4d37b419727db2f..694ef98feff363241fe45c4580b1cd9d893b4bb7 100644 (file)
@@ -2,8 +2,10 @@
 
 ## You may have to change ebctrl to something else
 ## everywhere it appears in this file
+## Set EPICS environment
 
 < envPaths
+epicsEnvSet(EBTYPE,"master")
 
 cd ${TOP}
 
@@ -13,9 +15,9 @@ ebctrl_registerRecordDeviceDriver(pdbbase)
 
 ## Load record instances
 dbLoadTemplate "db/userHost.substitutions"
-dbLoadRecords("db/evtbuild.db","eb=eb02")
-dbLoadRecords("db/netmem.db","eb=eb02")
-##dbLoadRecords("db/genrunid.db")
+dbLoadRecords("db/evtbuild.db","eb=eb01")
+dbLoadRecords("db/netmem.db","eb=eb01")
+dbLoadRecords("db/genrunid.db","eb=eb01")
 
 ## Set this to see messages from mySub
 var evtbuildDebug 1