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
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
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
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
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
# databases, templates, substitutions like this
DB += evtbuild.db
DB += netmem.db
+DB += genrunid.db
DB += user.substitutions
DB += userHost.substitutions
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
long evtbuild_proc( struct genSubRecord *pgsub )
{
-
+
unsigned long *out[11];
static unsigned long temp[10] = {0};
int i;
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 */
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 )
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];
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++ ) {
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)
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{
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.
if( genrunidDebug )
printf( "<D> genrunid.c: runId = %lu runIdOld = %lu\n", runId, runIdOld );
- } /* end of EBMASTER condition */
+ } /* end of EBTYPE condition */
return(0);
}
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")
## You may have to change ebctrl to something else
## everywhere it appears in this file
+## Set EPICS environment
< envPaths
+epicsEnvSet(EBTYPE,"master")
cd ${TOP}
## 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