diff --git a/.gitattributes b/.gitattributes index 9be2a39a6424b04bdf0770c1b6af6943b1197473..1dd409ec0e9e4057a2885031d0a0c473e80618a7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -177,12 +177,14 @@ MAC/APL/PAC/_VirtualTelescope/pvss/StatisticsTrend.pnl -text svneol=native#appli MAC/APL/PAC/_VirtualTelescope/pvss/VT-control.pnl -text svneol=native#application/octet-stream MAC/APL/PAC/_VirtualTelescope/pvss/testPanel.pnl -text svneol=native#application/octet-stream MAC/APL/PAC/_VirtualTelescope/src/LogicalDeviceServer.conf.in -text svneol=native#application/octet-stream +MAC/APL/PAC/_VirtualTelescope/src/LogicalDeviceServer.log_prop.in -text svneol=native#application/octet-stream MAC/APL/PAC/_VirtualTelescope/src/LogicalDevice_Protocol.prot -text svneol=native#application/octet-stream MAC/APL/PAC/_VirtualTelescope/src/Makefile.am -text svneol=native#application/octet-stream MAC/APL/PAC/_VirtualTelescope/test/DEPENDENCIES -text svneol=native#application/octet-stream MAC/APL/PAC/_VirtualTelescope/test/Makefile.am -text svneol=native#application/octet-stream MAC/APL/PAC/_VirtualTelescope/test/README -text svneol=native#application/octet-stream MAC/APL/PAC/_VirtualTelescope/test/avttest.conf.in -text svneol=native#application/octet-stream +MAC/APL/PAC/_VirtualTelescope/test/avttest.log_prop.in -text svneol=native#application/octet-stream MAC/APL/PIC/Makefile.am -text svneol=native#application/octet-stream MAC/APL/PIC/_RegisterAccess/Makefile.am -text svneol=native#application/octet-stream MAC/APL/PIC/_RegisterAccess/bootstrap -text svneol=native#application/octet-stream diff --git a/MAC/APL/PAC/_VirtualTelescope/configure.in b/MAC/APL/PAC/_VirtualTelescope/configure.in index 91d956d300dcd1cf98581729dd305368f541794c..2e3c9abccb335addaed50ebf766a4459f1c47df5 100644 --- a/MAC/APL/PAC/_VirtualTelescope/configure.in +++ b/MAC/APL/PAC/_VirtualTelescope/configure.in @@ -10,9 +10,9 @@ AM_INIT_AUTOMAKE(LogicalDeviceScheduler, 1.0) dnl Initialize for LOFAR (may set compilers) lofar_INIT -AC_DEFINE_UNQUOTED([ARA_SYSCONF],["${prefix}/etc"],[Path to ARA install prefix directory.]) -RSP_SYSCONF="${prefix}/etc" -AC_SUBST([ARA_SYSCONF]) +AC_DEFINE_UNQUOTED([AVT_SYSCONF],["${prefix}/etc"],[Path to AVT install prefix directory.]) +AVT_SYSCONF="${prefix}/etc" +AC_SUBST([AVT_SYSCONF]) dnl Checks for programs. AC_PROG_AWK @@ -55,6 +55,7 @@ dnl dnl Check for LOFAR specific things dnl lofar_DEBUG_OPTIMIZE +lofar_CHECK_PRETTY_FUNCTION #lofar_QT lofar_QATOOLS lofar_DOCXX diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDevice.cc b/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDevice.cc index ccc5b9767e97016edee9d376d9955b0559896a48..4a19c9a775cd7a0f1f4161d9e477e99f3cf8be61 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDevice.cc +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDevice.cc @@ -40,6 +40,8 @@ namespace LOFAR namespace AVT { +INIT_TRACER_CONTEXT(AVTLogicalDevice,LOFARLOGGER_PACKAGE); + AVTLogicalDevice::AVTLogicalDevice(string& taskName, const string& scope, const string& type, @@ -47,7 +49,7 @@ AVTLogicalDevice::AVTLogicalDevice(string& taskName, GCFTask((State)&AVTLogicalDevice::initial_state,taskName), AVTPropertySetAnswerHandlerInterface(), m_propertySetAnswer(*this), - m_properties(scope.c_str(),type.c_str(),false,&m_propertySetAnswer), + m_properties(scope.c_str(),type.c_str(),PS_CAT_PERMANENT,&m_propertySetAnswer), m_APC(APCName), m_serverPortName(taskName+string("_server")), m_logicalDeviceServerPort(*this, m_serverPortName, GCFPortInterface::SPP, LOGICALDEVICE_PROTOCOL), @@ -55,8 +57,8 @@ AVTLogicalDevice::AVTLogicalDevice(string& taskName, m_apcLoaded(false), m_logicalDeviceState(LOGICALDEVICE_STATE_IDLE) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); registerProtocol(LOGICALDEVICE_PROTOCOL, LOGICALDEVICE_PROTOCOL_signalnames); - LOG_DEBUG(formatString("AVTLogicalDevice(%s)::AVTLogicalDevice",getName().c_str())); m_properties.enable(); } @@ -64,7 +66,7 @@ AVTLogicalDevice::AVTLogicalDevice(string& taskName, AVTLogicalDevice::~AVTLogicalDevice() { - LOG_DEBUG(formatString("AVTLogicalDevice(%s)::~AVTLogicalDevice",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); m_properties.disable(); } @@ -119,7 +121,7 @@ void AVTLogicalDevice::apcLoaded() GCFEvent::TResult AVTLogicalDevice::initial_state(GCFEvent& event, GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTLogicalDevice(%s)::initial_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; @@ -160,7 +162,7 @@ GCFEvent::TResult AVTLogicalDevice::initial_state(GCFEvent& event, GCFPortInterf GCFEvent::TResult AVTLogicalDevice::idle_state(GCFEvent& event, GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTLogicalDevice(%s)::idle_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -208,7 +210,7 @@ GCFEvent::TResult AVTLogicalDevice::idle_state(GCFEvent& event, GCFPortInterface GCFEvent::TResult AVTLogicalDevice::claiming_state(GCFEvent& event, GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTLogicalDevice(%s)::claiming_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -252,7 +254,7 @@ GCFEvent::TResult AVTLogicalDevice::claiming_state(GCFEvent& event, GCFPortInter GCFEvent::TResult AVTLogicalDevice::claimed_state(GCFEvent& event, GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTLogicalDevice(%s)::claimed_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -309,7 +311,7 @@ GCFEvent::TResult AVTLogicalDevice::claimed_state(GCFEvent& event, GCFPortInterf GCFEvent::TResult AVTLogicalDevice::preparing_state(GCFEvent& event, GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTLogicalDevice(%s)::preparing_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -372,7 +374,7 @@ GCFEvent::TResult AVTLogicalDevice::preparing_state(GCFEvent& event, GCFPortInte GCFEvent::TResult AVTLogicalDevice::suspended_state(GCFEvent& event, GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTLogicalDevice(%s)::suspended_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -430,7 +432,7 @@ GCFEvent::TResult AVTLogicalDevice::suspended_state(GCFEvent& event, GCFPortInte GCFEvent::TResult AVTLogicalDevice::active_state(GCFEvent& event, GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTLogicalDevice(%s)::active_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -482,7 +484,7 @@ GCFEvent::TResult AVTLogicalDevice::active_state(GCFEvent& event, GCFPortInterfa GCFEvent::TResult AVTLogicalDevice::releasing_state(GCFEvent& event, GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTLogicalDevice(%s)::releasing_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -534,4 +536,4 @@ GCFEvent::TResult AVTLogicalDevice::releasing_state(GCFEvent& event, GCFPortInte } }; -}; \ No newline at end of file +}; diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDevice.h b/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDevice.h index 7676af123c9c02783fed615881e651ebfb61790f..e86720080b0d1adea32f9371694f591181d15e4e 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDevice.h +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDevice.h @@ -25,6 +25,7 @@ //# Includes +#include <Common/LofarLogger.h> //# GCF Includes #include <GCF/PAL/GCF_MyPropertySet.h> #include <GCF/TM/GCF_Port.h> @@ -188,6 +189,8 @@ namespace AVT std::vector<APLInterTaskPort*> m_clientInterTaskPorts; bool m_apcLoaded; TLogicalDeviceState m_logicalDeviceState; + + ALLOC_TRACER_CONTEXT }; };//AVT };//LOFAR diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceScheduler.cc b/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceScheduler.cc index 1aa41ebc7d2ae12ef3e526cdecc874f7e13b884e..dbf02535a6fb3c4cd89824dd2f1f7eb9b88644f1 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceScheduler.cc +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceScheduler.cc @@ -57,6 +57,8 @@ using namespace AVT; using namespace std; using namespace boost; +INIT_TRACER_CONTEXT(AVTLogicalDeviceScheduler,LOFARLOGGER_PACKAGE); + string AVTLogicalDeviceScheduler::m_schedulerTaskName("LogicalDeviceScheduler"); string timerPortName("timerPort"); @@ -64,8 +66,8 @@ AVTLogicalDeviceScheduler::AVTLogicalDeviceScheduler() : GCFTask((State)&AVTLogicalDeviceScheduler::initial_state,m_schedulerTaskName), AVTPropertySetAnswerHandlerInterface(), m_propertySetAnswer(*this), - m_properties(SCOPE_PAC_LogicalDeviceScheduler,TYPE_LCU_PAC_LogicalDeviceScheduler.c_str(),false,&m_propertySetAnswer), - m_propertiesWG(SCOPE_PAC_LogicalDeviceScheduler_WaveFormGenerator,TYPE_LCU_PAC_WaveformGenerator.c_str(),false,&m_propertySetAnswer), + m_properties(SCOPE_PAC_LogicalDeviceScheduler,TYPE_LCU_PAC_LogicalDeviceScheduler.c_str(),PS_CAT_PERMANENT,&m_propertySetAnswer), + m_propertiesWG(SCOPE_PAC_LogicalDeviceScheduler_WaveFormGenerator,TYPE_LCU_PAC_WaveformGenerator.c_str(),PS_CAT_TEMPORARY,&m_propertySetAnswer), m_propsetConfigured(false), m_propsetWGConfigured(false), m_pBeamServer(0), @@ -78,8 +80,8 @@ AVTLogicalDeviceScheduler::AVTLogicalDeviceScheduler() : m_timerPort(*this, timerPortName, GCFPortInterface::SPP, LOGICALDEVICE_PROTOCOL), m_resourceManager(AVTResourceManager::instance()) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); registerProtocol(LOGICALDEVICE_PROTOCOL, LOGICALDEVICE_PROTOCOL_signalnames); - LOG_DEBUG(formatString("AVTLogicalDeviceScheduler::%s(%s)",__func__,getName().c_str())); m_properties.enable(); m_propertiesWG.enable(); } @@ -87,12 +89,13 @@ AVTLogicalDeviceScheduler::AVTLogicalDeviceScheduler() : AVTLogicalDeviceScheduler::~AVTLogicalDeviceScheduler() { - LOG_DEBUG(formatString("AVTLogicalDeviceScheduler::%s(%s)",__func__,getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); } shared_ptr<AVTStationReceptor> AVTLogicalDeviceScheduler::addReceptor(string srName,const list<TPropertyInfo>& requiredResources) { - LOG_DEBUG(formatString("%s(%s)(%s)",__func__,getName().c_str(),srName.c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - %s",getName().c_str(),srName.c_str()).c_str()); + // create receptor logical device LogicalDeviceInfoT srInfo; string srApcName(APC_SR); @@ -115,7 +118,7 @@ shared_ptr<AVTStationReceptor> AVTLogicalDeviceScheduler::addReceptor(string srN void AVTLogicalDeviceScheduler::addReceptorGroup(string srgName,vector<shared_ptr<AVTStationReceptor> >& receptors) { - LOG_DEBUG(formatString("%s(%s)(%s)",__func__,getName().c_str(),srgName.c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - %s",getName().c_str(),srgName.c_str()).c_str()); LogicalDeviceInfoT srgInfo; string srgApcName(APC_SRG); if(ParameterSet::instance()->isDefined(string(PARAM_APC)+srgName)) @@ -155,7 +158,7 @@ bool AVTLogicalDeviceScheduler::isInitialized() AVTLogicalDeviceScheduler::LogicalDeviceMapIterT AVTLogicalDeviceScheduler::findLogicalDevice(const unsigned long scheduleId) { - LOG_DEBUG(formatString("%s(%s)(scheduleId=%d)",__func__,getName().c_str(),scheduleId)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - scheduleId=%d",getName().c_str(),scheduleId).c_str()); LogicalDeviceMapIterT ldIt = m_logicalDeviceMap.end(); // find the schedule @@ -170,7 +173,7 @@ AVTLogicalDeviceScheduler::LogicalDeviceMapIterT AVTLogicalDeviceScheduler::find AVTLogicalDeviceScheduler::LogicalDeviceMapIterT AVTLogicalDeviceScheduler::findClientPort(GCFPortInterface& port) { - LOG_DEBUG(formatString("%s(%s)",__func__,getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); LogicalDeviceMapIterT it; for(it=m_logicalDeviceMap.begin();it!=m_logicalDeviceMap.end()&&(&port!=it->second.clientPort.get());++it); return it; @@ -178,7 +181,7 @@ AVTLogicalDeviceScheduler::LogicalDeviceMapIterT AVTLogicalDeviceScheduler::find AVTLogicalDeviceScheduler::LogicalDeviceScheduleIterT AVTLogicalDeviceScheduler::findSchedule(const string& deviceName,LogicalDeviceScheduleIterT beginIt) { - LOG_DEBUG(formatString("%s(%s)(ld=%s)",__func__,getName().c_str(),deviceName.c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - ld=%s",getName().c_str(),deviceName.c_str()).c_str()); LogicalDeviceScheduleIterT scheduleIt; for(scheduleIt=beginIt;scheduleIt!=m_logicalDeviceSchedule.end()&&(deviceName!=scheduleIt->second.deviceName);++scheduleIt); return scheduleIt; @@ -186,6 +189,7 @@ AVTLogicalDeviceScheduler::LogicalDeviceScheduleIterT AVTLogicalDeviceScheduler: bool AVTLogicalDeviceScheduler::submitSchedule(const unsigned long scheduleId,const string& deviceName, const vector<string> scheduleParameters, boost::shared_ptr<APLInterTaskPort> clientPort) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - deviceName=%s",getName().c_str(),deviceName.c_str()).c_str()); bool result=false; int rawStartTime = atoi(scheduleParameters[0].c_str()); // starttime @@ -310,6 +314,7 @@ bool AVTLogicalDeviceScheduler::submitSchedule(const unsigned long scheduleId,co bool AVTLogicalDeviceScheduler::checkPrepareTimer(const string& deviceName, unsigned long timerId) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - device=%s,timerId=%d",getName().c_str(),deviceName.c_str(),timerId).c_str()); bool isPrepareTimer=false; LogicalDeviceScheduleIterT it = findSchedule(deviceName,m_logicalDeviceSchedule.begin()); while(!isPrepareTimer && it != m_logicalDeviceSchedule.end()) @@ -336,6 +341,7 @@ bool AVTLogicalDeviceScheduler::checkPrepareTimer(const string& deviceName, unsi bool AVTLogicalDeviceScheduler::checkStartTimer(const string& deviceName, unsigned long timerId) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - device=%s,timerId=%d",getName().c_str(),deviceName.c_str(),timerId).c_str()); bool isStartTimer=false; LogicalDeviceScheduleIterT it = findSchedule(deviceName,m_logicalDeviceSchedule.begin()); while(!isStartTimer && it != m_logicalDeviceSchedule.end()) @@ -362,6 +368,7 @@ bool AVTLogicalDeviceScheduler::checkStartTimer(const string& deviceName, unsign bool AVTLogicalDeviceScheduler::checkStopTimer(const string& deviceName, unsigned long timerId) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - device=%s,timerId=%d",getName().c_str(),deviceName.c_str(),timerId).c_str()); bool isStopTimer=false; LogicalDeviceScheduleIterT it = findSchedule(deviceName,m_logicalDeviceSchedule.begin()); while(!isStopTimer && it != m_logicalDeviceSchedule.end()) @@ -388,6 +395,7 @@ bool AVTLogicalDeviceScheduler::checkStopTimer(const string& deviceName, unsigne bool AVTLogicalDeviceScheduler::checkMaintenanceStartTimer(unsigned long timerId, MaintenanceScheduleIterT& scheduleIt) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - timerId=%d",getName().c_str(),timerId).c_str()); bool isStartTimer=false; scheduleIt = m_maintenanceSchedule.begin(); while(!isStartTimer && scheduleIt != m_maintenanceSchedule.end()) @@ -404,6 +412,7 @@ bool AVTLogicalDeviceScheduler::checkMaintenanceStartTimer(unsigned long timerId bool AVTLogicalDeviceScheduler::checkMaintenanceStopTimer(unsigned long timerId, MaintenanceScheduleIterT& scheduleIt) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - timerId=%d",getName().c_str(),timerId).c_str()); bool isStopTimer=false; scheduleIt = m_maintenanceSchedule.begin(); while(!isStopTimer && scheduleIt != m_maintenanceSchedule.end()) @@ -420,7 +429,7 @@ bool AVTLogicalDeviceScheduler::checkMaintenanceStopTimer(unsigned long timerId, GCFEvent::TResult AVTLogicalDeviceScheduler::initial_state(GCFEvent& event, GCFPortInterface& port) { - LOG_DEBUG(formatString("%s(%s) (%s)",__func__,getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%d",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; @@ -664,7 +673,7 @@ GCFEvent::TResult AVTLogicalDeviceScheduler::initial_state(GCFEvent& event, GCFP void AVTLogicalDeviceScheduler::handlePropertySetAnswer(GCFEvent& answer) { -// LOG_DEBUG(formatString("%s(%s) (%s)",__func__,getName().c_str(),evtstr(answer))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); switch(answer.signal) { diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceScheduler.h b/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceScheduler.h index bbdec22af7be58175a09618294b9616a272f3c0d..0f5235112ea77c47328342783a51ff16bff79e34 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceScheduler.h +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceScheduler.h @@ -25,6 +25,7 @@ //# Includes //# Common Includes +#include <Common/LofarLogger.h> #include <Common/lofar_string.h> #include <Common/lofar_map.h> #include <boost/shared_ptr.hpp> @@ -201,6 +202,8 @@ namespace AVT GCFPort m_timerPort; AVTResourceManagerPtr m_resourceManager; + + ALLOC_TRACER_CONTEXT }; };//AVT };//LOFAR diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceServerMain.cc b/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceServerMain.cc index 03c6bfb59667089f941a15140cea3ccd84940198..9ebaaa7415ecb3d38ad20e6da64370ae096b9c6a 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceServerMain.cc +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTLogicalDeviceServerMain.cc @@ -20,14 +20,19 @@ //# //# $Id$ +#include <Common/LofarLogger.h> #include "AVTLogicalDeviceScheduler.h" #include <GCF/ParameterSet.h> +using namespace LOFAR; using namespace GCF; using namespace AVT; int main(int argc, char* argv[]) { + INIT_LOGGER(argv[0]); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,"LogicalDeviceScheduler"); + GCFTask::init(argc, argv); ParameterSet::instance()->adoptFile("LogicalDeviceServer.conf"); diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertyDefines.h b/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertyDefines.h index 5de902e530cacbf21bfdec77f6c7c2ca0c94cf1e..5ff0e57ec3705ca96b7b003683de159c3fa54310 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertyDefines.h +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertyDefines.h @@ -32,12 +32,12 @@ namespace AVT const char SCOPESEPARATOR[] = "_"; const char PROPERTYSEPARATOR[] = "."; -const char APC_SBF[] = "ApcStationBeamformer"; -const char APC_VT[] = "ApcVirtualTelescope"; -const char APC_SR[] = "ApcStationReceptor"; -const char APC_SRG[] = "ApcStationReceptorGroup"; -const char APC_LogicalDeviceScheduler[] = "ApcLogicalDeviceScheduler"; -const char APC_WaveformGenerator[] = "ApcWaveformGenerator"; +const char APC_SBF[] = "ApcStationBeamformer.xml"; +const char APC_VT[] = "ApcVirtualTelescope.xml"; +const char APC_SR[] = "ApcStationReceptor.xml"; +const char APC_SRG[] = "ApcStationReceptorGroup.xml"; +const char APC_LogicalDeviceScheduler[] = "ApcLogicalDeviceScheduler.xml"; +const char APC_WaveformGenerator[] = "ApcWaveformGenerator.xml"; const char SCOPE_PAC[] = "PAC"; const char SCOPE_PAC_VTn[] = "PAC_VT%d"; diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertySetAnswer.cc b/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertySetAnswer.cc index f605ad5c029fe36527cff2d63388bfe46ebe5d9d..74870a3ba18e3cc8dee0b5270f13af3a03cbe3bc 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertySetAnswer.cc +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertySetAnswer.cc @@ -20,6 +20,7 @@ //# //# $Id$ +#include <Common/LofarLogger.h> #include <APLCommon/APL_Defines.h> #include "AVTPropertySetAnswer.h" #include "AVTPropertySetAnswerHandlerInterface.h" @@ -27,16 +28,18 @@ using namespace LOFAR; using namespace AVT; +INIT_TRACER_CONTEXT(AVTPropertySetAnswer,LOFARLOGGER_PACKAGE); + AVTPropertySetAnswer::AVTPropertySetAnswer(AVTPropertySetAnswerHandlerInterface& handler) : GCFAnswer(), m_handler(handler) { - LOG_DEBUG(formatString("AVTPropertySetAnswer::AVTPropertySetAnswer")); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,"propertySetAnswer"); } AVTPropertySetAnswer::~AVTPropertySetAnswer() { - LOG_DEBUG(formatString("AVTPropertySetAnswer::~AVTPropertySetAnswer")); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,"propertySetAnswer"); } void AVTPropertySetAnswer::handleAnswer(GCFEvent& answer) diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertySetAnswer.h b/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertySetAnswer.h index edb98ba56b5f697cf19f322a2d8acf0724abe099..fc42af2b763b74ef3baa1c84e8dac4743f452bb8 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertySetAnswer.h +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertySetAnswer.h @@ -25,12 +25,14 @@ //# Includes //# Common Includes +#include <Common/LofarLogger.h> //# GCF Includes #include <GCF/PAL/GCF_Answer.h> #include <GCF/TM/GCF_Event.h> //# VirtualTelescope Includes // forward declaration +class GCFEvent; namespace LOFAR { @@ -38,7 +40,6 @@ namespace LOFAR namespace AVT { - class GCFEvent; class AVTPropertySetAnswerHandlerInterface; class AVTPropertySetAnswer : public GCFAnswer @@ -58,6 +59,8 @@ namespace AVT private: AVTPropertySetAnswerHandlerInterface& m_handler; + + ALLOC_TRACER_CONTEXT }; };//AVT };//LOFAR diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertySetAnswerHandlerInterface.h b/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertySetAnswerHandlerInterface.h index 6a3f6156d5d6eba96fcc7258e2142b888a8149a1..f899339b52384b843252526deff47bbb167f867c 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertySetAnswerHandlerInterface.h +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTPropertySetAnswerHandlerInterface.h @@ -25,6 +25,7 @@ //# Includes //# Common Includes +#include <Common/LofarLogger.h> //# GCF Includes #include <GCF/TM/GCF_Event.h> @@ -58,6 +59,8 @@ namespace AVT private: + + ALLOC_TRACER_CONTEXT }; };//AVT };//LOFAR diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTResourceManager.cc b/MAC/APL/PAC/_VirtualTelescope/src/AVTResourceManager.cc index 4bc0ceb9d1aba03accdbf5df3876320d2bf8dc1d..bb01c502d96bb968d4dd2e65546847148b47face 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTResourceManager.cc +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTResourceManager.cc @@ -37,6 +37,8 @@ using namespace AVT; using namespace std; using namespace boost; +INIT_TRACER_CONTEXT(AVTResourceManager,LOFARLOGGER_PACKAGE); + AVTResourceManager::AVTResourceManagerPtrInternal AVTResourceManager::s_avtResourceManagerInstance; void AVTResourceManager::checked_deleter::operator() (AVTResourceManager* _p) @@ -48,17 +50,17 @@ void AVTResourceManager::checked_deleter::operator() (AVTResourceManager* _p) AVTResourceManager::AVTResourceManager() : boost::noncopyable(), m_resourceRequests() { - LOG_DEBUG(formatString("%s",__func__)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,"resourceManager"); } AVTResourceManager::~AVTResourceManager() { - LOG_DEBUG(formatString("%s",__func__)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,"resourceManager"); } AVTResourceManagerPtr AVTResourceManager::instance() { - LOG_DEBUG(formatString("%s",__func__)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,"resourceManager"); AVTResourceManagerPtr tmp; if(s_avtResourceManagerInstance.expired()) @@ -79,6 +81,7 @@ AVTResourceManagerPtr AVTResourceManager::instance() */ void AVTResourceManager::requestResource(const string& taskName, const string& resourceName) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("task=%s,resource=%s",taskName.c_str(),resourceName.c_str()).c_str()); ResourceRequestsIterT requestsIt = m_resourceRequests.find(resourceName); if(requestsIt != m_resourceRequests.end()) { @@ -99,6 +102,7 @@ void AVTResourceManager::requestResource(const string& taskName, const string& r */ void AVTResourceManager::releaseResource(const string& taskName, const string& resourceName) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("task=%s,resource=%s",taskName.c_str(),resourceName.c_str()).c_str()); ResourceRequestsIterT requestsIt = m_resourceRequests.find(resourceName); if(requestsIt != m_resourceRequests.end()) { diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTResourceManager.h b/MAC/APL/PAC/_VirtualTelescope/src/AVTResourceManager.h index bf3b227e9837690618a9081b08d8f18a9b726dec..306bfaa10cda066742635a790b9da4c722a5f969 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTResourceManager.h +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTResourceManager.h @@ -25,6 +25,7 @@ //# Includes //# Common Includes +#include <Common/LofarLogger.h> #include <Common/lofar_string.h> #include <Common/lofar_map.h> #include <boost/shared_ptr.hpp> @@ -100,6 +101,8 @@ namespace AVT typedef ResourceRequestsT::iterator ResourceRequestsIterT; ResourceRequestsT m_resourceRequests; + + ALLOC_TRACER_CONTEXT }; };//AVT diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationBeamformer.cc b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationBeamformer.cc index 53c081b61cb5b19641fc7426a84995f45e29e699..829c2c390b95c1def4f810910bdc4f5e8be59ad0 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationBeamformer.cc +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationBeamformer.cc @@ -44,6 +44,8 @@ using namespace LOFAR; using namespace AVT; using namespace std; +INIT_TRACER_CONTEXT(AVTStationBeamformer,LOFARLOGGER_PACKAGE); + AVTStationBeamformer::AVTStationBeamformer(string& taskName, const string& scope, const string& APCName, @@ -62,8 +64,8 @@ AVTStationBeamformer::AVTStationBeamformer(string& taskName, m_directionAngle2(0.0), m_beamID(-1) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); registerProtocol(ABS_PROTOCOL, ABS_PROTOCOL_signalnames); - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::%s",getName().c_str(),__func__)); m_beamServer.setRemoteAddr(getName(),beamServerPortName); } @@ -71,7 +73,7 @@ AVTStationBeamformer::AVTStationBeamformer(string& taskName, AVTStationBeamformer::~AVTStationBeamformer() { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::%s",getName().c_str(),__func__)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); } int AVTStationBeamformer::convertDirection(const string type) const @@ -98,6 +100,7 @@ GCFPort& AVTStationBeamformer::getBeamServerPort() bool AVTStationBeamformer::isPrepared(vector<string>& parameters) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // compare all parameters with the parameters provided. // if all are equal, then the LD is prepared. bool isPrepared=true; @@ -135,7 +138,7 @@ bool AVTStationBeamformer::isPrepared(vector<string>& parameters) bool AVTStationBeamformer::checkQualityRequirements() { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::%s",getName().c_str(),__func__)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); bool requirementsMet=false; // quality requirements for this BeamFormer: @@ -154,7 +157,7 @@ bool AVTStationBeamformer::_isBeamServerPort(GCFPortInterface& port) void AVTStationBeamformer::concreteDisconnected(GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::concreteDisconnected",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // go to initial state only if the connection with the beamformer is lost. if(_isBeamServerPort(port)) { @@ -165,7 +168,7 @@ void AVTStationBeamformer::concreteDisconnected(GCFPortInterface& port) GCFEvent::TResult AVTStationBeamformer::concrete_initial_state(GCFEvent& event, GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::concrete_initial_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -184,14 +187,7 @@ GCFEvent::TResult AVTStationBeamformer::concrete_initial_state(GCFEvent& event, if(_isBeamServerPort(port)) { m_beamServerConnected=true; - if(isAPCLoaded()) - { - TRAN(AVTLogicalDevice::idle_state); - } - else - { - m_beamServer.setTimer(2.0); // try again - } + TRAN(AVTLogicalDevice::idle_state); } break; } @@ -208,14 +204,7 @@ GCFEvent::TResult AVTStationBeamformer::concrete_initial_state(GCFEvent& event, { if(m_beamServerConnected) { - if(isAPCLoaded()) - { - TRAN(AVTLogicalDevice::idle_state); - } - else - { - m_beamServer.setTimer(2.0); // try again - } + TRAN(AVTLogicalDevice::idle_state); } else { @@ -235,7 +224,7 @@ GCFEvent::TResult AVTStationBeamformer::concrete_initial_state(GCFEvent& event, GCFEvent::TResult AVTStationBeamformer::concrete_claiming_state(GCFEvent& event, GCFPortInterface& /*port*/, bool& stateFinished) { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::concrete_claiming_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -255,7 +244,7 @@ GCFEvent::TResult AVTStationBeamformer::concrete_claiming_state(GCFEvent& event, GCFEvent::TResult AVTStationBeamformer::concrete_preparing_state(GCFEvent& event, GCFPortInterface& port, bool& stateFinished, bool& error) { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::concrete_preparing_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; stateFinished=true; error=false; @@ -305,13 +294,13 @@ GCFEvent::TResult AVTStationBeamformer::concrete_preparing_state(GCFEvent& event GCFEvent::TResult AVTStationBeamformer::concrete_active_state(GCFEvent& event, GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::%s (%s)",getName().c_str(),__func__,evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); return GCFEvent::NOT_HANDLED; } GCFEvent::TResult AVTStationBeamformer::concrete_releasing_state(GCFEvent& event, GCFPortInterface& /*port*/, bool& stateFinished) { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::concrete_releasing_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -339,6 +328,7 @@ GCFEvent::TResult AVTStationBeamformer::concrete_releasing_state(GCFEvent& event void AVTStationBeamformer::handlePropertySetAnswer(GCFEvent& answer) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); switch(answer.signal) { case F_MYPS_ENABLED: @@ -372,7 +362,7 @@ void AVTStationBeamformer::handlePropertySetAnswer(GCFEvent& answer) } else { - LOG_ERROR(formatString("%s : apc %s NOT LOADED",getName().c_str(),pConfAnswer->pApcName)); + LOG_WARN(formatString("%s : apc %s NOT LOADED",getName().c_str(),pConfAnswer->pApcName)); } break; } @@ -491,7 +481,7 @@ void AVTStationBeamformer::handlePropertySetAnswer(GCFEvent& answer) void AVTStationBeamformer::concreteClaim(GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::concreteClaim",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // claim my own resources // send claim message to BeamServer @@ -505,7 +495,7 @@ void AVTStationBeamformer::concreteClaim(GCFPortInterface& port) void AVTStationBeamformer::concretePrepare(GCFPortInterface& /*port*/,string& parameters) { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::concretePrepare",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // prepare my own resources vector<string> decodedParameters; AVTUtilities::decodeParameters(parameters,decodedParameters); @@ -560,7 +550,7 @@ void AVTStationBeamformer::concretePrepare(GCFPortInterface& /*port*/,string& pa void AVTStationBeamformer::concreteResume(GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::concreteResume",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // resume my own resources // send resume message to BeamFormer @@ -571,7 +561,7 @@ void AVTStationBeamformer::concreteResume(GCFPortInterface& /*port*/) void AVTStationBeamformer::concreteSuspend(GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::concreteSuspend",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // suspend my own resources // send suspend message to BeamFormer @@ -581,7 +571,7 @@ void AVTStationBeamformer::concreteSuspend(GCFPortInterface& /*port*/) void AVTStationBeamformer::concreteRelease(GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationBeamformer(%s)::concreteRelease",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // release my own resources // send release message to BeamFormer diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationBeamformer.h b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationBeamformer.h index 9b7de4717842591c13899651edd4b1c010f32d3b..c1a076e9d38627a82f0b2514b1e5918a97fd4be1 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationBeamformer.h +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationBeamformer.h @@ -25,6 +25,7 @@ //# Includes //# Common Includes +#include <Common/LofarLogger.h> #include <Common/lofar_string.h> #include <set> #include <boost/shared_ptr.hpp> @@ -114,6 +115,8 @@ namespace AVT double m_directionAngle1; double m_directionAngle2; int m_beamID; + + ALLOC_TRACER_CONTEXT }; };//AVT };//LOFAR diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptor.cc b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptor.cc index 5d17e9806ea7ae8efb44fb7c49378c5ac96222a8..a08f86744319097dc627fd97848fc409fb8084fc 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptor.cc +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptor.cc @@ -44,6 +44,8 @@ using namespace AVT; using namespace std; using namespace boost; +INIT_TRACER_CONTEXT(AVTStationReceptor,LOFARLOGGER_PACKAGE); + AVTStationReceptor::AVTStationReceptor(string& taskName, const string& scope, const string& APCName, @@ -55,7 +57,7 @@ AVTStationReceptor::AVTStationReceptor(string& taskName, m_requiredResources(), m_requiredResourcesStatus() { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::AVTStationReceptor",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); list<TPropertyInfo>::const_iterator it=requiredResources.begin(); while(it!=requiredResources.end()) @@ -71,12 +73,12 @@ AVTStationReceptor::AVTStationReceptor(string& taskName, AVTStationReceptor::~AVTStationReceptor() { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::~AVTStationReceptor",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); } bool AVTStationReceptor::checkQualityRequirements() { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::%s",getName().c_str(),__func__)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); bool requirementsMet=true; int unavailableCounter = 0; int maxUnavailable = ParameterSet::instance()->getInt(PARAM_MAX_SR_RESOURCES_UNAVAILABLE); @@ -117,12 +119,12 @@ void AVTStationReceptor::setFrequency(const double frequency) void AVTStationReceptor::concreteDisconnected(GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::concreteDisconnected",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); } GCFEvent::TResult AVTStationReceptor::concrete_initial_state(GCFEvent& event, GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::concrete_initial_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -166,7 +168,7 @@ GCFEvent::TResult AVTStationReceptor::concrete_initial_state(GCFEvent& event, GC GCFEvent::TResult AVTStationReceptor::concrete_claiming_state(GCFEvent& event, GCFPortInterface& /*port*/, bool& stateFinished) { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::concrete_claiming_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -186,7 +188,7 @@ GCFEvent::TResult AVTStationReceptor::concrete_claiming_state(GCFEvent& event, G GCFEvent::TResult AVTStationReceptor::concrete_preparing_state(GCFEvent& event, GCFPortInterface& /*port*/, bool& stateFinished, bool& error) { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::concrete_preparing_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; stateFinished=false; error=false; @@ -208,13 +210,13 @@ GCFEvent::TResult AVTStationReceptor::concrete_preparing_state(GCFEvent& event, GCFEvent::TResult AVTStationReceptor::concrete_active_state(GCFEvent& event, GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::%s (%s)",getName().c_str(),__func__,evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); return GCFEvent::NOT_HANDLED; } GCFEvent::TResult AVTStationReceptor::concrete_releasing_state(GCFEvent& event, GCFPortInterface& /*port*/, bool& stateFinished) { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::concrete_releasing_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -234,6 +236,7 @@ GCFEvent::TResult AVTStationReceptor::concrete_releasing_state(GCFEvent& event, void AVTStationReceptor::handlePropertySetAnswer(GCFEvent& answer) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); switch(answer.signal) { case F_MYPS_ENABLED: @@ -261,7 +264,7 @@ void AVTStationReceptor::handlePropertySetAnswer(GCFEvent& answer) } else { - LOG_ERROR(formatString("%s : apc %s NOT LOADED",getName().c_str(),pConfAnswer->pApcName)); + LOG_WARN(formatString("%s : apc %s NOT LOADED",getName().c_str(),pConfAnswer->pApcName)); } break; } @@ -298,7 +301,7 @@ void AVTStationReceptor::handlePropertySetAnswer(GCFEvent& answer) void AVTStationReceptor::concreteClaim(GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::concreteClaim",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // claim my own resources AVTResourceManagerPtr resourceManager(AVTResourceManager::instance()); @@ -314,7 +317,7 @@ void AVTStationReceptor::concreteClaim(GCFPortInterface& port) void AVTStationReceptor::concretePrepare(GCFPortInterface& port, string& parameters) { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::concretePrepare",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // prepare my own resources vector<string> decodedParameters; AVTUtilities::decodeParameters(parameters,decodedParameters); @@ -329,21 +332,21 @@ void AVTStationReceptor::concretePrepare(GCFPortInterface& port, string& paramet void AVTStationReceptor::concreteResume(GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::concreteResume",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // resume my own resources } void AVTStationReceptor::concreteSuspend(GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::concreteSuspend",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // suspend my own resources } void AVTStationReceptor::concreteRelease(GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTStationReceptor(%s)::concreteRelease",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // release my own resources AVTResourceManagerPtr resourceManager(AVTResourceManager::instance()); diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptor.h b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptor.h index 6fd9ed1c93d3cb8f90ad7782dedf34a10ed36c5c..01476ab51938c8c9caa6dbd809ce51690f5612c4 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptor.h +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptor.h @@ -26,6 +26,7 @@ //# Includes //# Common Includes #include <time.h> +#include <Common/LofarLogger.h> #include <Common/lofar_string.h> #include <list> #include <map> @@ -106,6 +107,8 @@ namespace AVT double m_frequency; TExtPropertyMap m_requiredResources; std::map<std::string,bool> m_requiredResourcesStatus; + + ALLOC_TRACER_CONTEXT }; };//AVT };//LOFAR diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptorGroup.cc b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptorGroup.cc index 89fc1aeda4081dc29a2c56856f2f22ade821090a..f92038f8206691c5e7ac9aecb811c4f88818851e 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptorGroup.cc +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptorGroup.cc @@ -43,6 +43,8 @@ using namespace AVT; using namespace std; using namespace boost; +INIT_TRACER_CONTEXT(AVTStationReceptorGroup,LOFARLOGGER_PACKAGE); + AVTStationReceptorGroup::TStationReceptorConnection::TStationReceptorConnection( shared_ptr<AVTStationReceptor> _rcu, GCFTask& _containerTask, @@ -54,7 +56,6 @@ AVTStationReceptorGroup::TStationReceptorConnection::TStationReceptorConnection( clientPort(new APLInterTaskPort((GCFTask&)(*_rcu),_containerTask,_name,_type,_protocol)), connected(_connected) { - LOG_DEBUG(formatString("TStationReceptorConnection(0x%x)::TStationReceptorConnection",this)); rcu->addClientInterTaskPort(clientPort.get()); } @@ -68,7 +69,7 @@ AVTStationReceptorGroup::AVTStationReceptorGroup(string& taskName, m_stopTime(0), m_frequency(0.0) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::AVTStationReceptorGroup",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); vector<shared_ptr<AVTStationReceptor> >::iterator rIt; for(rIt=rcus.begin();rIt!=rcus.end();++rIt) @@ -90,7 +91,7 @@ AVTStationReceptorGroup::AVTStationReceptorGroup(string& taskName, AVTStationReceptorGroup::~AVTStationReceptorGroup() { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::~AVTStationReceptorGroup",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); } bool AVTStationReceptorGroup::isPrepared(vector<string>& parameters) @@ -106,7 +107,7 @@ bool AVTStationReceptorGroup::isPrepared(vector<string>& parameters) bool AVTStationReceptorGroup::checkQualityRequirements() { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::%s",getName().c_str(),__func__)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); bool requirementsMet=true; int unavailableCounter = 0; int maxUnavailable = ParameterSet::instance()->getInt(PARAM_MAX_SRG_RESOURCES_UNAVAILABLE); @@ -149,7 +150,7 @@ void AVTStationReceptorGroup::setFrequency(const double frequency) bool AVTStationReceptorGroup::isStationReceptorClient(GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s,0x%x)::isStationReceptorClient",getName().c_str(),this)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); TStationReceptorVectorIter it = m_stationReceptors.begin(); bool found=false; while(!found && it!=m_stationReceptors.end()) @@ -162,7 +163,7 @@ bool AVTStationReceptorGroup::isStationReceptorClient(GCFPortInterface& port) bool AVTStationReceptorGroup::setReceptorConnected(GCFPortInterface& port, bool connected) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s,0x%x)::%s(0x%x,%s)",getName().c_str(),this,__func__,&port,(connected?"true":"false"))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); TStationReceptorVectorIter it = m_stationReceptors.begin(); bool found=false; while(!found && it!=m_stationReceptors.end()) @@ -208,7 +209,7 @@ bool AVTStationReceptorGroup::allReceptorsInState(TLogicalDeviceState state) void AVTStationReceptorGroup::sendToAllReceptors(GCFEvent& event) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s,0x%x)::sendToAllReceptors",getName().c_str(),this)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); TStationReceptorVectorIter it; for(it=m_stationReceptors.begin();it!=m_stationReceptors.end();++it) { @@ -218,7 +219,7 @@ void AVTStationReceptorGroup::sendToAllReceptors(GCFEvent& event) void AVTStationReceptorGroup::concreteDisconnected(GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::concreteDisconnected",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // go to initial state only if the connection with the receptor is lost. if(isStationReceptorClient(port)) { @@ -228,7 +229,7 @@ void AVTStationReceptorGroup::concreteDisconnected(GCFPortInterface& port) GCFEvent::TResult AVTStationReceptorGroup::concrete_initial_state(GCFEvent& event, GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::concrete_initial_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -257,14 +258,7 @@ GCFEvent::TResult AVTStationReceptorGroup::concrete_initial_state(GCFEvent& even { if(allReceptorsConnected()) { - if(isAPCLoaded()) - { - TRAN(AVTLogicalDevice::idle_state); - } - else - { - port.setTimer(2.0); // try again - } + TRAN(AVTLogicalDevice::idle_state); } } break; @@ -285,14 +279,7 @@ GCFEvent::TResult AVTStationReceptorGroup::concrete_initial_state(GCFEvent& even { if(allReceptorsConnected()) { - if(isAPCLoaded()) - { - TRAN(AVTLogicalDevice::idle_state); - } - else - { - port.setTimer(2.0); // try again - } + TRAN(AVTLogicalDevice::idle_state); } } break; @@ -309,7 +296,7 @@ GCFEvent::TResult AVTStationReceptorGroup::concrete_initial_state(GCFEvent& even GCFEvent::TResult AVTStationReceptorGroup::concrete_claiming_state(GCFEvent& event, GCFPortInterface& /*port*/, bool& stateFinished) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::concrete_claiming_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -335,7 +322,7 @@ GCFEvent::TResult AVTStationReceptorGroup::concrete_claiming_state(GCFEvent& eve GCFEvent::TResult AVTStationReceptorGroup::concrete_preparing_state(GCFEvent& event, GCFPortInterface& /*port*/, bool& stateFinished, bool& error) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::concrete_preparing_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; stateFinished=false; error=false; @@ -363,13 +350,13 @@ GCFEvent::TResult AVTStationReceptorGroup::concrete_preparing_state(GCFEvent& ev GCFEvent::TResult AVTStationReceptorGroup::concrete_active_state(GCFEvent& event, GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::%s (%s)",getName().c_str(),__func__,evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); return GCFEvent::NOT_HANDLED; } GCFEvent::TResult AVTStationReceptorGroup::concrete_releasing_state(GCFEvent& event, GCFPortInterface& /*port*/, bool& stateFinished) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::concrete_releasing_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -395,6 +382,7 @@ GCFEvent::TResult AVTStationReceptorGroup::concrete_releasing_state(GCFEvent& ev void AVTStationReceptorGroup::handlePropertySetAnswer(GCFEvent& answer) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); switch(answer.signal) { case F_MYPS_ENABLED: @@ -422,7 +410,7 @@ void AVTStationReceptorGroup::handlePropertySetAnswer(GCFEvent& answer) } else { - LOG_ERROR(formatString("%s : apc %s NOT LOADED",getName().c_str(),pConfAnswer->pApcName)); + LOG_WARN(formatString("%s : apc %s NOT LOADED",getName().c_str(),pConfAnswer->pApcName)); } break; } @@ -483,7 +471,7 @@ void AVTStationReceptorGroup::handlePropertySetAnswer(GCFEvent& answer) void AVTStationReceptorGroup::concreteClaim(GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::concreteClaim",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // claim my own resources AVTResourceManagerPtr resourceManager(AVTResourceManager::instance()); @@ -500,7 +488,7 @@ void AVTStationReceptorGroup::concreteClaim(GCFPortInterface& /*port*/) void AVTStationReceptorGroup::concretePrepare(GCFPortInterface& /*port*/,string& parameters) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::concretePrepare",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // prepare my own resources vector<string> decodedParameters; AVTUtilities::decodeParameters(parameters,decodedParameters); @@ -518,7 +506,7 @@ void AVTStationReceptorGroup::concretePrepare(GCFPortInterface& /*port*/,string& void AVTStationReceptorGroup::concreteResume(GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::concreteResume",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // resume my own resources // send resume message to receptors @@ -528,7 +516,7 @@ void AVTStationReceptorGroup::concreteResume(GCFPortInterface& /*port*/) void AVTStationReceptorGroup::concreteSuspend(GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::concreteSuspend",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // suspend my own resources // send suspend message to receptors @@ -538,7 +526,7 @@ void AVTStationReceptorGroup::concreteSuspend(GCFPortInterface& /*port*/) void AVTStationReceptorGroup::concreteRelease(GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTStationReceptorGroup(%s)::concreteRelease",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // release my own resources AVTResourceManagerPtr resourceManager(AVTResourceManager::instance()); diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptorGroup.h b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptorGroup.h index 9ea952f5b36de1f05dc9999fd39e8b8f2fd585f9..254c01d452a0c5c0540170c7b266fc3a0ec7ef27 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptorGroup.h +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTStationReceptorGroup.h @@ -29,6 +29,7 @@ //# Common Includes #include <time.h> +#include <Common/LofarLogger.h> #include <Common/lofar_string.h> //# GCF Includes #include <GCF/TM/GCF_Port.h> @@ -131,6 +132,8 @@ namespace AVT time_t m_startTime; time_t m_stopTime; double m_frequency; + + ALLOC_TRACER_CONTEXT }; };//AVT };//LOFAR diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTUtilities.cc b/MAC/APL/PAC/_VirtualTelescope/src/AVTUtilities.cc index 7761f72e959bbbfb966c5de9084a4e4ca9e9a95d..e9f17b499056caeddae0129373e9000d1ef9f7b1 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTUtilities.cc +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTUtilities.cc @@ -26,6 +26,8 @@ using namespace LOFAR; using namespace AVT; +INIT_TRACER_CONTEXT(AVTUtilities,LOFARLOGGER_PACKAGE); + AVTUtilities::AVTUtilities() { } diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTUtilities.h b/MAC/APL/PAC/_VirtualTelescope/src/AVTUtilities.h index b4a3e315ad3296b86d01d428d8a17b2548c2865f..e91fc1dc5dc8c70fbd284ce75f3a12e628a3e57f 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTUtilities.h +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTUtilities.h @@ -25,6 +25,7 @@ //# Includes //# Common Includes +#include <Common/LofarLogger.h> #include <Common/lofar_vector.h> #include <Common/lofar_string.h> @@ -59,6 +60,8 @@ class AVTUtilities AVTUtilities& operator=(const AVTUtilities&); private: + + ALLOC_TRACER_CONTEXT }; };//AVT diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTVirtualTelescope.cc b/MAC/APL/PAC/_VirtualTelescope/src/AVTVirtualTelescope.cc index dc3c211e37f1f0b179d29800ae1e02ed7e43d9e6..79a5030f3af718c8cbe2d70809e1e167b0ace1be 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTVirtualTelescope.cc +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTVirtualTelescope.cc @@ -41,6 +41,8 @@ using namespace LOFAR; using namespace AVT; using namespace std; +INIT_TRACER_CONTEXT(AVTVirtualTelescope,LOFARLOGGER_PACKAGE); + AVTVirtualTelescope::AVTVirtualTelescope(string& taskName, const string& scope, const string& APCName, @@ -59,7 +61,7 @@ AVTVirtualTelescope::AVTVirtualTelescope(string& taskName, m_stopTime(0), m_frequency(0.0) { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::AVTVirtualTelescope",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); m_stationBeamformer.addClientInterTaskPort(&m_beamFormerClient); m_stationReceptorGroup.addClientInterTaskPort(&m_stationReceptorGroupClient); } @@ -67,12 +69,12 @@ AVTVirtualTelescope::AVTVirtualTelescope(string& taskName, AVTVirtualTelescope::~AVTVirtualTelescope() { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::~AVTVirtualTelescope",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); } bool AVTVirtualTelescope::checkQualityRequirements() { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::%s",getName().c_str(),__func__)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); bool requirementsMet=false; // quality requirements for this Virtual Telescope: @@ -163,7 +165,7 @@ bool AVTVirtualTelescope::allInState(GCFPortInterface& port, TLogicalDeviceState void AVTVirtualTelescope::concreteDisconnected(GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::concreteDisconnected",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // go to initial state only if the connection with the beamformer is lost. if(_isBeamFormerClient(port)) { @@ -179,7 +181,7 @@ void AVTVirtualTelescope::concreteDisconnected(GCFPortInterface& port) GCFEvent::TResult AVTVirtualTelescope::concrete_initial_state(GCFEvent& event, GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::concrete_initial_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -208,14 +210,7 @@ GCFEvent::TResult AVTVirtualTelescope::concrete_initial_state(GCFEvent& event, G } if(m_beamFormerConnected && m_stationReceptorGroupConnected) { - if(isAPCLoaded()) - { - TRAN(AVTLogicalDevice::idle_state); - } - else - { - port.setTimer(3.0); // try again - } + TRAN(AVTLogicalDevice::idle_state); } break; } @@ -238,14 +233,7 @@ GCFEvent::TResult AVTVirtualTelescope::concrete_initial_state(GCFEvent& event, G } if(m_beamFormerConnected && m_stationReceptorGroupConnected) { - if(isAPCLoaded()) - { - TRAN(AVTLogicalDevice::idle_state); - } - else - { - port.setTimer(3.0); // try again - } + TRAN(AVTLogicalDevice::idle_state); } break; @@ -260,7 +248,7 @@ GCFEvent::TResult AVTVirtualTelescope::concrete_initial_state(GCFEvent& event, G GCFEvent::TResult AVTVirtualTelescope::concrete_claiming_state(GCFEvent& event, GCFPortInterface& port, bool& stateFinished) { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::%s (%s)",getName().c_str(),__func__,evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -296,7 +284,7 @@ GCFEvent::TResult AVTVirtualTelescope::concrete_claiming_state(GCFEvent& event, GCFEvent::TResult AVTVirtualTelescope::concrete_preparing_state(GCFEvent& event, GCFPortInterface& port, bool& stateFinished, bool& error) { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::concrete_preparing_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; stateFinished=false; error=false; @@ -325,7 +313,7 @@ GCFEvent::TResult AVTVirtualTelescope::concrete_preparing_state(GCFEvent& event, GCFEvent::TResult AVTVirtualTelescope::concrete_active_state(GCFEvent& event, GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::%s (%s)",getName().c_str(),__func__,evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -364,7 +352,7 @@ GCFEvent::TResult AVTVirtualTelescope::concrete_active_state(GCFEvent& event, GC GCFEvent::TResult AVTVirtualTelescope::concrete_releasing_state(GCFEvent& event, GCFPortInterface& port, bool& stateFinished) { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::concrete_releasing_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); GCFEvent::TResult status = GCFEvent::HANDLED; switch (event.signal) @@ -390,6 +378,7 @@ GCFEvent::TResult AVTVirtualTelescope::concrete_releasing_state(GCFEvent& event, void AVTVirtualTelescope::handlePropertySetAnswer(GCFEvent& answer) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); switch(answer.signal) { case F_MYPS_ENABLED: @@ -417,7 +406,7 @@ void AVTVirtualTelescope::handlePropertySetAnswer(GCFEvent& answer) } else { - LOG_ERROR(formatString("%s : apc %s NOT LOADED",getName().c_str(),pConfAnswer->pApcName)); + LOG_WARN(formatString("%s : apc %s NOT LOADED",getName().c_str(),pConfAnswer->pApcName)); } break; } @@ -498,7 +487,7 @@ void AVTVirtualTelescope::handlePropertySetAnswer(GCFEvent& answer) void AVTVirtualTelescope::concreteClaim(GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::%s",getName().c_str(),__func__)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // claim my own resources AVTResourceManagerPtr resourceManager(AVTResourceManager::instance()); resourceManager->requestResource(getName(),m_stationBeamformer.getName()); @@ -526,7 +515,7 @@ void AVTVirtualTelescope::concreteClaim(GCFPortInterface& port) void AVTVirtualTelescope::concretePrepare(GCFPortInterface& /*port*/,string& parameters) { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::%s(%s)",getName().c_str(),__func__,parameters.c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); bool unableToPrepare = false; AVTResourceManagerPtr resourceManager(AVTResourceManager::instance()); @@ -584,7 +573,7 @@ void AVTVirtualTelescope::concretePrepare(GCFPortInterface& /*port*/,string& par void AVTVirtualTelescope::concreteResume(GCFPortInterface& port) { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::%s",getName().c_str(),__func__)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // resume my own resources // send resume message to BeamFormer and SRGT @@ -613,7 +602,7 @@ void AVTVirtualTelescope::concreteResume(GCFPortInterface& port) void AVTVirtualTelescope::concreteSuspend(GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::%s",getName().c_str(),__func__)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // suspend my own resources // send suspend message to BeamFormer and SRG @@ -631,7 +620,7 @@ void AVTVirtualTelescope::concreteSuspend(GCFPortInterface& /*port*/) void AVTVirtualTelescope::concreteRelease(GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("AVTVirtualTelescope(%s)::%s",getName().c_str(),__func__)); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); // release my own resources // claim my own resources diff --git a/MAC/APL/PAC/_VirtualTelescope/src/AVTVirtualTelescope.h b/MAC/APL/PAC/_VirtualTelescope/src/AVTVirtualTelescope.h index a9c4d393ae71ce20afc46c7c04089bb5b0841b79..b781aefb41593c749844ae922bc9559d0d3141b0 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/AVTVirtualTelescope.h +++ b/MAC/APL/PAC/_VirtualTelescope/src/AVTVirtualTelescope.h @@ -26,6 +26,7 @@ //# Includes //# Common Includes #include <time.h> +#include <Common/LofarLogger.h> #include <Common/lofar_string.h> //# GCF Includes #include <GCF/TM/GCF_Port.h> @@ -126,6 +127,8 @@ namespace AVT time_t m_stopTime; double m_frequency; + + ALLOC_TRACER_CONTEXT }; };//AVT diff --git a/MAC/APL/PAC/_VirtualTelescope/src/LogicalDeviceServer.conf.in b/MAC/APL/PAC/_VirtualTelescope/src/LogicalDeviceServer.conf.in index 9af01474ea165ca67a1b4db05601047aaf674dff..0782f950e6210bdd6087cc935f7f669d39933a7b 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/LogicalDeviceServer.conf.in +++ b/MAC/APL/PAC/_VirtualTelescope/src/LogicalDeviceServer.conf.in @@ -16,8 +16,8 @@ mac.apl.avt.BEAMSERVERPORT=BeamServer mac.apl.avt.MAX_SR_RESOURCES_UNAVAILABLE=0 # number of station receptors used by a station receptor group that may be unavailable mac.apl.avt.MAX_SRG_RESOURCES_UNAVAILABLE=1 -mac.apl.avt.APC_VT1=ApcStationBeamformer_VT1 -mac.apl.avt.APC_BF1=ApcStationBeamformer_BF1 +#mac.apl.avt.APC_VT1=ApcVirtualTelescope_VT1 +#mac.apl.avt.APC_BF1=ApcStationBeamformer_BF1 mac.ns.VT1.VT1_server.type=TCP mac.ns.VT2.VT2_server.type=TCP diff --git a/MAC/APL/PAC/_VirtualTelescope/src/LogicalDeviceServer.log_prop.in b/MAC/APL/PAC/_VirtualTelescope/src/LogicalDeviceServer.log_prop.in new file mode 100644 index 0000000000000000000000000000000000000000..f1fa8c66c7715619d7de470b0fe765dcfd0dd5d5 --- /dev/null +++ b/MAC/APL/PAC/_VirtualTelescope/src/LogicalDeviceServer.log_prop.in @@ -0,0 +1,37 @@ +# add your custom loggers and appenders here +# + +log4cplus.rootLogger=INFO, STDOUT + +log4cplus.logger.TRC=PUTJE +log4cplus.additivity.TRC=FALSE + +log4cplus.logger.MAC=DEBUG, STDOUT, FILE +log4cplus.additivity.MAC=FALSE + +log4cplus.logger.TRC.MAC=TRACE, FILE +log4cplus.additivity.TRC.MAC=FALSE + +log4cplus.appender.PUTJE=log4cplus::NullAppender + +log4cplus.appender.STDOUT=log4cplus::ConsoleAppender +log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout +log4cplus.appender.STDOUT.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S} %-5p %c{9} - %m [%.25l]%n + +log4cplus.appender.FILE=log4cplus::RollingFileAppender +log4cplus.appender.FILE.File=LogicalDeviceServerlog.log +log4cplus.appender.FILE.MaxFileSize=5MB +log4cplus.appender.FILE.MaxBackupIndex=5 +log4cplus.appender.FILE.layout=log4cplus::PatternLayout +log4cplus.appender.FILE.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S} %-5p %c{3} - %m [%.25l]%n + +log4cplus.appender.XMLFILE=log4cplus::RollingFileAppender +log4cplus.appender.XMLFILE.File=LogicalDeviceServerlog.xml +log4cplus.appender.XMLFILE.MaxFileSize=5MB +log4cplus.appender.XMLFILE.MaxBackupIndex=5 +log4cplus.appender.XMLFILE.layout=log4cplus::XMLLayout + +log4cplus.appender.CHAINSAW=log4cplus::XMLSocketAppender +log4cplus.appender.CHAINSAW.host=localhost +log4cplus.appender.CHAINSAW.port=4448 +log4cplus.appender.CHAINSAW.layout=log4cplus::XMLLayout diff --git a/MAC/APL/PAC/_VirtualTelescope/src/Makefile.am b/MAC/APL/PAC/_VirtualTelescope/src/Makefile.am index 8e2595e3179722dce088731d27b6c7555c6fded4..615ca74621cdf8866fd14f5bffa7eaa8dace699e 100644 --- a/MAC/APL/PAC/_VirtualTelescope/src/Makefile.am +++ b/MAC/APL/PAC/_VirtualTelescope/src/Makefile.am @@ -34,18 +34,22 @@ include_HEADERS = \ $(top_builddir)/src/LogicalDevice_Protocol.ph BUILT_SOURCES = \ - LogicalDevice_Protocol.ph + LogicalDevice_Protocol.ph \ + LogicalDeviceServer.conf \ + LogicalDeviceServer.log_prop EXTRA_DIST = \ - LogicalDevice_Protocol.ph - + LogicalDevice_Protocol.ph \ + LogicalDeviceServer.conf \ + LogicalDeviceServer.log_prop + #in case of make install these files will be copied to the bindir beside the test apps configfilesdir=$(bindir) configfiles_DATA= \ LogicalDeviceServer.conf \ - log4cplus.properties + LogicalDeviceServer.log_prop -%.properties: $(MAC_CONFIG)/%.properties +%.log_prop: %.log_prop.in cp $< $@ %.conf: %.conf.in diff --git a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestAnswer.cc b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestAnswer.cc index 3410d0a10a8e0be1b36a134c32246577c7974b62..ee9b97919563b5df2eefa6bce7d332d4a203dc88 100644 --- a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestAnswer.cc +++ b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestAnswer.cc @@ -23,6 +23,9 @@ #include "AVTTestAnswer.h" #include <GCF/TM/GCF_Task.h> +using namespace LOFAR; +using namespace AVT; + AVTTestAnswer::AVTTestAnswer() : m_dummyPort(), m_task(0) diff --git a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestAnswer.h b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestAnswer.h index 0bb481d62ad9d41bf9aaae00e22b8de0b5e68620..f443189be63950722dee0f48d525eae2efcf420b 100644 --- a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestAnswer.h +++ b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestAnswer.h @@ -29,17 +29,24 @@ class GCFEvent; class GCFTask; -class AVTTestAnswer : public GCFAnswer +namespace LOFAR { - public: - AVTTestAnswer(); - ~AVTTestAnswer(); - - void setTask(GCFTask* t); - void handleAnswer(GCFEvent& answer); - - private: - GCFPort m_dummyPort; - GCFTask* m_task; +namespace AVT +{ + + class AVTTestAnswer : public GCFAnswer + { + public: + AVTTestAnswer(); + ~AVTTestAnswer(); + + void setTask(GCFTask* t); + void handleAnswer(GCFEvent& answer); + + private: + GCFPort m_dummyPort; + GCFTask* m_task; + }; +}; }; #endif diff --git a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestMAC2Task.cc b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestMAC2Task.cc index 9a99a9d82c8a563a68719889eb47a93239775889..134efdee4f29617d05030bb5ebc8c99c7f64f6a7 100644 --- a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestMAC2Task.cc +++ b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestMAC2Task.cc @@ -64,10 +64,12 @@ using namespace std; TRAN(AVTTestMAC2Task::test##_test_); \ } -#define FINISH \ +#define FINISH FINISHIMPL(AVTTestMAC2Task::finished) + +#define FINISHIMPL(_target_) \ { \ reportSubTest(); \ - TRAN(AVTTestMAC2Task::finished); \ + tran(static_cast<GCFFsm::State>(&_target_), __func__, #_target_); \ } #define ABORT_TESTS \ @@ -98,14 +100,14 @@ using namespace std; #define ADDTRANTARGET(_targetvector_,_target_,_num_,_descr_) \ { \ - TTranTarget tt={static_cast<State>(&_target_), #_target_,#_num_,_descr_}; \ + TTranTarget tt={static_cast<AVTTestMAC2Task::State>(&_target_), #_target_,#_num_,_descr_}; \ _targetvector_.push_back(tt); \ } #define TESTTRAN(_trantarget_) \ { \ setCurSubTest(_trantarget_->testNum,_trantarget_->description); \ - tran(static_cast<State>(_trantarget_->target), __func__, _trantarget_->targetName); \ + tran(static_cast<GCFFsm::State>(_trantarget_->target), __func__, _trantarget_->targetName); \ } #define NEXTTEST(_iterator_) \ @@ -114,10 +116,10 @@ using namespace std; _iterator_++; \ TESTTRAN(tempIt); \ } - + typedef struct { - GCFFsm::State target; + AVTTestMAC2Task::State target; const char* targetName; const char* testNum; const char* description; @@ -130,7 +132,7 @@ string AVTTestMAC2Task::m_taskName("AVTTestMAC2"); string g_timerPortName("timerPort"); AVTTestMAC2Task::AVTTestMAC2Task() : - GCFTask((State)&AVTTestMAC2Task::initial, m_taskName), + GCFTask((GCFFsm::State)&AVTTestMAC2Task::initial, m_taskName), Test(m_taskName), m_answer(), m_timerPort(*this, g_timerPortName, GCFPortInterface::SPP, LOGICALDEVICE_PROTOCOL), diff --git a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestMAC2Task.h b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestMAC2Task.h index 78910226cbffb0b957dd2c3d46133ac7e1a7660f..ee35d028a9a647957e2202af3e25401df39ab61f 100644 --- a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestMAC2Task.h +++ b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestMAC2Task.h @@ -38,12 +38,19 @@ // forward declaration class GCFEvent; + +namespace LOFAR +{ namespace AVT { class AVTTestMAC2Task : public GCFTask, public Test { public: + // as of GCF_Fsm.h version 1.4, the GCFFsm::State typedef is protected. + // The workaround is simple yet highly undesirable: copy & paste + typedef GCFEvent::TResult (AVTTestMAC2Task::*State)(GCFEvent& event, GCFPortInterface& port); // ptr to state handler type + AVTTestMAC2Task(); virtual ~AVTTestMAC2Task(); virtual void run(); @@ -97,5 +104,6 @@ namespace AVT }; }; +}; #endif diff --git a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestMain.cc b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestMain.cc index 9d04600423249d7b49929548ddd318f655adbbeb..ccc5ab050f17266e32d27aec9a0569aab7ed4df1 100644 --- a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestMain.cc +++ b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestMain.cc @@ -20,6 +20,7 @@ //# //# $Id$ +#include <Common/LofarLogger.h> #include <GCF/CmdLine.h> #include <GCF/TM/GCF_Task.h> #include <Suite/suite.h> @@ -27,12 +28,15 @@ #include "AVTTestMAC2Task.h" #include <boost/shared_ptr.hpp> +using namespace LOFAR; using namespace AVT; int main(int argc, char* argv[]) { int retval=-1; - + + INIT_LOGGER(argv[0]); + { bool mac1Test=false; bool mac2Test=false; diff --git a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestTask.cc b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestTask.cc index e7c707a75288c628a4682c28618d26828394cc7c..e9c6a8513f8b02705161b35ce23f921e9fa56364 100644 --- a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestTask.cc +++ b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestTask.cc @@ -20,7 +20,14 @@ //# //# $Id$ +#include <stdio.h> #include <math.h> + +#undef PACKAGE +#undef VERSION +#include <lofar_config.h> +#include <Common/LofarLogger.h> + #include <GCF/GCF_PValue.h> #include <GCF/GCF_PVUnsigned.h> #include <GCF/GCF_PVString.h> @@ -29,22 +36,10 @@ #include "AVTTestTask.h" #include "../src/AVTPropertyDefines.h" -#undef PACKAGE -#undef VERSION #define DECLARE_SIGNAL_NAMES #include "../src/LogicalDevice_Protocol.ph" #include <ABS_Protocol.ph> -#include <stdio.h> - -#undef PACKAGE -#undef VERSION -#include <lofar_config.h> -#include <Common/LofarLogger.h> - -using namespace LOFAR; -using namespace AVT; -using namespace std; #define NEXT_TEST(_test_, _descr_) \ { \ @@ -84,6 +79,10 @@ using namespace std; break; \ } +using namespace LOFAR; +using namespace AVT; +using namespace std; + string AVTTestTask::m_taskName("AVTTest"); bool AVTTestTask::m_sBeamServerOnly(false); string gBSName("BeamServer"); diff --git a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestTask.h b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestTask.h index 1341170a86704f2ca780cec2bddeb861e0f639e5..253da927c0f55b13d08fcc95210c632fb0fa01df 100644 --- a/MAC/APL/PAC/_VirtualTelescope/test/AVTTestTask.h +++ b/MAC/APL/PAC/_VirtualTelescope/test/AVTTestTask.h @@ -42,8 +42,11 @@ class GCFEvent; class GCFPortInterface; +namespace LOFAR +{ namespace AVT { + class AVTTestTask : public GCFTask, public Test { public: @@ -101,5 +104,6 @@ namespace AVT }; }; +}; #endif diff --git a/MAC/APL/PAC/_VirtualTelescope/test/Makefile.am b/MAC/APL/PAC/_VirtualTelescope/test/Makefile.am index 594629f85b56088b7505a34302799db87505da12..410d1941fa5ac4b48f45190d98d863956d5bcd62 100644 --- a/MAC/APL/PAC/_VirtualTelescope/test/Makefile.am +++ b/MAC/APL/PAC/_VirtualTelescope/test/Makefile.am @@ -24,16 +24,16 @@ avttest_LDADD = \ -labs BUILT_SOURCES = \ - avttest.conf \ ../src/LogicalDevice_Protocol.ph \ - log4cplus.properties + avttest.conf \ + avttest.log_prop EXTRA_DIST = \ - avttest.conf \ ../LogicalDevice_Protocol.ph \ - log4cplus.properties + avttest.conf \ + avttest.log_prop -%.properties: $(MAC_CONFIG)/%.properties +%.log_prop: %.log_prop.in cp $< $@ %.conf: %.conf.in diff --git a/MAC/APL/PAC/_VirtualTelescope/test/avttest.log_prop.in b/MAC/APL/PAC/_VirtualTelescope/test/avttest.log_prop.in new file mode 100644 index 0000000000000000000000000000000000000000..73e6fb4021d147b95ee4d521e2551b439d70a889 --- /dev/null +++ b/MAC/APL/PAC/_VirtualTelescope/test/avttest.log_prop.in @@ -0,0 +1,37 @@ +# add your custom loggers and appenders here +# + +log4cplus.rootLogger=INFO, STDOUT + +log4cplus.logger.TRC=PUTJE +log4cplus.additivity.TRC=FALSE + +log4cplus.logger.MAC=DEBUG, STDOUT, FILE, XMLFILE +log4cplus.additivity.MAC=FALSE + +log4cplus.logger.TRC.MAC=TRACE, STDOUT, FILE, XMLFILE +log4cplus.additivity.TRC.MAC=FALSE + +log4cplus.appender.PUTJE=log4cplus::NullAppender + +log4cplus.appender.STDOUT=log4cplus::ConsoleAppender +log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout +log4cplus.appender.STDOUT.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S} %-5p %c{9} - %m [%.25l]%n + +log4cplus.appender.FILE=log4cplus::RollingFileAppender +log4cplus.appender.FILE.File=AVTVirtualInstrumentlog.log +log4cplus.appender.FILE.MaxFileSize=5MB +log4cplus.appender.FILE.MaxBackupIndex=5 +log4cplus.appender.FILE.layout=log4cplus::PatternLayout +log4cplus.appender.FILE.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S} %-5p %c{3} - %m [%.25l]%n + +log4cplus.appender.XMLFILE=log4cplus::RollingFileAppender +log4cplus.appender.XMLFILE.File=AVTVirtualInstrumentlog.xml +log4cplus.appender.XMLFILE.MaxFileSize=5MB +log4cplus.appender.XMLFILE.MaxBackupIndex=5 +log4cplus.appender.XMLFILE.layout=log4cplus::XMLLayout + +log4cplus.appender.CHAINSAW=log4cplus::XMLSocketAppender +log4cplus.appender.CHAINSAW.host=localhost +log4cplus.appender.CHAINSAW.port=4448 +log4cplus.appender.CHAINSAW.layout=log4cplus::XMLLayout diff --git a/MAC/APL/_GSO/MACScheduler/configure.in b/MAC/APL/_GSO/MACScheduler/configure.in index 5b874377316de8e5439fc1a338366e20271713b8..18796f670abe1e03f534ccf6bb6151cc98f1da2c 100644 --- a/MAC/APL/_GSO/MACScheduler/configure.in +++ b/MAC/APL/_GSO/MACScheduler/configure.in @@ -55,7 +55,7 @@ dnl dnl Check for LOFAR specific things dnl lofar_DEBUG_OPTIMIZE -#lofar_QT +lofar_CHECK_PRETTY_FUNCTION lofar_QATOOLS lofar_DOCXX lofar_COMPILETOOLS diff --git a/MAC/APL/_GSO/MACScheduler/src/MACScheduler.cc b/MAC/APL/_GSO/MACScheduler/src/MACScheduler.cc index 07b2d8ba2779d3f6e5ee3538d0b7476f9da9e30c..fb3c24efbe55de60544c90e2c6304aa7c3afbbdb 100644 --- a/MAC/APL/_GSO/MACScheduler/src/MACScheduler.cc +++ b/MAC/APL/_GSO/MACScheduler/src/MACScheduler.cc @@ -36,6 +36,7 @@ #include "APLCommon/LogicalDevice_Protocol.ph" #include "APLCommon/StartDaemon_Protocol.ph" +INIT_TRACER_CONTEXT(LOFAR::GSO::MACScheduler,LOFARLOGGER_PACKAGE); namespace LOFAR { @@ -63,22 +64,27 @@ MACScheduler::MACScheduler() : PropertySetAnswerHandlerInterface(), m_propertySetAnswer(*this), m_propertySet(), - m_SASserverPortName(MS_TASKNAME+string("_SAS_server")), + m_SASserverPortName(string("SAS_server")), m_SASserverPort(*this, m_SASserverPortName, ::GCFPortInterface::MSPP, SAS_PROTOCOL), m_SASclientPorts(), m_VISDclientPorts(), - m_VIparentPortName(MS_TASKNAME+string("_VIparent_server")), + m_VIparentPortName(string("VIparent_server")), m_VIparentPort(*this, m_VIparentPortName, ::GCFPortInterface::MSPP, LOGICALDEVICE_PROTOCOL), m_VIclientPorts(), - m_NodeId2PortMap() + m_connectedVIclientPorts() #ifndef ACC_CONFIGURATIONMGR_UNAVAILABLE ,m_configurationManager() #endif // ACC_CONFIGURATIONMGR_UNAVAILABLE { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); + +#ifdef USE_TCPPORT_INSTEADOF_PVSSPORT + LOG_WARN("Using GCFTCPPort in stead of GCFPVSSPort"); +#endif + registerProtocol(LOGICALDEVICE_PROTOCOL, LOGICALDEVICE_PROTOCOL_signalnames); registerProtocol(STARTDAEMON_PROTOCOL, STARTDAEMON_PROTOCOL_signalnames); registerProtocol(SAS_PROTOCOL, SAS_PROTOCOL_signalnames); - LOG_DEBUG(formatString("MACScheduler(%s)::MACScheduler",getName().c_str())); m_propertySet = boost::shared_ptr<GCFMyPropertySet>(new GCFMyPropertySet( MS_PROPSET_NAME.c_str(), @@ -114,12 +120,13 @@ MACScheduler::MACScheduler() : MACScheduler::~MACScheduler() { - LOG_DEBUG(formatString("MACScheduler(%s)::~MACScheduler",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); m_propertySet->disable(); } void MACScheduler::handlePropertySetAnswer(::GCFEvent& answer) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); switch(answer.signal) { case F_MYPS_ENABLED: @@ -214,7 +221,7 @@ void MACScheduler::handlePropertySetAnswer(::GCFEvent& answer) } } -bool MACScheduler::_isServerPort(const GCFTCPPort& server, const ::GCFPortInterface& port) const +bool MACScheduler::_isServerPort(const ::GCFPortInterface& server, const ::GCFPortInterface& port) const { return (&port == &server); // comparing two pointers. yuck? } @@ -234,7 +241,7 @@ bool MACScheduler::_isSASclientPort(const ::GCFPortInterface& port) const bool MACScheduler::_isVISDclientPort(const ::GCFPortInterface& port, string& visd) const { bool found=false; - TStringTCPPortMap::const_iterator it=m_VISDclientPorts.begin(); + TStringRemotePortMap::const_iterator it=m_VISDclientPorts.begin(); while(!found && it != m_VISDclientPorts.end()) { found = (&port == it->second.get()); // comparing two pointers. yuck? @@ -250,7 +257,7 @@ bool MACScheduler::_isVISDclientPort(const ::GCFPortInterface& port, string& vis bool MACScheduler::_isVIclientPort(const ::GCFPortInterface& port) const { bool found=false; - TTCPPortVector::const_iterator it=m_VIclientPorts.begin(); + TRemotePortVector::const_iterator it=m_VIclientPorts.begin(); while(!found && it != m_VIclientPorts.end()) { found = (&port == (*it).get()); // comparing two pointers. yuck? @@ -261,6 +268,7 @@ bool MACScheduler::_isVIclientPort(const ::GCFPortInterface& port) const void MACScheduler::_disconnectedHandler(::GCFPortInterface& port) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); string visd; port.close(); if(_isServerPort(m_SASserverPort,port)) @@ -285,8 +293,7 @@ void MACScheduler::_disconnectedHandler(::GCFPortInterface& port) ::GCFEvent::TResult MACScheduler::initial_state(::GCFEvent& event, ::GCFPortInterface& /*port*/) { - LOG_DEBUG(formatString("MACScheduler(%s)::initial_state (%s)",getName().c_str(),evtstr(event))); - + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); ::GCFEvent::TResult status = ::GCFEvent::HANDLED; switch (event.signal) @@ -312,7 +319,7 @@ void MACScheduler::_disconnectedHandler(::GCFPortInterface& port) string startDaemonPortName = pParamSet->getString(MS_CONFIG_PREFIX + string(ccuName) + string(".startDaemonPort")); string startDaemonTaskName = pParamSet->getString(MS_CONFIG_PREFIX + string(ccuName) + string(".startDaemonTask")); - TTCPPortPtr startDaemonPort(new GCFTCPPort(*this,startDaemonTaskName,::GCFPortInterface::SAP,STARTDAEMON_PROTOCOL)); + TRemotePortPtr startDaemonPort(new TRemotePort(*this,startDaemonTaskName,::GCFPortInterface::SAP,STARTDAEMON_PROTOCOL)); TPeerAddr peerAddr; peerAddr.taskname = startDaemonTaskName; peerAddr.portname = startDaemonPortName; @@ -341,7 +348,7 @@ void MACScheduler::_disconnectedHandler(::GCFPortInterface& port) ::GCFEvent::TResult MACScheduler::idle_state(::GCFEvent& event, ::GCFPortInterface& port) { - LOG_DEBUG(formatString("MACScheduler(%s)::idle_state (%s)",getName().c_str(),evtstr(event))); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); ::GCFEvent::TResult status = ::GCFEvent::HANDLED; switch (event.signal) @@ -364,15 +371,15 @@ void MACScheduler::_disconnectedHandler(::GCFPortInterface& port) { if(port.getProtocol() == SAS_PROTOCOL) { - TTCPPortPtr client(new GCFTCPPort); - client->init(*this, m_SASserverPortName, GCFPortInterface::SAP, SAS_PROTOCOL); - m_SASserverPort.accept(*(client.get())); - m_SASclientPorts.push_back(client); + TTCPPortPtr server(new GCFTCPPort); + server->init(*this, m_SASserverPortName, GCFPortInterface::SPP, SAS_PROTOCOL); + m_SASserverPort.accept(*(server.get())); + m_SASclientPorts.push_back(server); } else if(port.getProtocol() == LOGICALDEVICE_PROTOCOL) { - TTCPPortPtr client(new GCFTCPPort); - client->init(*this, m_VIparentPortName, GCFPortInterface::SAP, LOGICALDEVICE_PROTOCOL); + TRemotePortPtr client(new TRemotePort); + client->init(*this, m_VIparentPortName, GCFPortInterface::SPP, LOGICALDEVICE_PROTOCOL); m_VIparentPort.accept(*(client.get())); m_VIclientPorts.push_back(client); } @@ -388,15 +395,15 @@ void MACScheduler::_disconnectedHandler(::GCFPortInterface& port) case SAS_SCHEDULE: { - string shareLocation("/home/lofar/MACTransport/mnt/"); + string shareLocation("/home/lofar/MACTransport/"); GCF::ParameterSet* pParamSet = GCF::ParameterSet::instance(); try { - string shareLocation = pParamSet->getString(MS_CONFIG_PREFIX + string("shareLocation")); + shareLocation = pParamSet->getString(MS_CONFIG_PREFIX + string("shareLocation")); } catch(Exception& e) { - LOG_WARN(formatString("Sharelocation parameter not found. Using /home/lofar/MACTransport/mnt/",e.message().c_str())); + LOG_WARN(formatString("Sharelocation parameter not found. Using %s",e.message().c_str(),shareLocation.c_str())); } // schedule event received from SAS @@ -418,7 +425,7 @@ void MACScheduler::_disconnectedHandler(::GCFPortInterface& port) // get some parameters and write it to the allocated CCU string allocatedCCU = ps->getString("allocatedCCU"); string viName = ps->getString("name"); - string psFileName = shareLocation + allocatedCCU; + string psFileName = shareLocation + string("mnt/") + allocatedCCU; ps->writeFile(psFileName); // send the schedule event to the VI-StartDaemon on the CCU @@ -427,7 +434,7 @@ void MACScheduler::_disconnectedHandler(::GCFPortInterface& port) sdScheduleEvent.taskName = viName; sdScheduleEvent.fileName = psFileName; - TStringTCPPortMap::iterator it = m_VISDclientPorts.find(allocatedCCU); + TStringRemotePortMap::iterator it = m_VISDclientPorts.find(allocatedCCU); if(it != m_VISDclientPorts.end()) { it->second->send(sdScheduleEvent); @@ -440,6 +447,18 @@ void MACScheduler::_disconnectedHandler(::GCFPortInterface& port) break; } + case LOGICALDEVICE_CONNECT: + { + LOGICALDEVICEConnectEvent connectEvent(event); + TRemotePortPtr portPtr(static_cast<TRemotePort*>(&port)); + m_connectedVIclientPorts[connectEvent.nodeId] = portPtr; + + LOGICALDEVICEConnectedEvent connectedEvent; + connectedEvent.result = LD_RESULT_NO_ERROR; + port.send(connectedEvent); + break; + } + default: LOG_DEBUG(formatString("MACScheduler(%s)::idle_state, default",getName().c_str())); status = ::GCFEvent::NOT_HANDLED; diff --git a/MAC/APL/_GSO/MACScheduler/src/MACScheduler.conf.in b/MAC/APL/_GSO/MACScheduler/src/MACScheduler.conf.in index 194a5888e961147f04ec196e490008d5e802fe61..5a9af1cf4729440690465fa232f0bd7b1207c58a 100644 --- a/MAC/APL/_GSO/MACScheduler/src/MACScheduler.conf.in +++ b/MAC/APL/_GSO/MACScheduler/src/MACScheduler.conf.in @@ -1,22 +1,22 @@ mac.ns.MACScheduler.MACScheduler_SAS_server.type=TCP mac.ns.MACScheduler.MACScheduler_VIparent_server.type=TCP -mac.ns.CCU0_VIC_VIStartDaemon_server.type=TCP -mac.ns.CCU0_VIC_VIStartDaemon_server.host=ccu0 -mac.ns.CCU1_VIC_VIStartDaemon_server.type=TCP -mac.ns.CCU1_VIC_VIStartDaemon_server.host=ccu1 +mac.ns.CCU0_StartDaemon_server.type=TCP +mac.ns.CCU0_StartDaemon_server.host=ccu0 +mac.ns.CCU1_StartDaemon_server.type=TCP +mac.ns.CCU1_StartDaemon_server.host=ccu1 -mac.top.MACScheduler.CCU0_VIC_VIStartDaemon_server.remoteservice=StartDaemon:StartDaemon_server -mac.top.MACScheduler.CCU1_VIC_VIStartDaemon_server.remoteservice=StartDaemon:StartDaemon_server +mac.top.MACScheduler.CCU0_StartDaemon_server.remoteservice=StartDaemon:StartDaemon_server +mac.top.MACScheduler.CCU1_StartDaemon_server.remoteservice=StartDaemon:StartDaemon_server #mac.apl.ams.OTDBhostname= #mac.apl.ams.OTDBdatabasename= #mac.apl.ams.OTDBpassword= -mac.apl.ams.shareLocation=/home/lofar/MACTransport/mnt/ +mac.apl.ams.shareLocation=/home/lofar/MACTransport/ mac.apl.ams.numberOfVIStartDaemons=2 -mac.apl.ams.CCU0.startDaemonPort=CCU0_VIC_VIStartDaemon_server +mac.apl.ams.CCU0.startDaemonPort=CCU0_StartDaemon_server mac.apl.ams.CCU0.startDaemonTask=StartDaemon -mac.apl.ams.CCU1.startDaemonPort=CCU1_VIC_VIStartDaemon_server +mac.apl.ams.CCU1.startDaemonPort=CCU1_StartDaemon_server mac.apl.ams.CCU1.startDaemonTask=StartDaemon mac.MACScheduler.pvss.cmdline=-proj MAC \ No newline at end of file diff --git a/MAC/APL/_GSO/MACScheduler/src/MACScheduler.h b/MAC/APL/_GSO/MACScheduler/src/MACScheduler.h index ac865203aafef2fb78c7f8aebef272701163b140..788769d0d88966c85ff6713b6f265c596f989cfe 100644 --- a/MAC/APL/_GSO/MACScheduler/src/MACScheduler.h +++ b/MAC/APL/_GSO/MACScheduler/src/MACScheduler.h @@ -41,6 +41,7 @@ //# Common Includes #include <Common/lofar_string.h> #include <Common/lofar_vector.h> +#include <Common/LofarLogger.h> //# ACC Includes #ifndef ACC_CONFIGURATIONMGR_UNAVAILABLE @@ -114,12 +115,20 @@ namespace GSO boost::shared_ptr<GCFMyPropertySet> m_propertySet; private: - typedef boost::shared_ptr<GCFTCPPort> TTCPPortPtr; - typedef vector<TTCPPortPtr> TTCPPortVector; - typedef map<string,string> TNodeId2PortMap; - typedef map<string,TTCPPortPtr> TStringTCPPortMap; + +#ifdef USE_TCPPORT_INSTEADOF_PVSSPORT + typedef GCFTCPPort TRemotePort; +#else + typedef GCFPVSSPort TRemotePort; +#endif + + typedef boost::shared_ptr<GCFTCPPort> TTCPPortPtr; + typedef boost::shared_ptr<TRemotePort> TRemotePortPtr; + typedef vector<TTCPPortPtr> TTCPPortVector; + typedef vector<TRemotePortPtr> TRemotePortVector; + typedef map<string,TRemotePortPtr> TStringRemotePortMap; - bool _isServerPort(const GCFTCPPort& server, const ::GCFPortInterface& port) const; + bool _isServerPort(const ::GCFPortInterface& server, const ::GCFPortInterface& port) const; bool _isSASclientPort(const ::GCFPortInterface& port) const; bool _isVISDclientPort(const ::GCFPortInterface& port, string& visd) const; bool _isVIclientPort(const ::GCFPortInterface& port) const; @@ -127,15 +136,25 @@ namespace GSO string m_SASserverPortName; GCFTCPPort m_SASserverPort; // SAS-MAC communication TTCPPortVector m_SASclientPorts; // connected SAS clients - TStringTCPPortMap m_VISDclientPorts; // connected VI StartDaemon clients + TStringRemotePortMap m_VISDclientPorts; // connected VI StartDaemon clients string m_VIparentPortName; - GCFTCPPort m_VIparentPort; // parent for VI's - TTCPPortVector m_VIclientPorts; // created VI's - TNodeId2PortMap m_NodeId2PortMap; // maps node ID's to port names + + TRemotePort m_VIparentPort; // parent for VI's + + // the vector and map both contain the child ports. The vector is used + // to cache the port at the moment of the accept. However, at that moment, + // the parent does not yet know the ID of that child. The child sends its + // ID in the CONNECT event and when that message is received, the port and ID + // are stored in the TPortMap. The map is used in all communication with the + // childs. + TRemotePortVector m_VIclientPorts; // created VI's + TStringRemotePortMap m_connectedVIclientPorts; // maps node ID's to ports #ifndef ACC_CONFIGURATIONMGR_UNAVAILABLE boost::shared_ptr<ACC::ConfigurationMgr> m_configurationManager; #endif // ACC_CONFIGURATIONMGR_UNAVAILABLE + + ALLOC_TRACER_CONTEXT }; };//GSO };//LOFAR diff --git a/MAC/APL/_GSO/MACScheduler/src/MACScheduler.log_prop.in b/MAC/APL/_GSO/MACScheduler/src/MACScheduler.log_prop.in index d73dda60a2985ab9fef8b69ea66f66b7712fd8ff..662e822497e4f9fd82480902bad49762b47cd60f 100644 --- a/MAC/APL/_GSO/MACScheduler/src/MACScheduler.log_prop.in +++ b/MAC/APL/_GSO/MACScheduler/src/MACScheduler.log_prop.in @@ -2,12 +2,36 @@ # log4cplus.rootLogger=INFO, STDOUT -log4cplus.additivity.ASTRON=FALSE + +log4cplus.logger.TRC=PUTJE +log4cplus.additivity.TRC=FALSE + +log4cplus.logger.MAC=DEBUG, STDOUT, FILE +log4cplus.additivity.MAC=FALSE + +log4cplus.logger.TRC.MAC=TRACE, FILE +log4cplus.additivity.TRC.MAC=FALSE + +log4cplus.appender.PUTJE=log4cplus::NullAppender log4cplus.appender.STDOUT=log4cplus::ConsoleAppender log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout -log4cplus.appender.STDOUT.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S} %-5p %c{3} - %m [%.25l]%n +log4cplus.appender.STDOUT.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S} %-5p %c{9} - %m [%.25l]%n -log4cplus.additivity.MAC=FALSE -log4cplus.logger.MAC=TRACE, STDOUT -log4cplus.logger.MAC.APL.GSO.MACScheduler=TRACE, STDOUT +log4cplus.appender.FILE=log4cplus::RollingFileAppender +log4cplus.appender.FILE.File=MACScheduler.log +log4cplus.appender.FILE.MaxFileSize=5MB +log4cplus.appender.FILE.MaxBackupIndex=5 +log4cplus.appender.FILE.layout=log4cplus::PatternLayout +log4cplus.appender.FILE.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S} %-5p %c{3} - %m [%.25l]%n + +log4cplus.appender.XMLFILE=log4cplus::RollingFileAppender +log4cplus.appender.XMLFILE.File=MACSchedulerlog.xml +log4cplus.appender.XMLFILE.MaxFileSize=5MB +log4cplus.appender.XMLFILE.MaxBackupIndex=5 +log4cplus.appender.XMLFILE.layout=log4cplus::XMLLayout + +log4cplus.appender.CHAINSAW=log4cplus::XMLSocketAppender +log4cplus.appender.CHAINSAW.host=localhost +log4cplus.appender.CHAINSAW.port=4448 +log4cplus.appender.CHAINSAW.layout=log4cplus::XMLLayout diff --git a/MAC/APL/_GSO/MACScheduler/src/MACSchedulerMain.cc b/MAC/APL/_GSO/MACScheduler/src/MACSchedulerMain.cc index 6b42c83e61a0e905442e8ffc1f153a000f30cb39..ec8f44d1c2e460aed1b31d4a959c81d23f4a2284 100644 --- a/MAC/APL/_GSO/MACScheduler/src/MACSchedulerMain.cc +++ b/MAC/APL/_GSO/MACScheduler/src/MACSchedulerMain.cc @@ -24,6 +24,8 @@ int main(int argc, char* argv[]) { + INIT_LOGGER(argv[0]); + GCFTask::init(argc, argv); LOFAR::GSO::MACScheduler ms; diff --git a/MAC/APL/_GSO/MACScheduler/src/Makefile.am b/MAC/APL/_GSO/MACScheduler/src/Makefile.am index 8b53f410a545dcee1d51a17f2459339475245763..0d4eb334f9dd9a60b57d921b825b23f1165bfffd 100644 --- a/MAC/APL/_GSO/MACScheduler/src/Makefile.am +++ b/MAC/APL/_GSO/MACScheduler/src/Makefile.am @@ -10,6 +10,7 @@ MACScheduler_CPPFLAGS= \ -Wno-deprecated \ -fmessage-length=0 \ -fdiagnostics-show-location=once \ + -DUSE_TCPPORT_INSTEADOF_PVSSPORT \ -DACC_CONFIGURATIONMGR_UNAVAILABLE MACScheduler_SOURCES = \ diff --git a/MAC/APL/_VIC/VirtualInstrument/configure.in b/MAC/APL/_VIC/VirtualInstrument/configure.in index 510781d311aa750fec2805cf769233a0d58ea494..229eeb908785c0bad2b057b7ea64a8722b20fbe6 100644 --- a/MAC/APL/_VIC/VirtualInstrument/configure.in +++ b/MAC/APL/_VIC/VirtualInstrument/configure.in @@ -51,7 +51,7 @@ dnl dnl Check for LOFAR specific things dnl lofar_DEBUG_OPTIMIZE -#lofar_QT +lofar_CHECK_PRETTY_FUNCTION lofar_QATOOLS lofar_DOCXX lofar_COMPILETOOLS diff --git a/MAC/APL/_VIC/VirtualInstrument/src/Makefile.am b/MAC/APL/_VIC/VirtualInstrument/src/Makefile.am index c4bfa6a20c3925ea4a9b68bfa03d1825c9f73795..5e78b9367b45030271c1761a669e07e378ec4f91 100644 --- a/MAC/APL/_VIC/VirtualInstrument/src/Makefile.am +++ b/MAC/APL/_VIC/VirtualInstrument/src/Makefile.am @@ -9,7 +9,8 @@ VirtualInstrument_CPPFLAGS= \ -DBOOST_DISABLE_THREADS \ -Wno-deprecated \ -fmessage-length=0 \ - -fdiagnostics-show-location=once + -fdiagnostics-show-location=once \ + -DUSE_TCPPORT_INSTEADOF_PVSSPORT VirtualInstrument_SOURCES = \ VirtualInstrument.cc \ diff --git a/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrument.cc b/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrument.cc index d420bfcd91ea5f41104c54433cdef8df8aa7bf9e..58801490a31e54882f7e5b4b6b1c0de42eb555bf 100644 --- a/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrument.cc +++ b/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrument.cc @@ -22,11 +22,15 @@ #undef PACKAGE #undef VERSION +#include <boost/shared_ptr.hpp> +#include <Common/lofar_sstream.h> #include <lofar_config.h> #include <Common/LofarLogger.h> +#include <GCF/GCF_PVString.h> +#include <APLCommon/APLUtilities.h> +#include <APLCommon/StartDaemon_Protocol.ph> #include "VirtualInstrument.h" - namespace LOFAR { using namespace ACC; @@ -34,80 +38,257 @@ namespace LOFAR namespace AVI { +INIT_TRACER_CONTEXT(VirtualInstrument,LOFARLOGGER_PACKAGE); VirtualInstrument::VirtualInstrument(const string& taskName, const string& parameterFile) : - LogicalDevice(taskName,parameterFile) + LogicalDevice(taskName,parameterFile), + m_vtSchedulerPropertySets() { - LOG_DEBUG(formatString("VirtualInstrument(%s)::VirtualInstrument",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); + + // filter the Virtual Telescopes from the parameter file: In increment 1, they + // are old style + + try + { + // 1. get childs parameter + string childs = m_parameterSet.getString("childs"); + vector<string> childsVector; + APLUtilities::string2Vector(childs,childsVector); + + vector<string>::iterator it = childsVector.begin(); + while(it != childsVector.end()) + { + // 2. if <child>.logicalDeviceType == LDTYPE_VIRTUALTELESCOPE + int ldType = m_parameterSet.getInt((*it) + ".logicalDeviceType"); + if(ldType == LDTYPE_VIRTUALTELESCOPE) + { + // 3. get <child>.oldStyle* and create that propertyset + string propsetName = m_parameterSet.getString((*it) + ".oldStyleSchedulerName"); + string propsetType = m_parameterSet.getString((*it) + ".oldStyleSchedulerType"); + + TGCFExtPropertySetPtr vtPropset(new GCFExtPropertySet(propsetName.c_str(),propsetType.c_str(),&m_propertySetAnswer)); + m_vtSchedulerPropertySets[(*it)] = vtPropset; + } + ++it; + } + } + catch(Exception& e) + { + THROW(APLCommon::ParameterNotFoundException,e.message()); + } } VirtualInstrument::~VirtualInstrument() { - LOG_DEBUG(formatString("VirtualInstrument(%s)::~VirtualInstrument",getName().c_str())); + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); +} + +void VirtualInstrument::concrete_handlePropertySetAnswer(::GCFEvent& answer) +{ + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(answer)).c_str()); + switch(answer.signal) + { + case F_SUBSCRIBED: + { + break; + } + case F_UNSUBSCRIBED: + { + break; + } + case F_VCHANGEMSG: + { + break; + } + case F_VGETRESP: + { + break; + } + case F_EXTPS_LOADED: + { + GCFPropSetAnswerEvent* pPropAnswer=static_cast<GCFPropSetAnswerEvent*>(&answer); + if(pPropAnswer->result == GCF_NO_ERROR) + { + bool scheduleSent=false; + TString2PropsetMap::iterator it=m_vtSchedulerPropertySets.begin(); + while(!scheduleSent && it!=m_vtSchedulerPropertySets.end()) + { + if(strstr(pPropAnswer->pScope, it->second->getScope().c_str()) != 0) + { + stringstream schedule; + schedule << "SCHEDULE "; + // SCHEDULE <sch.nr>,VT,<vt_name>,<bf_name>,<srg_name>,<starttime>,<stoptime>, + // <frequency>,<subbands>,<directiontype>,<angle1>,<angle2> + schedule << "1,"; + schedule << "VT,"; + schedule << it->first << ","; + + string childs = m_parameterSet.getString(it->first + string(".") + string("childs")); + vector<string> childsVector; + APLUtilities::string2Vector(childs,childsVector); + + schedule << childsVector[0] << ","; + schedule << childsVector[1] << ","; + time_t startTime = _decodeTimeParameter(m_parameterSet.getString(it->first + string(".") + string("startTime"))); + schedule << startTime << ","; + time_t stopTime = _decodeTimeParameter(m_parameterSet.getString(it->first + string(".") + string("stopTime"))); + schedule << stopTime << ","; + + schedule << m_parameterSet.getString(it->first + string(".") + string("frequency")) << ","; + schedule << m_parameterSet.getString(it->first + string(".") + string("subbands")) << ","; + schedule << m_parameterSet.getString(it->first + string(".") + string("directionType")) << ","; + schedule << m_parameterSet.getString(it->first + string(".") + string("angle1")) << ","; + schedule << m_parameterSet.getString(it->first + string(".") + string("angle2")) << ","; + + GCFPVString pvSchedule(schedule.str()); + it->second->setValue("command",pvSchedule); + scheduleSent = true; + } + ++it; + } + } + break; + } + case F_EXTPS_UNLOADED: + { + break; + } + case F_PS_CONFIGURED: + { + break; + } + case F_MYPS_ENABLED: + { + break; + } + case F_MYPS_DISABLED: + { + break; + } + case F_SERVER_GONE: + { + break; + } + default: + break; + } } -::GCFEvent::TResult VirtualInstrument::concrete_initial_state(::GCFEvent& /*e*/, ::GCFPortInterface& /*p*/, TLogicalDeviceState /*newState*/) +::GCFEvent::TResult VirtualInstrument::concrete_initial_state(::GCFEvent& event, ::GCFPortInterface& /*p*/, TLogicalDeviceState& newState) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); ::GCFEvent::TResult status = GCFEvent::HANDLED; - + newState=LOGICALDEVICE_STATE_NOSTATE; + switch (event.signal) + { + case F_ENTRY: + { + break; + } + + default: + status = GCFEvent::NOT_HANDLED; + break; + } return status; } -::GCFEvent::TResult VirtualInstrument::concrete_claiming_state(::GCFEvent& /*e*/, ::GCFPortInterface& /*p*/, TLogicalDeviceState /*newState*/) +::GCFEvent::TResult VirtualInstrument::concrete_idle_state(::GCFEvent& event, ::GCFPortInterface& /*p*/, TLogicalDeviceState& newState) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); ::GCFEvent::TResult status = GCFEvent::HANDLED; + newState=LOGICALDEVICE_STATE_NOSTATE; + switch (event.signal) + { + case F_ENTRY: + { + TString2PropsetMap::iterator it; + for(it=m_vtSchedulerPropertySets.begin();it!=m_vtSchedulerPropertySets.end();++it) + { + it->second->load(); + } + break; + } + + default: + status = GCFEvent::NOT_HANDLED; + break; + } + return status; +} + +::GCFEvent::TResult VirtualInstrument::concrete_claiming_state(::GCFEvent& event, ::GCFPortInterface& /*p*/, TLogicalDeviceState& newState) +{ + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); + ::GCFEvent::TResult status = GCFEvent::NOT_HANDLED; + newState=LOGICALDEVICE_STATE_NOSTATE; return status; } -::GCFEvent::TResult VirtualInstrument::concrete_preparing_state(::GCFEvent& /*e*/, ::GCFPortInterface& /*p*/, TLogicalDeviceState /*newState*/) +::GCFEvent::TResult VirtualInstrument::concrete_preparing_state(::GCFEvent& event, ::GCFPortInterface& /*p*/, TLogicalDeviceState& newState) { - ::GCFEvent::TResult status = GCFEvent::HANDLED; + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); + ::GCFEvent::TResult status = GCFEvent::NOT_HANDLED; + newState=LOGICALDEVICE_STATE_NOSTATE; return status; } -::GCFEvent::TResult VirtualInstrument::concrete_active_state(::GCFEvent& /*e*/, ::GCFPortInterface& /*p*/, TLogicalDeviceState /*newState*/) +::GCFEvent::TResult VirtualInstrument::concrete_active_state(::GCFEvent& event, ::GCFPortInterface& /*p*/, TLogicalDeviceState& newState) { - ::GCFEvent::TResult status = GCFEvent::HANDLED; + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); + ::GCFEvent::TResult status = GCFEvent::NOT_HANDLED; + newState=LOGICALDEVICE_STATE_NOSTATE; return status; } -::GCFEvent::TResult VirtualInstrument::concrete_releasing_state(::GCFEvent& /*e*/, ::GCFPortInterface& /*p*/, TLogicalDeviceState /*newState*/) +::GCFEvent::TResult VirtualInstrument::concrete_releasing_state(::GCFEvent& event, ::GCFPortInterface& /*p*/, TLogicalDeviceState& newState) { - ::GCFEvent::TResult status = GCFEvent::HANDLED; + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,formatString("%s - event=%s",getName().c_str(),evtstr(event)).c_str()); + ::GCFEvent::TResult status = GCFEvent::NOT_HANDLED; + newState=LOGICALDEVICE_STATE_NOSTATE; return status; } void VirtualInstrument::concreteClaim(::GCFPortInterface& /*port*/) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); + } void VirtualInstrument::concretePrepare(::GCFPortInterface& /*port*/) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); } void VirtualInstrument::concreteResume(::GCFPortInterface& /*port*/) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); } void VirtualInstrument::concreteSuspend(::GCFPortInterface& /*port*/) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); } void VirtualInstrument::concreteRelease(::GCFPortInterface& /*port*/) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); } void VirtualInstrument::concreteParentDisconnected(::GCFPortInterface& /*port*/) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); } void VirtualInstrument::concreteChildDisconnected(::GCFPortInterface& /*port*/) { + LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str()); } }; // namespace VIC diff --git a/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrument.h b/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrument.h index 1fee723cadc492b043d81ea6e8c818755ae08df5..d3d53a2acce16daeef8dc871994d9f2073e6b7dc 100644 --- a/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrument.h +++ b/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrument.h @@ -26,6 +26,7 @@ //# Includes //# GCF Includes +#include <GCF/PAL/GCF_ExtPropertySet.h> //# local includes #include <APLCommon/LogicalDevice.h> @@ -57,26 +58,31 @@ namespace AVI // protected assignment operator VirtualInstrument& operator=(const VirtualInstrument&); + virtual void concrete_handlePropertySetAnswer(::GCFEvent& answer); /** * Initial state additional behaviour must be implemented in the derived classes. */ - virtual ::GCFEvent::TResult concrete_initial_state(::GCFEvent& e, ::GCFPortInterface& p, TLogicalDeviceState newState=LOGICALDEVICE_STATE_NOSTATE); + virtual ::GCFEvent::TResult concrete_initial_state(::GCFEvent& e, ::GCFPortInterface& p, TLogicalDeviceState& newState); + /** + * Idle state additional behaviour must be implemented in the derived classes. + */ + virtual ::GCFEvent::TResult concrete_idle_state(::GCFEvent& e, ::GCFPortInterface& p, TLogicalDeviceState& newState); /** * Claiming state additional behaviour must be implemented in the derived classes. */ - virtual ::GCFEvent::TResult concrete_claiming_state(::GCFEvent& e, ::GCFPortInterface& p, TLogicalDeviceState newState=LOGICALDEVICE_STATE_NOSTATE); + virtual ::GCFEvent::TResult concrete_claiming_state(::GCFEvent& e, ::GCFPortInterface& p, TLogicalDeviceState& newState); /** * Preparing state additional behaviour must be implemented in the derived classes. */ - virtual ::GCFEvent::TResult concrete_preparing_state(::GCFEvent& e, ::GCFPortInterface& p, TLogicalDeviceState newState=LOGICALDEVICE_STATE_NOSTATE); + virtual ::GCFEvent::TResult concrete_preparing_state(::GCFEvent& e, ::GCFPortInterface& p, TLogicalDeviceState& newState); /** * active state additional behaviour must be implemented in the derived classes. */ - virtual ::GCFEvent::TResult concrete_active_state(::GCFEvent& e, ::GCFPortInterface& p, TLogicalDeviceState newState=LOGICALDEVICE_STATE_NOSTATE); + virtual ::GCFEvent::TResult concrete_active_state(::GCFEvent& e, ::GCFPortInterface& p, TLogicalDeviceState& newState); /** * Releasing state additional behaviour must be implemented in the derived classes. */ - virtual ::GCFEvent::TResult concrete_releasing_state(::GCFEvent& e, ::GCFPortInterface& p, TLogicalDeviceState newState=LOGICALDEVICE_STATE_NOSTATE); + virtual ::GCFEvent::TResult concrete_releasing_state(::GCFEvent& e, ::GCFPortInterface& p, TLogicalDeviceState& newState); /** * Implementation of the Claim method is done in the derived classes. @@ -110,6 +116,12 @@ namespace AVI protected: private: + typedef boost::shared_ptr<GCFExtPropertySet> TGCFExtPropertySetPtr; + typedef std::map<std::string,TGCFExtPropertySetPtr> TString2PropsetMap; + + TString2PropsetMap m_vtSchedulerPropertySets; + + ALLOC_TRACER_CONTEXT }; };//APLCommon };//LOFAR diff --git a/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrument.log_prop.in b/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrument.log_prop.in index 0dedcebc471c249185ae36a2a9ed68540c7ef344..d7c23fbe7ad3ca101f13338afe1c15c6c17169c2 100644 --- a/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrument.log_prop.in +++ b/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrument.log_prop.in @@ -2,12 +2,36 @@ # log4cplus.rootLogger=INFO, STDOUT -log4cplus.additivity.ASTRON=FALSE + +log4cplus.logger.TRC=PUTJE +log4cplus.additivity.TRC=FALSE + +log4cplus.logger.MAC=DEBUG, STDOUT, FILE +log4cplus.additivity.MAC=FALSE + +log4cplus.logger.TRC.MAC=TRACE, FILE +log4cplus.additivity.TRC.MAC=FALSE + +log4cplus.appender.PUTJE=log4cplus::NullAppender log4cplus.appender.STDOUT=log4cplus::ConsoleAppender log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout -log4cplus.appender.STDOUT.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S} %-5p %c{3} - %m [%.25l]%n +log4cplus.appender.STDOUT.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S} %-5p %c{9} - %m [%.25l]%n -log4cplus.additivity.MAC=FALSE -log4cplus.logger.MAC=TRACE, STDOUT -log4cplus.logger.MAC.APL.VIC.VirtualInstrument=TRACE, STDOUT +log4cplus.appender.FILE=log4cplus::RollingFileAppender +log4cplus.appender.FILE.File=VirtualInstrumentlog.log +log4cplus.appender.FILE.MaxFileSize=5MB +log4cplus.appender.FILE.MaxBackupIndex=5 +log4cplus.appender.FILE.layout=log4cplus::PatternLayout +log4cplus.appender.FILE.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S} %-5p %c{3} - %m [%.25l]%n + +log4cplus.appender.XMLFILE=log4cplus::RollingFileAppender +log4cplus.appender.XMLFILE.File=VirtualInstrumentlog.xml +log4cplus.appender.XMLFILE.MaxFileSize=5MB +log4cplus.appender.XMLFILE.MaxBackupIndex=5 +log4cplus.appender.XMLFILE.layout=log4cplus::XMLLayout + +log4cplus.appender.CHAINSAW=log4cplus::XMLSocketAppender +log4cplus.appender.CHAINSAW.host=localhost +log4cplus.appender.CHAINSAW.port=4448 +log4cplus.appender.CHAINSAW.layout=log4cplus::XMLLayout diff --git a/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrumentStartDaemonMain.cc b/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrumentStartDaemonMain.cc index 281df4d6ce517e2b54e9948a6582c96215859f6a..0a36a227dc1217f8d74ceddd210b670aa77bb141 100644 --- a/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrumentStartDaemonMain.cc +++ b/MAC/APL/_VIC/VirtualInstrument/src/VirtualInstrumentStartDaemonMain.cc @@ -31,6 +31,8 @@ using namespace AVI; // A)pplication layer V)irtual I)nstrument int main(int argc, char* argv[]) { + INIT_LOGGER(argv[0]); + GCFTask::init(argc, argv); boost::shared_ptr<VirtualInstrumentFactory> viFactory(new VirtualInstrumentFactory); diff --git a/MAC/APL/_VIC/VirtualInstrument/test/AVITestMain.cc b/MAC/APL/_VIC/VirtualInstrument/test/AVITestMain.cc index 9bcee1d0a0eba3481ab6210817b3a08bfd82b0c5..2bec694c8a033782dd4b0dcae0fc8225e060b55a 100644 --- a/MAC/APL/_VIC/VirtualInstrument/test/AVITestMain.cc +++ b/MAC/APL/_VIC/VirtualInstrument/test/AVITestMain.cc @@ -44,9 +44,11 @@ int main(int argc, char* argv[]) int retval=-1; { + INIT_LOGGER(argv[0]); + GCFTask::init(argc, argv); - LOG_INFO(formatString("Program %s has started", argv[0])); + LOG_INFO(formatString("Program %s has started", argv[0])); CCmdLine cmdLine; diff --git a/MAC/APL/_VIC/VirtualInstrument/test/avitest.log_prop.in b/MAC/APL/_VIC/VirtualInstrument/test/avitest.log_prop.in index 639058e9644bc4cad5679becf30ca2c4ec4baf33..9b48e971999d06bb81181f425dfe5d1f1b115c1c 100644 --- a/MAC/APL/_VIC/VirtualInstrument/test/avitest.log_prop.in +++ b/MAC/APL/_VIC/VirtualInstrument/test/avitest.log_prop.in @@ -2,12 +2,25 @@ # log4cplus.rootLogger=INFO, STDOUT -log4cplus.additivity.ASTRON=FALSE + +log4cplus.logger.TRC=PUTJE +log4cplus.additivity.TRC=FALSE + +log4cplus.logger.MAC=DEBUG, STDOUT, FILE +log4cplus.additivity.MAC=FALSE + +log4cplus.logger.TRC.MAC=TRACE, STDOUT, FILE +log4cplus.additivity.TRC.MAC=FALSE + +log4cplus.appender.PUTJE=log4cplus::NullAppender log4cplus.appender.STDOUT=log4cplus::ConsoleAppender log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout log4cplus.appender.STDOUT.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S} %-5p %c{3} - %m [%.25l]%n -log4cplus.additivity.MAC=FALSE -log4cplus.logger.MAC=TRACE, STDOUT -log4cplus.logger.MAC.APL.VIC.VirtualInstrument=TRACE, STDOUT \ No newline at end of file +log4cplus.appender.FILE=log4cplus::RollingFileAppender +log4cplus.appender.FILE.File=avitest.log +log4cplus.appender.FILE.MaxFileSize=5MB +log4cplus.appender.FILE.MaxBackupIndex=5 +log4cplus.appender.FILE.layout=log4cplus::PatternLayout +log4cplus.appender.FILE.layout.ConversionPattern=%D{%d-%m-%y %H:%M:%S} %-5p %c{3} - %m [%.25l]%n