From ae7b72a4ddaa1a44a782cd88411345bbcd2f4062 Mon Sep 17 00:00:00 2001 From: hadaq Date: Tue, 22 Jul 2008 13:20:35 +0000 Subject: [PATCH] small change. Sergey. --- ebctrl/ioc/ebctrlApp/src/evtbuild.c | 18 +++++----- ebctrl/ioc/ebctrlApp/src/genrunid.c | 7 ++-- ebctrl/ioc/ebctrlApp/src/netmem.c | 52 +++++++++++++-------------- ebctrl/ioc/ebctrlApp/src/writerunid.c | 3 +- ebctrl/ioc/iocBoot/iocebctrl/st.cmd | 8 ++--- 5 files changed, 45 insertions(+), 43 deletions(-) diff --git a/ebctrl/ioc/ebctrlApp/src/evtbuild.c b/ebctrl/ioc/ebctrlApp/src/evtbuild.c index c9cb986..f5a063e 100644 --- a/ebctrl/ioc/ebctrlApp/src/evtbuild.c +++ b/ebctrl/ioc/ebctrlApp/src/evtbuild.c @@ -39,16 +39,16 @@ long evtbuild_proc( struct genSubRecord *pgsub ) int i; out[0] = (unsigned long *)pgsub->vala; /* nrOfMsgs */ - out[1] = (unsigned long *)pgsub->valb; /* bytesWritten */ - out[2] = (unsigned long *)pgsub->valc; /* evtsComplete */ - out[3] = (unsigned long *)pgsub->vald; /* evtsDiscarded */ - out[4] = (unsigned long *)pgsub->vale; /* evtsDataError */ - out[5] = (unsigned long *)pgsub->valf; /* evtsTagError */ - out[6] = (unsigned long *)pgsub->valg; /* evtbuildBuff */ + out[1] = (unsigned long *)pgsub->valb; /* byteWrit = bytes written */ + out[2] = (unsigned long *)pgsub->valc; /* evtComp = events completed */ + out[3] = (unsigned long *)pgsub->vald; /* evtDisc = events discarded */ + out[4] = (unsigned long *)pgsub->vale; /* evtDataErr = events w/ data error */ + out[5] = (unsigned long *)pgsub->valf; /* evtTagErr = events w/ tag error */ + out[6] = (unsigned long *)pgsub->valg; /* ebBuff = EB buffer */ out[7] = (unsigned long *)pgsub->valh; /* status */ - out[8] = (unsigned long *)pgsub->vali; /* evtsCompleteRate */ - out[9] = (unsigned long *)pgsub->valj; /* bytesWrittenRate */ - out[10] = (unsigned long *)pgsub->valk; /* evtsDiscardedRate */ + out[8] = (unsigned long *)pgsub->vali; /* evtCRate = events completed rate */ + out[9] = (unsigned long *)pgsub->valj; /* byteWRate = bytes written rate */ + out[10] = (unsigned long *)pgsub->valk; /* evtDRate = events discarded rate */ /* pgsub->vall : bytesWrittenRate in stringin record (array of char's) */ for( i=0; i<11; i++ ) diff --git a/ebctrl/ioc/ebctrlApp/src/genrunid.c b/ebctrl/ioc/ebctrlApp/src/genrunid.c index 35ace32..86020d9 100644 --- a/ebctrl/ioc/ebctrlApp/src/genrunid.c +++ b/ebctrl/ioc/ebctrlApp/src/genrunid.c @@ -54,18 +54,19 @@ 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: You might check permissions of EB shared memory segment.\n"); + printf( " genrunid.c: Event Builder is off, status: %d\n", status ); + 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. + * Open permissions with "chmod 775 /dev/shm/daq_evtbuild.shm". */ } runId = 0; } if( genrunidDebug ) - printf( "genrunid.c: received file size: %d\n", fileSize ); + printf( " genrunid.c: received file size: %d\n", fileSize ); if( fileSize < sizelimit ){ runIdOld = runId; diff --git a/ebctrl/ioc/ebctrlApp/src/netmem.c b/ebctrl/ioc/ebctrlApp/src/netmem.c index 979fe0e..ea41052 100644 --- a/ebctrl/ioc/ebctrlApp/src/netmem.c +++ b/ebctrl/ioc/ebctrlApp/src/netmem.c @@ -22,25 +22,25 @@ long netmem_proc( struct genSubRecord *pgsub ) unsigned long *out[8]; int i; - out[0] = (unsigned long *)pgsub->vala; /* number of sources */ - out[1] = (unsigned long *)pgsub->valb; /* daq_netmem buff fill levels */ - out[2] = (unsigned long *)pgsub->valc; /* pktsReceived */ - out[3] = (unsigned long *)pgsub->vald; /* msgsReceived */ - out[4] = (unsigned long *)pgsub->vale; /* pktsDiscarded */ - out[5] = (unsigned long *)pgsub->valf; /* msgsDiscarded */ - out[6] = (unsigned long *)pgsub->valg; /* bytesReceived */ - out[7] = (unsigned long *)pgsub->valh; /* bytesReceivedRate */ - - for( i=0; i<2; i++ ) + out[0] = (unsigned long *)pgsub->vala; /* nrOfMsgs */ + out[1] = (unsigned long *)pgsub->valb; /* buff = netmem buffer*/ + out[2] = (unsigned long *)pgsub->valc; /* pktsRcv = packets received */ + out[3] = (unsigned long *)pgsub->vald; /* msgsRcv = messages received */ + out[4] = (unsigned long *)pgsub->vale; /* pktsDis = packets discarded */ + out[5] = (unsigned long *)pgsub->valf; /* msgsDis = messages discarded */ + out[6] = (unsigned long *)pgsub->valg; /* bytercv = bytes received */ + out[7] = (unsigned long *)pgsub->valh; /* byteRRate = bytes received rate */ + + for( i=0; i<8; i++ ) *out[1] = 0; if( Worker_getStatistic( "daq_evtbuild", "nrOfMsgs", out[0] ) == -1) { if(netmemDebug) - printf("netmem.c: Worker_getStatistic failed for nrOfMsgs!\n"); + printf(" netmem.c: Worker_getStatistic failed for nrOfMsgs!\n"); } else { if(netmemDebug) - printf("netmem.c: Worker_getStatistic::nrOfMsgs = %lu\n", (*out[0])); + printf(" netmem.c: Worker_getStatistic::nrOfMsgs = %lu\n", (*out[0])); } char buf[100]; @@ -51,11 +51,11 @@ long netmem_proc( struct genSubRecord *pgsub ) if( Worker_getStatistic( "daq_netmem", buf, out[1] ) == -1) { if(netmemDebug) - printf("netmem.c: Worker_getStatistic failed for %s!\n", buf); + printf(" netmem.c: Worker_getStatistic failed for %s!\n", buf); } else { if(netmemDebug) - printf("netmem.c: %s = %lu\n", buf, *out[1]); + printf(" netmem.c: %s = %lu\n", buf, *out[1]); out[1]++; } @@ -67,11 +67,11 @@ long netmem_proc( struct genSubRecord *pgsub ) if( Worker_getStatistic( "daq_netmem", buf, out[2] ) == -1) { if(netmemDebug) - printf("netmem.c: Worker_getStatistic failed for %s!\n", buf); + printf(" netmem.c: Worker_getStatistic failed for %s!\n", buf); } else { if(netmemDebug) - printf("netmem.c: %s = %lu\n", buf, *out[2]); + printf(" netmem.c: %s = %lu\n", buf, *out[2]); out[2]++; } @@ -83,11 +83,11 @@ long netmem_proc( struct genSubRecord *pgsub ) if( Worker_getStatistic( "daq_netmem", buf, out[3] ) == -1) { if(netmemDebug) - printf("netmem.c: Worker_getStatistic failed for %s!\n", buf); + printf(" netmem.c: Worker_getStatistic failed for %s!\n", buf); } else { if(netmemDebug) - printf("netmem.c: %s = %lu\n", buf, *out[3]); + printf(" netmem.c: %s = %lu\n", buf, *out[3]); out[3]++; } @@ -99,11 +99,11 @@ long netmem_proc( struct genSubRecord *pgsub ) if( Worker_getStatistic( "daq_netmem", buf, out[4] ) == -1) { if(netmemDebug) - printf("netmem.c: Worker_getStatistic failed for %s!\n", buf); + printf(" netmem.c: Worker_getStatistic failed for %s!\n", buf); } else { if(netmemDebug) - printf("netmem.c: %s = %lu\n", buf, *out[4]); + printf(" netmem.c: %s = %lu\n", buf, *out[4]); out[4]++; } @@ -115,11 +115,11 @@ long netmem_proc( struct genSubRecord *pgsub ) if( Worker_getStatistic( "daq_netmem", buf, out[5] ) == -1) { if(netmemDebug) - printf("netmem.c: Worker_getStatistic failed for %s!\n", buf); + printf(" netmem.c: Worker_getStatistic failed for %s!\n", buf); } else { if(netmemDebug) - printf("netmem.c: %s = %lu\n", buf, *out[5]); + printf(" netmem.c: %s = %lu\n", buf, *out[5]); out[5]++; } @@ -131,11 +131,11 @@ long netmem_proc( struct genSubRecord *pgsub ) if( Worker_getStatistic( "daq_netmem", buf, out[6] ) == -1) { if(netmemDebug) - printf("netmem.c: Worker_getStatistic failed for %s!\n", buf); + printf(" netmem.c: Worker_getStatistic failed for %s!\n", buf); } else { if(netmemDebug) - printf("netmem.c: %s = %lu\n", buf, *out[6]); + printf(" netmem.c: %s = %lu\n", buf, *out[6]); *out[6] = (int)((*out[6])/1024/1024UL + 0.5); /* convert from Bytes to MB */ out[6]++; @@ -148,11 +148,11 @@ long netmem_proc( struct genSubRecord *pgsub ) if( Worker_getStatistic( "daq_netmem", buf, out[7] ) == -1) { if(netmemDebug) - printf("netmem.c: Worker_getStatistic failed for %s!\n", buf); + printf(" netmem.c: Worker_getStatistic failed for %s!\n", buf); } else { if(netmemDebug) - printf("netmem.c: %s = %lu\n", buf, *out[7]); + printf(" netmem.c: %s = %lu\n", buf, *out[7]); *out[7] = (int)((*out[7])/1024UL + 0.5); /* convert from Bytes to kB */ out[7]++; diff --git a/ebctrl/ioc/ebctrlApp/src/writerunid.c b/ebctrl/ioc/ebctrlApp/src/writerunid.c index 836e351..9ebf657 100644 --- a/ebctrl/ioc/ebctrlApp/src/writerunid.c +++ b/ebctrl/ioc/ebctrlApp/src/writerunid.c @@ -25,7 +25,7 @@ long writeRunId_proc( struct subRecord *psub ) static unsigned long runId = 0; - runId = (unsigned long) psub->a; + runId = (unsigned long) psub->a; /* RUN Id */ if( Worker_setStatistic( "daq_evtbuild", "runId", &runId ) == -1 ) { if(writerunidDebug) { @@ -37,6 +37,7 @@ long writeRunId_proc( struct subRecord *psub ) printf(" writerunid.c: Worker_setStatistic runId = %lu\n", runId); unsigned long runId_check; + /* In the following we try to read back the RUN Id from the shared memory */ if( Worker_getStatistic( "daq_evtbuild", "runId", &runId_check ) == -1 ) printf(" writerunid.c: check: Worker_getStatistic cannot access runId!\n"); else diff --git a/ebctrl/ioc/iocBoot/iocebctrl/st.cmd b/ebctrl/ioc/iocBoot/iocebctrl/st.cmd index 694ef98..1549e4b 100644 --- a/ebctrl/ioc/iocBoot/iocebctrl/st.cmd +++ b/ebctrl/ioc/iocBoot/iocebctrl/st.cmd @@ -5,7 +5,7 @@ ## Set EPICS environment < envPaths -epicsEnvSet(EBTYPE,"master") +epicsEnvSet(EBTYPE,"slave") cd ${TOP} @@ -20,10 +20,10 @@ dbLoadRecords("db/netmem.db","eb=eb01") dbLoadRecords("db/genrunid.db","eb=eb01") ## Set this to see messages from mySub -var evtbuildDebug 1 +var evtbuildDebug 0 var netmemDebug 0 -var genrunidDebug 1 -var writerunidDebug 1 +var genrunidDebug 0 +var writerunidDebug 0 cd ${TOP}/iocBoot/${IOC} iocInit() -- 2.43.0