From c71340ee582ffeef047410c53f54d94e5c3326b0 Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Tue, 5 Apr 2022 13:09:13 +0200 Subject: [PATCH] Update counters --- CMakeLists.txt | 2 +- Online/GauchoBase/include/Gaucho/MonTypes.h | 6 +- Online/GauchoBase/main/taskCounters.cpp | 8 +- Online/GauchoBase/src/CounterDeserialize.cpp | 152 +++++++++--------- Online/GauchoBase/src/CounterJson.cpp | 4 + .../include/GaudiOnline/Configuration.h | 2 + Online/GaudiOnline/src/Configuration.cpp | 1 + Online/GaudiOnline/src/OnlineApplication.cpp | 4 + Online/SmiController/options/AligNodeFunc.smi | 2 +- .../SmiController/options/AligNodeFunc.sobj | 4 - 10 files changed, 100 insertions(+), 85 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d23f50ea2..118eb4d99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,7 @@ lhcb_add_subdirectories( Online/DataflowExample Online/Gaucho Online/DefHLTUtils - Online/EventBuilding +# Online/EventBuilding Online/EventData Online/FarmConfig Online/GaudiOnline diff --git a/Online/GauchoBase/include/Gaucho/MonTypes.h b/Online/GauchoBase/include/Gaucho/MonTypes.h index edf8ce2d1..0c00360e7 100644 --- a/Online/GauchoBase/include/Gaucho/MonTypes.h +++ b/Online/GauchoBase/include/Gaucho/MonTypes.h @@ -29,7 +29,7 @@ enum MONTYPE { C_LONGSTAR, C_FLOATSTAR, C_DOUBLESTAR, - C_RATEDOUBLE, + C_RATEDOUBLE, // 0xfeed0010 C_RATEDOUBLESTAR, H_3DIM, H_2DPROFILE, @@ -45,7 +45,7 @@ enum MONTYPE { C_GAUDIACCDOUBLE, C_GAUDIAVGACCl, C_GAUDIAVGACCd, - C_GAUDIBINACC, + C_GAUDIBINACC, // 0xfeed0020 C_UINT, C_ULONG, C_UINTSTAR, @@ -60,7 +60,7 @@ enum MONTYPE { H_GAUDIPR2, H_GAUDIPR3, C_GAUDIACCuLONG, - C_GAUDIACCuINT + C_GAUDIACCuINT // 0xfeed002f }; #endif diff --git a/Online/GauchoBase/main/taskCounters.cpp b/Online/GauchoBase/main/taskCounters.cpp index c5b0fe6ae..5ecb2d643 100644 --- a/Online/GauchoBase/main/taskCounters.cpp +++ b/Online/GauchoBase/main/taskCounters.cpp @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) { // Taskname, DNS Node auto h = std::make_unique<CounterTask>(task, dns); std::vector<std::string> counters; std::vector<std::string> hsts; - std::vector<CntrDescr*> objs; + std::vector<CntrDescr*> objs; int status = h->directory(counters); if ( status == 1 ) { @@ -99,7 +99,11 @@ int main(int argc, char *argv[]) { // Taskname, DNS Node case C_ATOMICLONG: case C_GAUDIACCLONG: case C_GAUDIACCINT: - snprintf(text, sizeof(text), "(LONGLONG) %ld",long(objs[i]->l_data)); + ::snprintf(text, sizeof(text), "(LONGLONG) %ld",long(objs[i]->l_data)); + break; + case C_GAUDIACCuLONG: + case C_GAUDIACCuINT: + ::snprintf(text, sizeof(text), "(uLONGLONG) %ld",long(objs[i]->ul_data)); break; case C_FLOAT: case C_ATOMICFLOAT: diff --git a/Online/GauchoBase/src/CounterDeserialize.cpp b/Online/GauchoBase/src/CounterDeserialize.cpp index 6af1a1304..1ad3c52bf 100644 --- a/Online/GauchoBase/src/CounterDeserialize.cpp +++ b/Online/GauchoBase/src/CounterDeserialize.cpp @@ -31,80 +31,84 @@ CntrDescr *CounterSerDes::de_serialize(void *ptr, char *nam) { long* plng = add_ptr<long>(p, p->dataoff); int bsiz = p->reclen - p->dataoff; switch (p->type) { - case C_INT: - h->i_data = *(int*)dat; - break; - case C_UINT: - h->ui_data = *(unsigned int*) dat; - break; - case C_ULONG: - h->ul_data = *(unsigned long*) dat; - break; - case C_LONGLONG: - case C_ATOMICINT: - case C_ATOMICLONG: - case C_GAUDIACCLONG: - case C_GAUDIACCINT: - h->l_data = *(long*) dat; - break; - case C_FLOAT: - case C_RATEFLOAT: - h->f_data = (float) (*(double*)dat); - break; - case C_DOUBLE: - case C_RATEDOUBLE: - h->d_data = *(double*) dat; - break; - case C_INTSTAR: - case C_UINTSTAR: - h->nel = bsiz / sizeof(int); - h->ptr.reset(new unsigned char[bsiz]); - ::memcpy(h->ptr.get(), plng, bsiz); - break; - case C_LONGSTAR: - case C_ULONGSTAR: - h->nel = (bsiz) / sizeof(long); - h->ptr.reset(new unsigned char[bsiz]); - ::memcpy(h->ptr.get(), plng, bsiz); - break; - case C_FLOATSTAR: - h->nel = (bsiz) / sizeof(float); - h->ptr.reset(new unsigned char[bsiz]); - ::memcpy(h->ptr.get(), plng, bsiz); - break; - case C_DOUBLESTAR: - case C_RATEDOUBLESTAR: - h->nel = (bsiz) / sizeof(double); - h->ptr.reset(new unsigned char[bsiz]); - ::memcpy(h->ptr.get(), plng, bsiz); - break; - case C_LONGPAIR: - h->lp_data.first = *plng; - plng++; - h->lp_data.second = *plng; - break; - case C_INTPAIR: - h->ip_data.first = (int)*plng; - plng++; - h->ip_data.second = (int)*plng; - break; - case C_GAUDIAVGACCd: //first element: NEntries; second element: Sum - h->avg_data.first = *plng; - plng++; - h->avg_data.second = *(double*)plng; - break; - case C_GAUDIAVGACCl: //first element: NEntries; second element: Sum - h->lp_data.first = *plng; - plng++; - h->lp_data.second = *plng; - break; - case C_GAUDIBINACC: //first element: NTrueEntries; second element: NFalseEntries - h->lp_data.first = *plng; - plng++; - h->lp_data.second = *plng; - break; - default: - break; + case C_INT: + h->i_data = *(int*)dat; + break; + case C_UINT: + h->ui_data = *(unsigned int*) dat; + break; + case C_ULONG: + h->ul_data = *(unsigned long*) dat; + break; + case C_LONGLONG: + case C_ATOMICINT: + case C_ATOMICLONG: + case C_GAUDIACCLONG: + case C_GAUDIACCINT: + h->l_data = *(long*) dat; + break; + case C_GAUDIACCuLONG: + case C_GAUDIACCuINT: + h->ul_data = *(unsigned long*) dat; + break; + case C_FLOAT: + case C_RATEFLOAT: + h->f_data = (float) (*(double*)dat); + break; + case C_DOUBLE: + case C_RATEDOUBLE: + h->d_data = *(double*) dat; + break; + case C_INTSTAR: + case C_UINTSTAR: + h->nel = bsiz / sizeof(int); + h->ptr.reset(new unsigned char[bsiz]); + ::memcpy(h->ptr.get(), plng, bsiz); + break; + case C_LONGSTAR: + case C_ULONGSTAR: + h->nel = (bsiz) / sizeof(long); + h->ptr.reset(new unsigned char[bsiz]); + ::memcpy(h->ptr.get(), plng, bsiz); + break; + case C_FLOATSTAR: + h->nel = (bsiz) / sizeof(float); + h->ptr.reset(new unsigned char[bsiz]); + ::memcpy(h->ptr.get(), plng, bsiz); + break; + case C_DOUBLESTAR: + case C_RATEDOUBLESTAR: + h->nel = (bsiz) / sizeof(double); + h->ptr.reset(new unsigned char[bsiz]); + ::memcpy(h->ptr.get(), plng, bsiz); + break; + case C_LONGPAIR: + h->lp_data.first = *plng; + plng++; + h->lp_data.second = *plng; + break; + case C_INTPAIR: + h->ip_data.first = (int)*plng; + plng++; + h->ip_data.second = (int)*plng; + break; + case C_GAUDIAVGACCd: //first element: NEntries; second element: Sum + h->avg_data.first = *plng; + plng++; + h->avg_data.second = *(double*)plng; + break; + case C_GAUDIAVGACCl: //first element: NEntries; second element: Sum + h->lp_data.first = *plng; + plng++; + h->lp_data.second = *plng; + break; + case C_GAUDIBINACC: //first element: NTrueEntries; second element: NFalseEntries + h->lp_data.first = *plng; + plng++; + h->lp_data.second = *plng; + break; + default: + break; } return h.release(); } diff --git a/Online/GauchoBase/src/CounterJson.cpp b/Online/GauchoBase/src/CounterJson.cpp index 1e730aa5e..1ed625514 100644 --- a/Online/GauchoBase/src/CounterJson.cpp +++ b/Online/GauchoBase/src/CounterJson.cpp @@ -60,6 +60,10 @@ namespace Online { case C_GAUDIACCLONG: case C_GAUDIACCINT: return { {"name", nam}, {"type", p->type}, {"value", _scalar<long>(p, "LONG") } }; + case C_GAUDIACCuINT: + return { {"name", nam}, {"type", p->type}, {"value", _scalar<unsigned long>(p, "ULONG") } }; + case C_GAUDIACCuLONG: + return { {"name", nam}, {"type", p->type}, {"value", _scalar<unsigned long>(p, "ULONG") } }; case C_FLOAT: return { {"name", nam}, {"type", p->type}, {"value", _scalar<float>(p, "FLOAT") } }; case C_RATEFLOAT: diff --git a/Online/GaudiOnline/include/GaudiOnline/Configuration.h b/Online/GaudiOnline/include/GaudiOnline/Configuration.h index 98771b3d3..f8a29523d 100644 --- a/Online/GaudiOnline/include/GaudiOnline/Configuration.h +++ b/Online/GaudiOnline/include/GaudiOnline/Configuration.h @@ -63,6 +63,8 @@ namespace Online { int enableContinue; /// Property: Enable/disable STOP transition using incident (RUNNING -> READY) int enableStop; + /// Property: Enable/disable ERROR transition using incident (* -> ERROR) + int enableError; /// Property: Execution mode definition int execMode; diff --git a/Online/GaudiOnline/src/Configuration.cpp b/Online/GaudiOnline/src/Configuration.cpp index 8361bb524..d0dd8f689 100644 --- a/Online/GaudiOnline/src/Configuration.cpp +++ b/Online/GaudiOnline/src/Configuration.cpp @@ -45,6 +45,7 @@ Configuration::Configuration(std::string nam, ISvcLocator* svcloc) declareProperty("enablePause", enablePause = 0); declareProperty("enableContinue", enableContinue = 0); declareProperty("enableStop", enableStop = 0); + declareProperty("enableError", enableError = 1); declareProperty("execMode", execMode = 1); declareProperty("monitorType", monitorType = ""); declareProperty("inputType", inputType = "MBM"); diff --git a/Online/GaudiOnline/src/OnlineApplication.cpp b/Online/GaudiOnline/src/OnlineApplication.cpp index b94babb79..d29149079 100644 --- a/Online/GaudiOnline/src/OnlineApplication.cpp +++ b/Online/GaudiOnline/src/OnlineApplication.cpp @@ -479,6 +479,10 @@ void OnlineApplication::handleIncident(const Incident& incident ) { else if ( incident.type() == "DAQ_CONTINUE" ) { this->continuing(); } + else if ( incident.type() == "DAQ_ERROR" ) { + this->setTargetState(ST_ERROR); + IOCSENSOR.send(this, ERROR); + } } /// Fire an incident to inform clients about DAQ state etc. diff --git a/Online/SmiController/options/AligNodeFunc.smi b/Online/SmiController/options/AligNodeFunc.smi index edd458c0f..3fb2578e2 100644 --- a/Online/SmiController/options/AligNodeFunc.smi +++ b/Online/SmiController/options/AligNodeFunc.smi @@ -196,7 +196,7 @@ class: TOP_Node_CLASS if ( any_in ALLCHILDREN_SETSTATES in_state RUNNING ) then do Pause all_in ALLCHILDREN_SETACTIONS endif - do Pause all_in ALLCHILDREN_SETACTIONS + !!!!!!! do Pause all_in ALLCHILDREN_SETACTIONS if ( all_in ALLCHILDREN_SETSTATES in_state {READY,PAUSED} ) then move_to PAUSED endif diff --git a/Online/SmiController/options/AligNodeFunc.sobj b/Online/SmiController/options/AligNodeFunc.sobj index 831114c8c..16646fdf9 100644 --- a/Online/SmiController/options/AligNodeFunc.sobj +++ b/Online/SmiController/options/AligNodeFunc.sobj @@ -778,10 +778,6 @@ in_state 1 RUNNING 1 1 -do -PAUSE - 0 -&ALL_IN_ALLCHILDREN_SETACTIONS if 1 ( ALL_IN ALLCHILDREN_SETSTATES IN_STATE {READY,PAUSED} ) -- GitLab