This commit is contained in:
Dhanya Maliakal
2015-10-29 17:23:39 +01:00
parent 9b449009ff
commit 963717215f
6 changed files with 221 additions and 203 deletions

View File

@ -1,17 +1,18 @@
#define RED "\x1b[31m" #define RED "\x1b[31m"
#define GREEN "\x1b[32m" #define GREEN "\x1b[32m"
#define YELLOW "\x1b[33m" #define YELLOW "\x1b[33m"
#define BLUE "\x1b[34m" #define BLUE "\x1b[34m"
#define MAGENTA "\x1b[35m" #define MAGENTA "\x1b[35m"
#define CYAN "\x1b[36m" #define CYAN "\x1b[36m"
#define BG_RED "\x1b[41m" #define GRAY "\x1b[37m"
#define BG_GREEN "\x1b[42m" #define BG_RED "\x1b[41m"
#define BG_YELLOW "\x1b[43m" #define BG_GREEN "\x1b[42m"
#define BG_BLUE "\x1b[44m" #define BG_YELLOW "\x1b[43m"
#define BG_MAGENTA "\x1b[45m" #define BG_BLUE "\x1b[44m"
#define BG_CYAN "\x1b[46m" #define BG_MAGENTA "\x1b[45m"
#define RESET "\x1b[0m" #define BG_CYAN "\x1b[46m"
#define BOLD "\x1b[1m" #define RESET "\x1b[0m"
#define BOLD "\x1b[1m"
#define cprintf(code, format, ...) printf(code format RESET, ##__VA_ARGS__) #define cprintf(code, format, ...) printf(code format RESET, ##__VA_ARGS__)

View File

@ -5,6 +5,7 @@
#include <string> #include <string>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <ansi.h>
#ifdef VERBOSE #ifdef VERBOSE
#define FILELOG_MAX_LEVEL logDEBUG #define FILELOG_MAX_LEVEL logDEBUG
@ -14,6 +15,10 @@
#define FILELOG_MAX_LEVEL logDEBUG4 #define FILELOG_MAX_LEVEL logDEBUG4
#endif #endif
#ifdef FIFODEBUG
#define FILELOG_MAX_LEVEL logDEBUG5
#endif
#ifndef FILELOG_MAX_LEVEL #ifndef FILELOG_MAX_LEVEL
#define FILELOG_MAX_LEVEL logINFO #define FILELOG_MAX_LEVEL logINFO
#endif #endif
@ -40,7 +45,7 @@ void error(const char *location, const char *msg){
inline std::string NowTime(); inline std::string NowTime();
enum TLogLevel {logERROR, logWARNING, logINFO, logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4}; enum TLogLevel {logERROR, logWARNING, logINFO, logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5};
template <typename T> class Log{ template <typename T> class Log{
public: public:
@ -52,6 +57,7 @@ template <typename T> class Log{
static TLogLevel FromString(const std::string& level); static TLogLevel FromString(const std::string& level);
protected: protected:
std::ostringstream os; std::ostringstream os;
TLogLevel lev;
private: private:
Log(const Log&); Log(const Log&);
Log& operator =(const Log&); Log& operator =(const Log&);
@ -62,6 +68,7 @@ class Output2FILE {
public: public:
static FILE*& Stream(); static FILE*& Stream();
static void Output(const std::string& msg); static void Output(const std::string& msg);
static void Output(const std::string& msg, TLogLevel level);
}; };
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
@ -79,10 +86,17 @@ public:
class FILELOG_DECLSPEC FILELog : public Log<Output2FILE> {}; class FILELOG_DECLSPEC FILELog : public Log<Output2FILE> {};
//typedef Log<Output2FILE> FILELog; //typedef Log<Output2FILE> FILELog;
#ifdef REST
#define FILE_LOG(level) \ #define FILE_LOG(level) \
if (level > FILELOG_MAX_LEVEL) ; \ if (level > FILELOG_MAX_LEVEL) ; \
else if (level > FILELog::ReportingLevel() || !Output2FILE::Stream()) ; \ else if (level > FILELog::ReportingLevel() || !Output2FILE::Stream()) ; \
else FILELog().Get(level) else FILELog().Get(level)
#else
#define FILE_LOG(level) \
if (level > FILELOG_MAX_LEVEL) ; \
else if (level > FILELog::ReportingLevel() || !Output2FILE::Stream()) ; \
else FILELog().Get(level)
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
@ -126,10 +140,11 @@ inline std::string NowTime()
#endif //WIN32 #endif //WIN32
template <typename T> Log<T>::Log(){} template <typename T> Log<T>::Log():lev(logDEBUG){}
template <typename T> std::ostringstream& Log<T>::Get(TLogLevel level) template <typename T> std::ostringstream& Log<T>::Get(TLogLevel level)
{ {
lev = level;
os << "- " << NowTime(); os << "- " << NowTime();
os << " " << ToString(level) << ": "; os << " " << ToString(level) << ": ";
os << std::string(level > logDEBUG ? level - logDEBUG : 0, '\t'); os << std::string(level > logDEBUG ? level - logDEBUG : 0, '\t');
@ -139,24 +154,30 @@ template <typename T> std::ostringstream& Log<T>::Get(TLogLevel level)
template <typename T> Log<T>::~Log() template <typename T> Log<T>::~Log()
{ {
os << std::endl; os << std::endl;
#ifdef REST
T::Output( os.str()); T::Output( os.str());
#else
T::Output( os.str(),lev);
#endif
} }
template <typename T> TLogLevel& Log<T>::ReportingLevel() template <typename T> TLogLevel& Log<T>::ReportingLevel()
{ {
static TLogLevel reportingLevel = logDEBUG4; static TLogLevel reportingLevel = logDEBUG5;
return reportingLevel; return reportingLevel;
} }
template <typename T> std::string Log<T>::ToString(TLogLevel level) template <typename T> std::string Log<T>::ToString(TLogLevel level)
{ {
static const char* const buffer[] = {"ERROR", "WARNING", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4"}; static const char* const buffer[] = {"ERROR", "WARNING", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4","DEBUG5"};
return buffer[level]; return buffer[level];
} }
template <typename T> template <typename T>
TLogLevel Log<T>::FromString(const std::string& level) TLogLevel Log<T>::FromString(const std::string& level)
{ {
if (level == "DEBUG5")
return logDEBUG5;
if (level == "DEBUG4") if (level == "DEBUG4")
return logDEBUG4; return logDEBUG4;
if (level == "DEBUG3") if (level == "DEBUG3")
@ -193,6 +214,20 @@ inline void Output2FILE::Output(const std::string& msg)
fflush(pStream); fflush(pStream);
} }
inline void Output2FILE::Output(const std::string& msg, TLogLevel level)
{
FILE* pStream = Stream();
if (!pStream)
return;
switch(level){
case logERROR: cprintf(RED BOLD,"%s",msg.c_str()); break;
case logWARNING: cprintf(YELLOW BOLD,"%s",msg.c_str()); break;
case logINFO: cprintf(GRAY,"%s",msg.c_str()); break;
default: fprintf(pStream,"%s",msg.c_str()); break;
}
fflush(pStream);
}
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# if defined (BUILDING_FILELOG_DLL) # if defined (BUILDING_FILELOG_DLL)
# define FILELOG_DECLSPEC __declspec (dllexport) # define FILELOG_DECLSPEC __declspec (dllexport)

View File

@ -35,7 +35,7 @@ UDPBaseImplementation::UDPBaseImplementation(){
void UDPBaseImplementation::initializeMembers(){ void UDPBaseImplementation::initializeMembers(){
FILE_LOG(logDEBUG) << __AT__ << " starting"; FILE_LOG(logDEBUG) << __AT__ << " starting";
FILE_LOG(logDEBUG1) << "Info: Initializing base members" << endl; FILE_LOG(logDEBUG) << "Info: Initializing base members";
//**detector parameters*** //**detector parameters***
myDetectorType = GENERIC; myDetectorType = GENERIC;
strcpy(detHostname,""); strcpy(detHostname,"");
@ -202,7 +202,7 @@ void UDPBaseImplementation::setBottomEnable(const bool b){
FILE_LOG(logDEBUG) << __AT__ << " starting"; FILE_LOG(logDEBUG) << __AT__ << " starting";
bottomEnable = b; bottomEnable = b;
FILE_LOG(logINFO) << "Bottom - " << stringEnable(bottomEnable) << endl; FILE_LOG(logINFO) << "Bottom - " << stringEnable(bottomEnable);
} }
@ -216,7 +216,7 @@ void UDPBaseImplementation::setFileName(const char c[]){
} }
void UDPBaseImplementation::setFilePath(const char c[]){ void UDPBaseImplementation::setFilePath(const char c[]){
FILE_LOG(logINFO) << __AT__ << " starting"; FILE_LOG(logDEBUG) << __AT__ << " starting";
if(strlen(c)){ if(strlen(c)){
//check if filepath exists //check if filepath exists
@ -229,7 +229,7 @@ void UDPBaseImplementation::setFilePath(const char c[]){
} }
strcpy(filePath, c); strcpy(filePath, c);
} }
FILE_LOG(logDEBUG1) << "Info: File path:" << filePath; FILE_LOG(logDEBUG) << "Info: File path:" << filePath;
} }
void UDPBaseImplementation::setFileIndex(const uint64_t i){ void UDPBaseImplementation::setFileIndex(const uint64_t i){
@ -285,14 +285,14 @@ void UDPBaseImplementation::setUDPPortNumber(const uint32_t i){
FILE_LOG(logDEBUG) << __AT__ << " starting"; FILE_LOG(logDEBUG) << __AT__ << " starting";
udpPortNum[0] = i; udpPortNum[0] = i;
FILE_LOG(logINFO) << "udpPortNum[0]:" << udpPortNum[0]; FILE_LOG(logINFO) << "UDP Port Number[0]:" << udpPortNum[0];
} }
void UDPBaseImplementation::setUDPPortNumber2(const uint32_t i){ void UDPBaseImplementation::setUDPPortNumber2(const uint32_t i){
FILE_LOG(logDEBUG) << __AT__ << " starting"; FILE_LOG(logDEBUG) << __AT__ << " starting";
udpPortNum[1] = i; udpPortNum[1] = i;
FILE_LOG(logINFO) << "udpPortNum[1]:" << udpPortNum[1]; FILE_LOG(logINFO) << "UDP Port Number[1]:" << udpPortNum[1];
} }
void UDPBaseImplementation::setEthernetInterface(const char* c){ void UDPBaseImplementation::setEthernetInterface(const char* c){
@ -325,7 +325,7 @@ int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
FILE_LOG(logDEBUG) << __AT__ << " starting"; FILE_LOG(logDEBUG) << __AT__ << " starting";
acquisitionPeriod = i; acquisitionPeriod = i;
FILE_LOG(logINFO) << "Acquisition Period:" << acquisitionPeriod; FILE_LOG(logINFO) << "Acquisition Period:" << (double)acquisitionPeriod/(1E9) << "s";
//overrridden child classes might return FAIL //overrridden child classes might return FAIL
return OK; return OK;
@ -389,7 +389,7 @@ void UDPBaseImplementation::resetAcquisitionCount(){
FILE_LOG(logDEBUG) << __AT__ << " starting"; FILE_LOG(logDEBUG) << __AT__ << " starting";
totalPacketsCaught = 0; totalPacketsCaught = 0;
FILE_LOG(logINFO) << "totalPacketsCaught:" << totalPacketsCaught << endl; FILE_LOG(logINFO) << "totalPacketsCaught:" << totalPacketsCaught;
} }
int UDPBaseImplementation::startReceiver(char *c){ int UDPBaseImplementation::startReceiver(char *c){

View File

@ -23,7 +23,7 @@ using namespace std;
UDPInterface * UDPInterface::create(string receiver_type){ UDPInterface * UDPInterface::create(string receiver_type){
if (receiver_type == "standard"){ if (receiver_type == "standard"){
cout << "Starting " << receiver_type << endl; FILE_LOG(logINFO) << "Starting " << receiver_type;
return new UDPStandardImplementation(); return new UDPStandardImplementation();
} }
#ifdef REST #ifdef REST

View File

@ -42,10 +42,11 @@ UDPStandardImplementation::UDPStandardImplementation(){
pthread_mutex_init(&progressMutex,NULL); pthread_mutex_init(&progressMutex,NULL);
//to increase socket receiver buffer size and max length of input queue by changing kernel settings //to increase socket receiver buffer size and max length of input queue by changing kernel settings
if(system("echo $((100*1024*1024)) > /proc/sys/net/core/rmem_max")) if(myDetectorType == EIGER);
FILE_LOG(logDEBUG1) << "Warning: No root permission to change socket receiver buffer size in file /proc/sys/net/core/rmem_max" << endl; else if(system("echo $((100*1024*1024)) > /proc/sys/net/core/rmem_max"))
FILE_LOG(logDEBUG) << "Warning: No root permission to change socket receiver buffer size in file /proc/sys/net/core/rmem_max";
else if(system("echo 250000 > /proc/sys/net/core/netdev_max_backlog")) else if(system("echo 250000 > /proc/sys/net/core/netdev_max_backlog"))
FILE_LOG(logDEBUG1) << "Warning: No root permission to change max length of input queue in file /proc/sys/net/core/netdev_max_backlog" << endl; FILE_LOG(logDEBUG) << "Warning: No root permission to change max length of input queue in file /proc/sys/net/core/netdev_max_backlog";
/** permanent setting by heiner /** permanent setting by heiner
net.core.rmem_max = 104857600 # 100MiB net.core.rmem_max = 104857600 # 100MiB
net.core.netdev_max_backlog = 250000 net.core.netdev_max_backlog = 250000
@ -53,8 +54,7 @@ UDPStandardImplementation::UDPStandardImplementation(){
// from the manual // from the manual
sysctl -w net.core.rmem_max=16777216 sysctl -w net.core.rmem_max=16777216
sysctl -w net.core.netdev_max_backlog=250000 sysctl -w net.core.netdev_max_backlog=250000
*/ */
cout << endl;
} }
UDPStandardImplementation::~UDPStandardImplementation(){ UDPStandardImplementation::~UDPStandardImplementation(){
@ -74,7 +74,7 @@ UDPStandardImplementation::~UDPStandardImplementation(){
void UDPStandardImplementation::deleteMembers(){ void UDPStandardImplementation::deleteMembers(){
FILE_LOG(logDEBUG1) << __AT__ << " starting"; FILE_LOG(logDEBUG1) << __AT__ << " starting";
FILE_LOG(logDEBUG1) << "Info: Deleting member pointers" << endl; FILE_LOG(logDEBUG) << "Info: Deleting member pointers";
shutDownUDPSockets(); shutDownUDPSockets();
closeFile(); closeFile();
//filter //filter
@ -120,7 +120,7 @@ void UDPStandardImplementation::initializeBaseMembers(){
void UDPStandardImplementation::initializeMembers(){ void UDPStandardImplementation::initializeMembers(){
FILE_LOG(logDEBUG1) << __AT__ << " starting"; FILE_LOG(logDEBUG1) << __AT__ << " starting";
FILE_LOG(logDEBUG1) << "Info: Initializing members" << endl; FILE_LOG(logDEBUG) << "Info: Initializing members";
//***detector parameters*** //***detector parameters***
frameSize = 0; frameSize = 0;
@ -257,7 +257,7 @@ int UDPStandardImplementation::setupFifoStructure(){
//eiger always listens to 1 packet at a time //eiger always listens to 1 packet at a time
if(myDetectorType == EIGER){ if(myDetectorType == EIGER){
numberofJobsPerBuffer = 1; numberofJobsPerBuffer = 1;
FILE_LOG(logDEBUG1) << "Info: 1 packet per buffer" << endl; FILE_LOG(logDEBUG) << "Info: 1 packet per buffer";
} }
//else calculate best possible number of frames to listen to at a time (for fast readouts like gotthard) //else calculate best possible number of frames to listen to at a time (for fast readouts like gotthard)
@ -280,7 +280,7 @@ int UDPStandardImplementation::setupFifoStructure(){
numberofJobsPerBuffer = i; numberofJobsPerBuffer = i;
} }
cout << "Info: Number of Frames per buffer:" << numberofJobsPerBuffer << endl; FILE_LOG(logINFO) << "Number of Frames per buffer:" << numberofJobsPerBuffer << endl;
} }
//set fifo depth //set fifo depth
@ -299,7 +299,7 @@ int UDPStandardImplementation::setupFifoStructure(){
else else
fifoSize = fifoSize/numberofJobsPerBuffer; fifoSize = fifoSize/numberofJobsPerBuffer;
} }
FILE_LOG(logDEBUG1) << "Info: Fifo Depth:" << fifoSize << endl; FILE_LOG(logDEBUG) << "Info: Fifo Depth:" << fifoSize;
@ -315,8 +315,8 @@ int UDPStandardImplementation::setupFifoStructure(){
if(fifoFree[i]){ if(fifoFree[i]){
while(!fifoFree[i]->isEmpty()) while(!fifoFree[i]->isEmpty())
fifoFree[i]->pop(buffer[i]); fifoFree[i]->pop(buffer[i]);
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(GREEN,"Info: %d fifostructure popped from fifofree %p\n", i, (void*)(buffer[i])); cprintf(BLUE,"Info: %d fifostructure popped from fifofree %p\n", i, (void*)(buffer[i]));
#endif #endif
delete fifoFree[i]; delete fifoFree[i];
} }
@ -338,13 +338,13 @@ int UDPStandardImplementation::setupFifoStructure(){
buffer[i]=mem0[i]; buffer[i]=mem0[i];
while (buffer[i] < (mem0[i]+(bufferSize * numberofJobsPerBuffer + HEADER_SIZE_NUM_TOT_PACKETS) * (fifoSize-1))) { while (buffer[i] < (mem0[i]+(bufferSize * numberofJobsPerBuffer + HEADER_SIZE_NUM_TOT_PACKETS) * (fifoSize-1))) {
fifoFree[i]->push(buffer[i]); fifoFree[i]->push(buffer[i]);
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(BLUE,"Info: %d fifostructure free pushed into fifofree %p\n", i, (void*)(buffer[i])); cprintf(BLUE,"Info: %d fifostructure free pushed into fifofree %p\n", i, (void*)(buffer[i]));
#endif #endif
buffer[i] += (bufferSize * numberofJobsPerBuffer + HEADER_SIZE_NUM_TOT_PACKETS); buffer[i] += (bufferSize * numberofJobsPerBuffer + HEADER_SIZE_NUM_TOT_PACKETS);
} }
} }
FILE_LOG(logDEBUG1) << "Info: Fifo structure(s) reconstructed" << endl; FILE_LOG(logDEBUG) << "Info: Fifo structure(s) reconstructed";
return OK; return OK;
} }
@ -366,7 +366,7 @@ void UDPStandardImplementation::configure(map<string, string> config_map){
b = 0; b = 0;
} }
bottomEnable = b!= 0; bottomEnable = b!= 0;
cout << "Info: Bottom - " << stringEnable(bottomEnable) << endl; FILE_LOG(logINFO) << "Bottom: " << stringEnable(bottomEnable);
} }
} }
@ -410,7 +410,7 @@ int UDPStandardImplementation::setDataCompressionEnable(const bool b){
if(b) if(b)
initializeFilter(); initializeFilter();
cout << "Info: Data Compression " << stringEnable(dataCompressionEnable) << endl; FILE_LOG(logINFO) << "Data Compression: " << stringEnable(dataCompressionEnable);
return OK; return OK;
} }
@ -450,7 +450,7 @@ void UDPStandardImplementation::setShortFrameEnable(const int i){
if(dataCompressionEnable) if(dataCompressionEnable)
initializeFilter(); initializeFilter();
cout << "Info: Short Frame Enable set to " << shortFrameEnable << endl; FILE_LOG(logINFO) << "Short Frame Enable: " << shortFrameEnable;
} }
@ -461,7 +461,7 @@ int UDPStandardImplementation::setFrameToGuiFrequency(const uint32_t i){
if(setupFifoStructure() == FAIL) if(setupFifoStructure() == FAIL)
return FAIL; return FAIL;
cout << "Info: Frame to Gui Frequency set to " << FrameToGuiFrequency << endl; FILE_LOG(logINFO) << "Frame to Gui Frequency: " << FrameToGuiFrequency;
return OK; return OK;
} }
@ -474,7 +474,7 @@ int UDPStandardImplementation::setAcquisitionPeriod(const uint64_t i){
if(setupFifoStructure() == FAIL) if(setupFifoStructure() == FAIL)
return FAIL; return FAIL;
cout << "Info: Acquisition Period set to " << acquisitionPeriod << endl; FILE_LOG(logINFO) << "Acquisition Period: " << (double)acquisitionPeriod/(1E9) << "s";
return OK; return OK;
@ -485,7 +485,7 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i){
uint32_t oldDynamicRange = dynamicRange; uint32_t oldDynamicRange = dynamicRange;
cout << "Info: Setting Dynamic Range to " << i << endl; FILE_LOG(logDEBUG) << "Info: Setting Dynamic Range to " << i;
dynamicRange = i; dynamicRange = i;
if(myDetectorType == EIGER){ if(myDetectorType == EIGER){
@ -515,11 +515,11 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i){
//create threads //create threads
if(createListeningThreads() == FAIL){ if(createListeningThreads() == FAIL){
cprintf(BG_RED,"Error: Could not create listening thread\n"); FILE_LOG(logERROR) << "Could not create listening thread";
return FAIL; return FAIL;
} }
if(createWriterThreads() == FAIL){ if(createWriterThreads() == FAIL){
cprintf(BG_RED,"Error: Could not create writer threads\n"); FILE_LOG(logERROR) << "Could not create writer threads";
return FAIL; return FAIL;
} }
setThreadPriorities(); setThreadPriorities();
@ -527,7 +527,7 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i){
} }
cout << "Info: Dynamic Range set to " << dynamicRange << endl; FILE_LOG(logINFO) << "Dynamic Range: " << dynamicRange;
return OK; return OK;
} }
@ -537,7 +537,7 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i){
int UDPStandardImplementation::setTenGigaEnable(const bool b){ int UDPStandardImplementation::setTenGigaEnable(const bool b){
FILE_LOG(logDEBUG1) << __AT__ << " called"; FILE_LOG(logDEBUG1) << __AT__ << " called";
cout << "Info: Setting Ten Giga to " << stringEnable(b) << endl; FILE_LOG(logDEBUG) << "Info: Setting Ten Giga to " << stringEnable(b);
bool oldTenGigaEnable = tengigaEnable; bool oldTenGigaEnable = tengigaEnable;
tengigaEnable = b; tengigaEnable = b;
@ -557,13 +557,13 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b){
bufferSize = onePacketSize; bufferSize = onePacketSize;
maxPacketsPerFile = EIGER_MAX_FRAMES_PER_FILE * packetsPerFrame; maxPacketsPerFile = EIGER_MAX_FRAMES_PER_FILE * packetsPerFrame;
FILE_LOG(logDEBUG1) << dec << FILE_LOG(logDEBUG) << dec <<
"packetsPerFrame:" << packetsPerFrame << "packetsPerFrame:" << packetsPerFrame <<
"\nonePacketSize:" << onePacketSize << "\nonePacketSize:" << onePacketSize <<
"\noneDataSize:" << oneDataSize << "\noneDataSize:" << oneDataSize <<
"\nframesize:" << frameSize << "\nframesize:" << frameSize <<
"\nbufferSize:" << bufferSize << "\nbufferSize:" << bufferSize <<
"\nmaxPacketsPerFile:" << maxPacketsPerFile << endl; "\nmaxPacketsPerFile:" << maxPacketsPerFile;
@ -586,11 +586,11 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b){
//create threads //create threads
if(createListeningThreads() == FAIL){ if(createListeningThreads() == FAIL){
cprintf(BG_RED,"Error: Could not create listening thread\n"); FILE_LOG(logERROR) << "Could not create listening thread";
return FAIL; return FAIL;
} }
if(createWriterThreads() == FAIL){ if(createWriterThreads() == FAIL){
cprintf(BG_RED,"Error: Could not create writer threads\n"); FILE_LOG(logERROR) << "Could not create writer threads";
return FAIL; return FAIL;
} }
setThreadPriorities(); setThreadPriorities();
@ -598,7 +598,7 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b){
} }
cout << "Info: Ten Giga " << stringEnable(tengigaEnable) << endl; FILE_LOG(logINFO) << "Ten Giga: " << stringEnable(tengigaEnable);
return OK; return OK;
} }
@ -619,7 +619,7 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b){
int UDPStandardImplementation::setDetectorType(const detectorType d){ int UDPStandardImplementation::setDetectorType(const detectorType d){
FILE_LOG(logDEBUG1) << __AT__ << " called"; FILE_LOG(logDEBUG1) << __AT__ << " called";
cout << "Info: Setting receiver type ..." << endl; FILE_LOG(logDEBUG) << "Setting receiver type";
deleteMembers(); deleteMembers();
initializeBaseMembers(); initializeBaseMembers();
@ -633,10 +633,10 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
case EIGER: case EIGER:
case JUNGFRAUCTB: case JUNGFRAUCTB:
case JUNGFRAU: case JUNGFRAU:
FILE_LOG(logINFO) << " ***** This is a " << getDetectorType(d) << " Receiver *****" << endl; FILE_LOG(logINFO) << " ***** This is a " << getDetectorType(d) << " Receiver *****";
break; break;
default: default:
cprintf(BG_RED, "Error: This is an unknown receiver type %d\n", (int)d); FILE_LOG(logERROR) << "This is an unknown receiver type " << (int)d;
return FAIL; return FAIL;
} }
@ -710,7 +710,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
//footerOffset = Not applicable; //footerOffset = Not applicable;
break; break;
default: default:
cprintf(BG_RED, "Error: This is an unknown receiver type %d\n", (int)d); FILE_LOG(logERROR) << "This is an unknown receiver type " << (int)d;
return FAIL; return FAIL;
} }
@ -730,11 +730,11 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
//create threads //create threads
if(createListeningThreads() == FAIL){ if(createListeningThreads() == FAIL){
cprintf(BG_RED,"Error: Could not create listening thread\n"); FILE_LOG(logERROR) << "Could not create listening thread";
return FAIL; return FAIL;
} }
if(createWriterThreads() == FAIL){ if(createWriterThreads() == FAIL){
cprintf(BG_RED,"Error: Could not create writer threads\n"); FILE_LOG(logERROR) << "Could not create writer threads";
return FAIL; return FAIL;
} }
setThreadPriorities(); setThreadPriorities();
@ -742,8 +742,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
//allocate for latest data (frame copy for gui) //allocate for latest data (frame copy for gui)
latestData = new char[frameSize]; latestData = new char[frameSize];
cout << " Detector type set to " << getDetectorType(d) << endl; FILE_LOG(logDEBUG) << " Detector type set to " << getDetectorType(d);
cout << "Ready..." << endl;
return OK; return OK;
} }
@ -757,15 +756,14 @@ void UDPStandardImplementation::resetAcquisitionCount(){
acqStarted = false; acqStarted = false;
startAcquisitionIndex = 0; startAcquisitionIndex = 0;
cout << "Info: Acquisition Count has been reset" << endl; FILE_LOG(logINFO) << "Acquisition Count has been reset";
} }
int UDPStandardImplementation::startReceiver(char *c){ int UDPStandardImplementation::startReceiver(char *c){
FILE_LOG(logDEBUG1) << __AT__ << " called"; FILE_LOG(logDEBUG1) << __AT__ << " called";
cout << endl; FILE_LOG(logINFO) << "Starting Receiver";
cout << "Info: Starting Receiver" << endl;
//RESET //RESET
@ -804,32 +802,29 @@ int UDPStandardImplementation::startReceiver(char *c){
//Print Receiver Configuration //Print Receiver Configuration
if(myDetectorType != EIGER){ if(myDetectorType != EIGER){
FILE_LOG(logINFO) << "Data Compression has been " << stringEnable(dataCompressionEnable);
cout << "Info: Data Compression has been " << stringEnable(dataCompressionEnable) << endl; FILE_LOG(logINFO) << "Number of Jobs Per Buffer: " << numberofJobsPerBuffer;
cout << "Info: Number of Jobs Per Buffer: " << numberofJobsPerBuffer << endl; FILE_LOG(logINFO) << "Max Packets Per File:" << maxPacketsPerFile;
cout << "Info: Max Packets Per File:" << maxPacketsPerFile << endl;
} }
if(FrameToGuiFrequency) if(FrameToGuiFrequency)
cout << "Info: requency of frames sent to gui: " << FrameToGuiFrequency << endl; FILE_LOG(logINFO) << "Frequency of frames sent to gui: " << FrameToGuiFrequency;
else else
cout << "Info: Frequency of frames sent to gui: Random" << endl; FILE_LOG(logINFO) << "Frequency of frames sent to gui: Random";
//create UDP sockets //create UDP sockets
if(createUDPSockets() == FAIL){ if(createUDPSockets() == FAIL){
strcpy(c,"Could not create UDP Socket(s).\n"); strcpy(c,"Could not create UDP Socket(s).");
cout << endl; FILE_LOG(logERROR) << c;
cprintf(BG_RED, "Error: %s\n",c);
return FAIL; return FAIL;
} }
if(setupWriter() == FAIL){ if(setupWriter() == FAIL){
//stop udp socket //stop udp socket
shutDownUDPSockets(); shutDownUDPSockets();
sprintf(c,"Could not create file %s.\n",completeFileName); sprintf(c,"Could not create file %s.",completeFileName);
cout << endl; FILE_LOG(logERROR) << c;
cprintf(BG_RED, "Error: %s\n",c);
return FAIL; return FAIL;
} }
@ -854,8 +849,8 @@ int UDPStandardImplementation::startReceiver(char *c){
for(int i=0; i < numberofWriterThreads; i++) sem_post(&writerSemaphore[i]); for(int i=0; i < numberofWriterThreads; i++) sem_post(&writerSemaphore[i]);
//usleep(5000000); //usleep(5000000);
cout << "Info: Receiver Started." << endl; FILE_LOG(logINFO) << "Receiver Started";
cout << "Info: Status:" << runStatusType(status) << endl; FILE_LOG(logINFO) << "Status:" << runStatusType(status);
return OK; return OK;
} }
@ -868,7 +863,7 @@ int UDPStandardImplementation::startReceiver(char *c){
void UDPStandardImplementation::stopReceiver(){ void UDPStandardImplementation::stopReceiver(){
FILE_LOG(logDEBUG1) << __AT__ << " called"; FILE_LOG(logDEBUG1) << __AT__ << " called";
cout << "Info: Stopping Receiver" << endl; FILE_LOG(logINFO) << "Stopping Receiver";
//set status to transmitting //set status to transmitting
startReadout(); startReadout();
@ -887,8 +882,8 @@ void UDPStandardImplementation::stopReceiver(){
status = IDLE; status = IDLE;
pthread_mutex_unlock(&(statusMutex)); pthread_mutex_unlock(&(statusMutex));
cout << "Info: Receiver Stopped" << endl; FILE_LOG(logINFO) << "Receiver Stopped";
cout << "Info: Status:" << runStatusType(status) << endl; FILE_LOG(logINFO) << "Status:" << runStatusType(status);
cout << endl; cout << endl;
} }
@ -899,7 +894,7 @@ void UDPStandardImplementation::stopReceiver(){
int UDPStandardImplementation::shutDownUDPSockets(){ int UDPStandardImplementation::shutDownUDPSockets(){
FILE_LOG(logDEBUG1) << __AT__ << " called"; FILE_LOG(logDEBUG1) << __AT__ << " called";
FILE_LOG(logDEBUG1) << "Info: Shutting down UDP Socket(s)" << endl; FILE_LOG(logDEBUG) << "Info: Shutting down UDP Socket(s)";
for(int i=0;i<numberofListeningThreads;i++){ for(int i=0;i<numberofListeningThreads;i++){
if(udpSocket[i]){ if(udpSocket[i]){
@ -921,7 +916,7 @@ int UDPStandardImplementation::shutDownUDPSockets(){
void UDPStandardImplementation::startReadout(){ void UDPStandardImplementation::startReadout(){
FILE_LOG(logDEBUG1) << __AT__ << " called"; FILE_LOG(logDEBUG1) << __AT__ << " called";
cout << "Info: Transmitting last data" << endl; FILE_LOG(logDEBUG) << "Info: Transmitting last data";
if(status == RUNNING){ if(status == RUNNING){
//wait for all packets //wait for all packets
@ -936,7 +931,7 @@ void UDPStandardImplementation::startReadout(){
pthread_mutex_lock(&statusMutex); pthread_mutex_lock(&statusMutex);
status = TRANSMITTING; status = TRANSMITTING;
pthread_mutex_unlock(&statusMutex); pthread_mutex_unlock(&statusMutex);
cout << "Info: Status: Transmitting" << endl; FILE_LOG(logINFO) << "Status: Transmitting";
} }
//shut down udp sockets and make listeners push dummy (end) packets for writers //shut down udp sockets and make listeners push dummy (end) packets for writers
@ -1003,7 +998,7 @@ void UDPStandardImplementation::closeFile(int i){
if(!dataCompressionEnable){ if(!dataCompressionEnable){
if(sfilefd){ if(sfilefd){
#ifdef DEBUG4 #ifdef DEBUG4
cprintf(YELLOW, "Going to close file:%d\n",fileno(sfilefd)); FILE_LOG(logDEBUG4) << "Going to close file: " << fileno(sfilefd));
#endif #endif
fclose(sfilefd); fclose(sfilefd);
sfilefd = NULL; sfilefd = NULL;
@ -1015,7 +1010,7 @@ void UDPStandardImplementation::closeFile(int i){
#if (defined(MYROOT1) && defined(ALLFILE_DEBUG)) || !defined(MYROOT1) #if (defined(MYROOT1) && defined(ALLFILE_DEBUG)) || !defined(MYROOT1)
if(sfilefd){ if(sfilefd){
#ifdef DEBUG4 #ifdef DEBUG4
cout << "sfield:" << (int)sfilefd << endl; FILE_LOG(logDEBUG4) << "sfield: " << (int)sfilefd;
#endif #endif
fclose(sfilefd); fclose(sfilefd);
sfilefd = NULL; sfilefd = NULL;
@ -1030,12 +1025,12 @@ void UDPStandardImplementation::closeFile(int i){
if(myFile[i]->Write()) if(myFile[i]->Write())
//->Write(tall->GetName(),TObject::kOverwrite); //->Write(tall->GetName(),TObject::kOverwrite);
cout << "Info: Thread " << i <<": wrote frames to file" << endl; FILE_LOG(logINFO) << "Thread " << i <<": wrote frames to file";
else else
cout << "Info: Thread " << i << ": could not write frames to file" << endl; FILE_LOG(logINFO) << "Thread " << i << ": could not write frames to file";
}else }else
cout << "Info: Thread " << i << ": could not write frames to file: No file or No Tree" << endl; FILE_LOG(logINFO) << "Thread " << i << ": could not write frames to file: No file or No Tree";
//close file //close file
if(myTree[i] && myFile[i]) if(myTree[i] && myFile[i])
myFile[i] = myTree[i]->GetCurrentFile(); myFile[i] = myTree[i]->GetCurrentFile();
@ -1068,23 +1063,22 @@ int UDPStandardImplementation::createListeningThreads(bool destroy){
//destroy //destroy
if(destroy){ if(destroy){
FILE_LOG(logDEBUG) << "Info: Destroying Listening Thread(s)" << endl; FILE_LOG(logDEBUG) << "Info: Destroying Listening Thread(s)";
killAllListeningThreads = true; killAllListeningThreads = true;
for(int i = 0; i < numberofListeningThreads; ++i){ for(int i = 0; i < numberofListeningThreads; ++i){
sem_post(&listenSemaphore[i]); sem_post(&listenSemaphore[i]);
pthread_join(listeningThreads[i],NULL); pthread_join(listeningThreads[i],NULL);
cout <<"."<<flush; FILE_LOG(logDEBUG) << "." << flush;
} }
killAllListeningThreads = false; killAllListeningThreads = false;
threadStarted = false; threadStarted = false;
cout << endl; FILE_LOG(logDEBUG) << "Info: Listening thread(s) destroyed";
FILE_LOG(logDEBUG) << "Info: Listening thread(s) destroyed" << endl;
} }
//create //create
else{ else{
FILE_LOG(logDEBUG) << "Info: Creating Listening Thread(s)" << endl; FILE_LOG(logDEBUG) << "Info: Creating Listening Thread(s)";
//reset current index //reset current index
currentThreadIndex = -1; currentThreadIndex = -1;
@ -1094,18 +1088,13 @@ int UDPStandardImplementation::createListeningThreads(bool destroy){
threadStarted = false; threadStarted = false;
currentThreadIndex = i; currentThreadIndex = i;
if(pthread_create(&listeningThreads[i], NULL,startListeningThread, (void*) this)){ if(pthread_create(&listeningThreads[i], NULL,startListeningThread, (void*) this)){
cout << "Warning: Could not create listening thread with index " << i << endl; FILE_LOG(logERROR) << "Could not create listening thread with index " << i;
return FAIL; return FAIL;
} }
while(!threadStarted); while(!threadStarted);
cout << "."; FILE_LOG(logDEBUG) << "." << flush;
cout << flush;
} }
cout << endl; FILE_LOG(logDEBUG) << "Info: Listening thread(s) created successfully.";
#ifdef VERBOSE
FILE_LOG(logDEBUG) << "Info: Listening thread(s) created successfully." << endl;
#endif
} }
return OK; return OK;
@ -1125,23 +1114,22 @@ int UDPStandardImplementation::createWriterThreads(bool destroy){
//destroy threads //destroy threads
if(destroy){ if(destroy){
cout << "Info: Destroying Writer Thread(s)" << endl; FILE_LOG(logDEBUG) << "Info: Destroying Writer Thread(s)";
killAllWritingThreads = true; killAllWritingThreads = true;
for(int i = 0; i < numberofWriterThreads; ++i){ for(int i = 0; i < numberofWriterThreads; ++i){
sem_post(&writerSemaphore[i]); sem_post(&writerSemaphore[i]);
pthread_join(writingThreads[i],NULL); pthread_join(writingThreads[i],NULL);
cout <<"."<<flush; FILE_LOG(logDEBUG) <<"."<<flush;
} }
killAllWritingThreads = false; killAllWritingThreads = false;
threadStarted = false; threadStarted = false;
cout << endl; FILE_LOG(logDEBUG) << "Info: Writer thread(s) destroyed";
cout << "Info: Writer thread(s) destroyed" << endl;
} }
//create threads //create threads
else{ else{
cout << "Info: Creating Writer Thread(s)" << endl; FILE_LOG(logDEBUG) << "Info: Creating Writer Thread(s)";
//reset current index //reset current index
currentThreadIndex = -1; currentThreadIndex = -1;
@ -1151,16 +1139,14 @@ int UDPStandardImplementation::createWriterThreads(bool destroy){
threadStarted = false; threadStarted = false;
currentThreadIndex = i; currentThreadIndex = i;
if(pthread_create(&writingThreads[i], NULL,startWritingThread, (void*) this)){ if(pthread_create(&writingThreads[i], NULL,startWritingThread, (void*) this)){
cout << "Warning: Could not create writer thread with index " << i << endl; FILE_LOG(logERROR) << "Could not create writer thread with index " << i;
return FAIL; return FAIL;
} }
while(!threadStarted); while(!threadStarted);
cout << "."; FILE_LOG(logDEBUG) << "." << flush;
cout << flush;
} }
cout << endl;
#ifdef VERBOSE #ifdef VERBOSE
cout << "Info: Writer thread(s) created successfully." << endl; FILE_LOG(logINFO) << "\nWriter thread(s) created successfully.";
#endif #endif
} }
@ -1198,7 +1184,7 @@ void UDPStandardImplementation::setThreadPriorities(){
rights = false; rights = false;
if(!rights) if(!rights)
cout << "Warning: No root permission to prioritize threads." << endl; FILE_LOG(logWARNING) << "No root permission to prioritize threads.";
} }
@ -1226,14 +1212,14 @@ int UDPStandardImplementation::createUDPSockets(){
//if no eth, listen to all //if no eth, listen to all
if(!strlen(eth)){ if(!strlen(eth)){
cout << "Warning: eth is empty. Listening to all"<<endl; FILE_LOG(logWARNING) << "eth is empty. Listening to all";
for(int i=0;i<numberofListeningThreads;i++) for(int i=0;i<numberofListeningThreads;i++)
udpSocket[i] = new genericSocket(port[i],genericSocket::UDP,bufferSize); udpSocket[i] = new genericSocket(port[i],genericSocket::UDP,bufferSize);
} }
//normal socket //normal socket
else{ else{
cout << "Info: eth:" << eth << endl; FILE_LOG(logINFO) << "eth:" << eth << endl;
for(int i=0;i<numberofListeningThreads;i++) for(int i=0;i<numberofListeningThreads;i++)
udpSocket[i] = new genericSocket(port[i],genericSocket::UDP,bufferSize,eth); udpSocket[i] = new genericSocket(port[i],genericSocket::UDP,bufferSize,eth);
@ -1243,18 +1229,16 @@ int UDPStandardImplementation::createUDPSockets(){
for(int i=0;i<numberofListeningThreads;i++){ for(int i=0;i<numberofListeningThreads;i++){
int iret = udpSocket[i]->getErrorStatus(); int iret = udpSocket[i]->getErrorStatus();
if(!iret){ if(!iret){
cout << "Info: UDP port opened at port " << port[i] << endl; FILE_LOG(logINFO) << "UDP port opened at port " << port[i];
}else{ }else{
#ifdef VERBOSE FILE_LOG(logERROR) << "Could not create UDP socket on port " << port[i] << " error: " << iret;
cprintf(BG_RED,"Error: Could not create UDP socket on port %d error: %d\n", port[i], iret);
#endif
shutDownUDPSockets(); shutDownUDPSockets();
return FAIL; return FAIL;
} }
} }
cout << "Info: UDP socket(s) created successfully." << endl; FILE_LOG(logDEBUG) << "UDP socket(s) created successfully.";
cout << "Info: Listener Ready ..." << endl; FILE_LOG(logINFO) << "Listener Ready ...";
return OK; return OK;
} }
@ -1270,11 +1254,11 @@ int UDPStandardImplementation::setupWriter(){
cbAction=startAcquisitionCallBack(filePath,fileName,(int)fileIndex,bufferSize,pStartAcquisition); cbAction=startAcquisitionCallBack(filePath,fileName,(int)fileIndex,bufferSize,pStartAcquisition);
if(cbAction < DO_EVERYTHING){ if(cbAction < DO_EVERYTHING){
cout << "Info: Call back activated. Data saving must be taken care of by user in call back." << endl; FILE_LOG(logINFO) << "Call back activated. Data saving must be taken care of by user in call back.";
if (rawDataReadyCallBack) if (rawDataReadyCallBack)
cout << "Info: Data Write has been defined externally" << endl; FILE_LOG(logINFO) << "Data Write has been defined externally";
}else if(!fileWriteEnable) }else if(!fileWriteEnable)
cout << "Info: Data will not be saved" << endl; FILE_LOG(logINFO) << "Data will not be saved";
@ -1285,7 +1269,7 @@ int UDPStandardImplementation::setupWriter(){
pthread_mutex_unlock(&statusMutex); pthread_mutex_unlock(&statusMutex);
for(int i=0; i<numberofWriterThreads; i++){ for(int i=0; i<numberofWriterThreads; i++){
FILE_LOG(logDEBUG4) << i << " Going to post 1st semaphore" << endl; FILE_LOG(logDEBUG4) << i << " Going to post 1st semaphore";
sem_post(&writerSemaphore[i]); sem_post(&writerSemaphore[i]);
} }
//wait till its mask becomes zero(all created) //wait till its mask becomes zero(all created)
@ -1302,8 +1286,8 @@ int UDPStandardImplementation::setupWriter(){
#endif #endif
} }
cout << "Info: Successfully created file(s)" << endl; FILE_LOG(logDEBUG) << "Successfully created file(s)";
cout << "Info: Writer Ready ..." << endl; FILE_LOG(logINFO) << "Writer Ready ...";
return fileCreateSuccess; return fileCreateSuccess;
} }
@ -1326,7 +1310,7 @@ int UDPStandardImplementation::createNewFile(){
sprintf(completeFileName, "%s/%s_f%012lld_%lld.raw", filePath,fileName,(long long int)(packetsCaught/packetsPerFrame),(long long int)fileIndex); sprintf(completeFileName, "%s/%s_f%012lld_%lld.raw", filePath,fileName,(long long int)(packetsCaught/packetsPerFrame),(long long int)fileIndex);
#ifdef DEBUG4 #ifdef DEBUG4
cout << "Info: " << completefileName << endl; FILE_LOG(logINFO) << completefileName;
#endif #endif
//filewrite enable & we allowed to create/close files //filewrite enable & we allowed to create/close files
@ -1341,11 +1325,11 @@ int UDPStandardImplementation::createNewFile(){
//create file //create file
if(!overwriteEnable){ if(!overwriteEnable){
if (NULL == (sfilefd = fopen((const char *) (completeFileName), "wx"))){ if (NULL == (sfilefd = fopen((const char *) (completeFileName), "wx"))){
cprintf(BG_RED,"Error: Could not create/overwrite file %s\n",completeFileName); FILE_LOG(logERROR) << "Could not create/overwrite file" << completeFileName;
return FAIL; return FAIL;
} }
}else if (NULL == (sfilefd = fopen((const char *) (completeFileName), "w"))){ }else if (NULL == (sfilefd = fopen((const char *) (completeFileName), "w"))){
cprintf(BG_RED,"Error: Could not create file %s\n",completeFileName); FILE_LOG(logERROR) << "Could not create file" << completeFileName;
return FAIL; return FAIL;
} }
//setting file buffer size to 16mb //setting file buffer size to 16mb
@ -1354,9 +1338,9 @@ int UDPStandardImplementation::createNewFile(){
//Print packet loss and filenames //Print packet loss and filenames
if(!packetsCaught){ if(!packetsCaught){
previousFrameNumber = -1; previousFrameNumber = -1;
cout << "Info: " << completeFileName << endl; FILE_LOG(logINFO) << "File: " << completeFileName;
}else{ }else{
cout << "Info:" << completeFileName FILE_LOG(logINFO) << completeFileName
<< "\tPacket Loss: " << setw(4)<<fixed << setprecision(4) << dec << << "\tPacket Loss: " << setw(4)<<fixed << setprecision(4) << dec <<
(int)((( (currentFrameNumber-previousFrameNumber) - ((packetsInFile-numTotMissingPacketsInFile)/packetsPerFrame))/ (int)((( (currentFrameNumber-previousFrameNumber) - ((packetsInFile-numTotMissingPacketsInFile)/packetsPerFrame))/
(double)(currentFrameNumber-previousFrameNumber))*100.000) (double)(currentFrameNumber-previousFrameNumber))*100.000)
@ -1364,7 +1348,7 @@ int UDPStandardImplementation::createNewFile(){
//<< "\t\t PreviousFrameNumber: " << previousFrameNumber //<< "\t\t PreviousFrameNumber: " << previousFrameNumber
<< "\tIndex " << dec << index << "\tIndex " << dec << index
<< "\tLost " << dec << ( ((int)(currentFrameNumber-previousFrameNumber)) - << "\tLost " << dec << ( ((int)(currentFrameNumber-previousFrameNumber)) -
((packetsInFile-numTotMissingPacketsInFile)/packetsPerFrame)) << endl; ((packetsInFile-numTotMissingPacketsInFile)/packetsPerFrame));
} }
@ -1399,11 +1383,11 @@ int UDPStandardImplementation::createCompressionFile(int ithread, int iframe){
//resets the pedestalSubtraction array and the commonModeSubtraction //resets the pedestalSubtraction array and the commonModeSubtraction
singlePhotonDetectorObject[ithread]->newDataSet(); singlePhotonDetectorObject[ithread]->newDataSet();
if(myFile[ithread]==NULL){ if(myFile[ithread]==NULL){
cprintf(BG_RED,"Error: File Null\n"); FILE_LOG(logERROR) << "File Null";
return FAIL; return FAIL;
} }
if(!myFile[ithread]->IsOpen()){ if(!myFile[ithread]->IsOpen()){
cprintf(BG_RED,"Error: File Not Open\n") FILE_LOG(logERROR) << "File Not Open";
return FAIL; return FAIL;
} }
return OK; return OK;
@ -1464,13 +1448,13 @@ void UDPStandardImplementation::startListening(){
//pop from fifo //pop from fifo
fifoFree[ithread]->pop(buffer[ithread]); fifoFree[ithread]->pop(buffer[ithread]);
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(BLUE,"%d :Listener popped from fifofree %p\n", ithread, (void*)(buffer[ithread])); cprintf(BLUE,"Listening_Thread %d :Listener popped from fifofree %p\n", ithread, (void*)(buffer[ithread]));
#endif #endif
//udpsocket doesnt exist //udpsocket doesnt exist
if(udpSocket[ithread] == NULL){ if(udpSocket[ithread] == NULL){
cprintf(RED, "Error: Thread %d :UDP Socket not created\n",ithread); FILE_LOG(logERROR) << "Listening_Thread " << ithread << ": UDP Socket not created";
stopListening(ithread,0); stopListening(ithread,0);
continue; continue;
} }
@ -1501,7 +1485,7 @@ void UDPStandardImplementation::startListening(){
//push buffer to FIFO //push buffer to FIFO
while(!fifo[ithread]->push(buffer[ithread])); while(!fifo[ithread]->push(buffer[ithread]));
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(BLUE,"Listening_Thread %d: Listener pushed into fifo %p\n",ithread, (void*)(buffer[ithread])); cprintf(BLUE,"Listening_Thread %d: Listener pushed into fifo %p\n",ithread, (void*)(buffer[ithread]));
#endif #endif
@ -1512,7 +1496,7 @@ void UDPStandardImplementation::startListening(){
//check to exit thread (for change of parameters) - only EXIT possibility //check to exit thread (for change of parameters) - only EXIT possibility
if(killAllListeningThreads){ if(killAllListeningThreads){
cprintf(GREEN,"Listening_Thread %d:Goodbye!\n",ithread); cprintf(BLUE,"Listening_Thread %d:Goodbye!\n",ithread);
//free resources at exit //free resources at exit
if(tempBuffer) delete[] tempBuffer; if(tempBuffer) delete[] tempBuffer;
pthread_exit(NULL); pthread_exit(NULL);
@ -1544,7 +1528,7 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int lSize, in
} }
#ifdef DEBUG #ifdef DEBUG
cprintf(BLUE, "Listening_Thread %d : Received bytes: %d. Expected bytes: %d\n", ithread, receivedSize, expected-cSize); cprintf(BLUE, "Listening_Thread %d : Received bytes: %d. Expected bytes: %d\n", ithread, receivedSize, bufferSize * numberofJobsPerBuffer-cSize);
#endif #endif
return receivedSize; return receivedSize;
} }
@ -1577,11 +1561,11 @@ void UDPStandardImplementation::startFrameIndices(int ithread){
if(!acqStarted){ if(!acqStarted){
startAcquisitionIndex = startFrameIndex; startAcquisitionIndex = startFrameIndex;
acqStarted = true; acqStarted = true;
cprintf(BLUE,"Info: Thread %d: startAcquisitionIndex:%lld\n",ithread,(long long int)startAcquisitionIndex); cprintf(BLUE,"Listening_Thread %d: startAcquisitionIndex:%lld\n",ithread,(long long int)startAcquisitionIndex);
} }
//set start of scan/real time measurement //set start of scan/real time measurement
cprintf(BLUE,"Info: Thread %d: startFrameIndex: %lld\n", ithread,(long long int)startFrameIndex); cprintf(BLUE,"Listening_Thread %d: startFrameIndex: %lld\n", ithread,(long long int)startFrameIndex);
measurementStarted = true; measurementStarted = true;
} }
@ -1594,8 +1578,7 @@ void UDPStandardImplementation::startFrameIndices(int ithread){
void UDPStandardImplementation::stopListening(int ithread, int numbytes){ void UDPStandardImplementation::stopListening(int ithread, int numbytes){
FILE_LOG(logDEBUG1) << __AT__ << " called"; FILE_LOG(logDEBUG1) << __AT__ << " called";
cout << "Info: Thread " << ithread << ": Stop Listening.\nStatus:" << runStatusType(status) << endl; cprintf(BLUE,"Listening_Thread %d: Stop Listening.\nStatus:%s\n", ithread, runStatusType(status).c_str());
//less than 1 packet size (especially for eiger), ignore the buffer (so that 2 dummy buffers are not sent with pc=0) //less than 1 packet size (especially for eiger), ignore the buffer (so that 2 dummy buffers are not sent with pc=0)
if(numbytes < onePacketSize) if(numbytes < onePacketSize)
@ -1604,9 +1587,9 @@ void UDPStandardImplementation::stopListening(int ithread, int numbytes){
//free empty buffer //free empty buffer
if(numbytes <= 0){ if(numbytes <= 0){
cprintf(BLUE,"Info: Thread %d :End of Acquisition for Listening Thread\n", ithread); cprintf(BLUE,"Listening_Thread %d :End of Acquisition\n", ithread);
while(!fifoFree[ithread]->push(buffer[ithread])); while(!fifoFree[ithread]->push(buffer[ithread]));
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(BLUE,"Listening_Thread %d :Listener push empty buffer into fifofree %p\n", ithread, (void*)(buffer[ithread])); cprintf(BLUE,"Listening_Thread %d :Listener push empty buffer into fifofree %p\n", ithread, (void*)(buffer[ithread]));
#endif #endif
} }
@ -1621,7 +1604,7 @@ void UDPStandardImplementation::stopListening(int ithread, int numbytes){
cprintf(BLUE,"Listening_Thread %d: Last Buffer packet count:%d\n",ithread, numbytes/onePacketSize); cprintf(BLUE,"Listening_Thread %d: Last Buffer packet count:%d\n",ithread, numbytes/onePacketSize);
#endif #endif
while(!fifo[ithread]->push(buffer[ithread])); while(!fifo[ithread]->push(buffer[ithread]));
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(BLUE,"Listening_Thread %d: Listener Last Buffer pushed into fifo %p\n", ithread,(void*)(buffer[ithread])); cprintf(BLUE,"Listening_Thread %d: Listener Last Buffer pushed into fifo %p\n", ithread,(void*)(buffer[ithread]));
#endif #endif
} }
@ -1632,7 +1615,7 @@ void UDPStandardImplementation::stopListening(int ithread, int numbytes){
//creating dummy-end buffer with pc=0xFFFF //creating dummy-end buffer with pc=0xFFFF
(*((uint32_t*)(buffer[ithread]))) = dummyPacketValue; (*((uint32_t*)(buffer[ithread]))) = dummyPacketValue;
while(!fifo[ithread]->push(buffer[ithread])); while(!fifo[ithread]->push(buffer[ithread]));
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(BLUE,"Listening_Thread %d: Listener pushed dummy-end buffer into fifo %p\n", ithread,(void*)(buffer[ithread])); cprintf(BLUE,"Listening_Thread %d: Listener pushed dummy-end buffer into fifo %p\n", ithread,(void*)(buffer[ithread]));
#endif #endif
} }
@ -1797,7 +1780,7 @@ void UDPStandardImplementation::processWritingBuffer(int ithread){
while((1 << ithread) & writerThreadsMask){ while((1 << ithread) & writerThreadsMask){
//pop //pop
fifo[0]->pop(wbuf[0]); fifo[0]->pop(wbuf[0]);
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(GREEN,"Writing_Thread %d: Popped %p from FIFO %d\n", ithread, (void*)(wbuf[0]),0); cprintf(GREEN,"Writing_Thread %d: Popped %p from FIFO %d\n", ithread, (void*)(wbuf[0]),0);
#endif #endif
uint32_t numPackets = (uint32_t)(*((uint32_t*)wbuf[0])); uint32_t numPackets = (uint32_t)(*((uint32_t*)wbuf[0]));
@ -1952,7 +1935,7 @@ void UDPStandardImplementation::processWritingBufferPacketByPacket(int ithread){
//update frame number and packet number //update frame number and packet number
if(numPackets[i] != dummyPacketValue){ if(numPackets[i] != dummyPacketValue){
if(!((uint32_t)(*( (uint64_t*) packetBuffer_footer)))){ if(!((uint32_t)(*( (uint64_t*) packetBuffer_footer)))){
cprintf(BG_RED,"Fifo %d: Error: Frame Number is zero from firmware. popready[%d]:%d\n",i,i,popReady[i]); FILE_LOG(logERROR) << "Fifo "<< i << ": Frame Number is zero from firmware. popready[" << i << "]:" << popReady[i];
popReady[i]=true; popReady[i]=true;
continue; continue;
} }
@ -2090,13 +2073,13 @@ void UDPStandardImplementation::processWritingBufferPacketByPacket(int ithread){
//freeing //freeing
for(int j=0;j<toFreePointersOffset[0];++j){ for(int j=0;j<toFreePointersOffset[0];++j){
while(!fifoFree[0]->push(toFreePointers[j])); while(!fifoFree[0]->push(toFreePointers[j]));
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(GREEN,"Fifo 0: Writing_Thread freed: pushed into fifofree %p\n",ithread, (void*)(toFreePointers[j])); cprintf(GREEN,"Fifo 0: Writing_Thread freed: pushed into fifofree %p\n",ithread, (void*)(toFreePointers[j]));
#endif #endif
} }
for(int j=(packetsPerFrame/numberofListeningThreads);j<toFreePointersOffset[1];++j){ for(int j=(packetsPerFrame/numberofListeningThreads);j<toFreePointersOffset[1];++j){
while(!fifoFree[1]->push(toFreePointers[j])); while(!fifoFree[1]->push(toFreePointers[j]));
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(GREEN,"Fifo 1: Writing_Thread freed: pushed into fifofree %p\n",ithread, (void*)(toFreePointers[j])); cprintf(GREEN,"Fifo 1: Writing_Thread freed: pushed into fifofree %p\n",ithread, (void*)(toFreePointers[j]));
#endif #endif
} }
@ -2210,7 +2193,7 @@ bool UDPStandardImplementation::popAndCheckEndofAcquisition(int ithread, char* w
//pop if ready //pop if ready
if(ready[i]){ if(ready[i]){
fifo[i]->pop(wbuffer[i]); fifo[i]->pop(wbuffer[i]);
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(GREEN,"Writing_Thread %d: Popped %p from FIFO %d\n", ithread, (void*)(wbuffer[i]),i); cprintf(GREEN,"Writing_Thread %d: Popped %p from FIFO %d\n", ithread, (void*)(wbuffer[i]),i);
#endif #endif
nP[i] = (uint32_t)(*((uint32_t*)wbuffer[i])); nP[i] = (uint32_t)(*((uint32_t*)wbuffer[i]));
@ -2259,7 +2242,7 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer[]){
//free fifo //free fifo
for(int i=0; i<numberofListeningThreads; ++i){ for(int i=0; i<numberofListeningThreads; ++i){
while(!fifoFree[i]->push(wbuffer[i])); while(!fifoFree[i]->push(wbuffer[i]));
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(GREEN,"Writing_Thread %d: Freeing dummy-end buffer. Pushed into fifofree %p for listener %d\n", ithread,(void*)(wbuffer[i]),i); cprintf(GREEN,"Writing_Thread %d: Freeing dummy-end buffer. Pushed into fifofree %p for listener %d\n", ithread,(void*)(wbuffer[i]),i);
#endif #endif
} }
@ -2296,12 +2279,12 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer[]){
//statistics //statistics
cprintf(GREEN, "Status: Run Finished\n"); cprintf(GREEN, "Status: Run Finished\n");
if(!totalPacketsCaught){ if((long long int)(totalPacketsCaught/packetsPerFrame) == 0){
cprintf(RED, "Total Missing Packets padded:%d\n",numTotMissingPackets); cprintf(RED, "Total Missing Packets padded: %d\n",numTotMissingPackets);
cprintf(RED, "Total Packets Caught: 0\n"); cprintf(RED, "Total Packets Caught: %lld\n",(long long int)totalPacketsCaught);
cprintf(RED, "Total Frames Caught: 0\n"); cprintf(RED, "Total Frames Caught: 0\n");
}else{ }else{
cprintf(GREEN, "Total Missing Packets padded:%d\n",numTotMissingPackets); cprintf(GREEN, "Total Missing Packets padded: %d\n",numTotMissingPackets);
cprintf(GREEN, "Total Packets Caught:%lld\n", (long long int)totalPacketsCaught); cprintf(GREEN, "Total Packets Caught:%lld\n", (long long int)totalPacketsCaught);
cprintf(GREEN, "Total Frames Caught:%lld\n",(long long int)(totalPacketsCaught/packetsPerFrame)); cprintf(GREEN, "Total Frames Caught:%lld\n",(long long int)(totalPacketsCaught/packetsPerFrame));
} }
@ -2365,7 +2348,7 @@ void UDPStandardImplementation::handleWithoutDataCompression(int ithread, char*
//free fifo addresses (eiger frees for each packet later) //free fifo addresses (eiger frees for each packet later)
if(myDetectorType != EIGER){ if(myDetectorType != EIGER){
while(!fifoFree[0]->push(wbuffer[0])); while(!fifoFree[0]->push(wbuffer[0]));
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(GREEN,"Writing_Thread %d: Freed buffer, pushed into fifofree %p for listener 0\n",ithread, (void*)(wbuffer[0])); cprintf(GREEN,"Writing_Thread %d: Freed buffer, pushed into fifofree %p for listener 0\n",ithread, (void*)(wbuffer[0]));
#endif #endif
} }
@ -2701,7 +2684,7 @@ void UDPStandardImplementation::handleDataCompression(int ithread, char* wbuffer
while(!fifoFree[0]->push(wbuffer[0])); while(!fifoFree[0]->push(wbuffer[0]));
#ifdef FIFODEBUG #ifdef DEBUG5
cprintf(GREEN,"Writing_Thread %d: Compression free pushed into fifofree %p for listerner 0\n", ithread, (void*)(wbuffer[0])); cprintf(GREEN,"Writing_Thread %d: Compression free pushed into fifofree %p for listerner 0\n", ithread, (void*)(wbuffer[0]));
#endif #endif
} }

View File

@ -125,14 +125,14 @@ int slsReceiverTCPIPInterface::setPortNumber(int pn){
int slsReceiverTCPIPInterface::start(){ int slsReceiverTCPIPInterface::start(){
FILE_LOG(logDEBUG1) << "Creating TCP Server Thread" << endl; FILE_LOG(logDEBUG) << "Creating TCP Server Thread" << endl;
killTCPServerThread = 0; killTCPServerThread = 0;
if(pthread_create(&TCPServer_thread, NULL,startTCPServerThread, (void*) this)){ if(pthread_create(&TCPServer_thread, NULL,startTCPServerThread, (void*) this)){
cout << "Could not create TCP Server thread" << endl; cout << "Could not create TCP Server thread" << endl;
return FAIL; return FAIL;
} }
//#ifdef VERBOSE //#ifdef VERBOSE
FILE_LOG(logDEBUG1) << "TCP Server thread created successfully." << endl; FILE_LOG(logDEBUG) << "TCP Server thread created successfully." << endl;
//#endif //#endif
return OK; return OK;
} }
@ -395,25 +395,27 @@ int slsReceiverTCPIPInterface::set_detector_type(){
if(ret != FAIL){ if(ret != FAIL){
#ifndef REST #ifndef REST
receiverBase = UDPInterface::create("standard"); receiverBase = UDPInterface::create("standard");
receiverBase->setBottomEnable(bottom);
#endif #endif
myDetectorType = dr; myDetectorType = dr;
ret=receiverBase->setDetectorType(myDetectorType); ret=receiverBase->setDetectorType(myDetectorType);
retval = myDetectorType; retval = myDetectorType;
#ifndef REST
receiverBase->setBottomEnable(bottom);
#endif
} }
} }
} }
//#ifdef VERBOSE //#ifdef VERBOSE
if(ret!=FAIL) if(ret!=FAIL)
cout << "detector type " << dr << endl; FILE_LOG(logDEBUG) << "detector type " << dr;
else else
cprintf(RED, "%s\n", mess); cprintf(RED, "%s\n", mess);
//#endif //#endif
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -474,7 +476,7 @@ int slsReceiverTCPIPInterface::set_file_name() {
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -546,7 +548,7 @@ int slsReceiverTCPIPInterface::set_file_dir() {
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -612,7 +614,7 @@ int slsReceiverTCPIPInterface::set_file_index() {
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -685,7 +687,7 @@ int slsReceiverTCPIPInterface::set_frame_index() {
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -748,12 +750,12 @@ int slsReceiverTCPIPInterface::setup_udp(){
receiverBase->setUDPPortNumber2(udpport2); receiverBase->setUDPPortNumber2(udpport2);
//setup udpip //setup udpip
//get ethernet interface or IP to listen to //get ethernet interface or IP to listen to
cout << "Ethernet interface is " << args[0] << endl; FILE_LOG(logINFO) << "Receiver UDP IP: " << args[0];
temp = genericSocket::ipToName(args[0]); temp = genericSocket::ipToName(args[0]);
cout << temp << endl;
if(temp=="none"){ if(temp=="none"){
ret = FAIL; ret = FAIL;
strcpy(mess, "failed to get ethernet interface or IP to listen to\n"); strcpy(mess, "Failed to get ethernet interface or IP\n");
FILE_LOG(logERROR) << mess;
} }
else{ else{
strcpy(eth,temp.c_str()); strcpy(eth,temp.c_str());
@ -761,9 +763,7 @@ int slsReceiverTCPIPInterface::setup_udp(){
strcpy(eth,""); strcpy(eth,"");
ret = FAIL; ret = FAIL;
} }
FILE_LOG(logDEBUG) << __FILE__ << "::" << __func__ << " " << eth;
receiverBase->setEthernetInterface(eth); receiverBase->setEthernetInterface(eth);
cout << eth << endl;
//get mac address from ethernet interface //get mac address from ethernet interface
if (ret != FAIL) if (ret != FAIL)
@ -773,11 +773,10 @@ int slsReceiverTCPIPInterface::setup_udp(){
if ((temp=="00:00:00:00:00:00") || (ret == FAIL)){ if ((temp=="00:00:00:00:00:00") || (ret == FAIL)){
ret = FAIL; ret = FAIL;
strcpy(mess,"failed to get mac adddress to listen to\n"); strcpy(mess,"failed to get mac adddress to listen to\n");
cprintf(RED,"%s\n",mess);
} }
else{ else{
strcpy(retval,temp.c_str()); strcpy(retval,temp.c_str());
cout<<"mac:"<<retval<<endl; FILE_LOG(logINFO) << "Reciever MAC Address: " << retval;
} }
} }
} }
@ -785,14 +784,14 @@ int slsReceiverTCPIPInterface::setup_udp(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
// send answer // send answer
socket->SendDataOnly(&ret,sizeof(ret)); socket->SendDataOnly(&ret,sizeof(ret));
if(ret==FAIL){ if(ret==FAIL){
cprintf(RED, "%s\n", mess); FILE_LOG(logERROR) << mess;
socket->SendDataOnly(mess,sizeof(mess)); socket->SendDataOnly(mess,sizeof(mess));
} }
socket->SendDataOnly(retval,MAX_STR_LENGTH); socket->SendDataOnly(retval,MAX_STR_LENGTH);
@ -840,7 +839,7 @@ int slsReceiverTCPIPInterface::start_receiver(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -886,7 +885,7 @@ int slsReceiverTCPIPInterface::stop_receiver(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -916,7 +915,7 @@ int slsReceiverTCPIPInterface::get_status(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -946,7 +945,7 @@ int slsReceiverTCPIPInterface::get_frames_caught(){
}else retval=receiverBase->getTotalFramesCaught(); }else retval=receiverBase->getTotalFramesCaught();
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -978,7 +977,7 @@ int slsReceiverTCPIPInterface::get_frame_index(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1019,7 +1018,7 @@ int slsReceiverTCPIPInterface::reset_frames_caught(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1087,7 +1086,7 @@ int slsReceiverTCPIPInterface::set_short_frame() {
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1267,7 +1266,7 @@ int slsReceiverTCPIPInterface::moench_read_frame(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1448,7 +1447,7 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1602,7 +1601,7 @@ int slsReceiverTCPIPInterface::propix_read_frame(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1864,7 +1863,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1939,7 +1938,7 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1995,7 +1994,7 @@ int slsReceiverTCPIPInterface::enable_file_write(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2023,7 +2022,7 @@ int slsReceiverTCPIPInterface::get_id(){
#endif #endif
if(socket->differentClients){ if(socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2066,7 +2065,7 @@ int slsReceiverTCPIPInterface::start_readout(){
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2140,7 +2139,7 @@ int slsReceiverTCPIPInterface::set_timer() {
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2211,7 +2210,7 @@ int slsReceiverTCPIPInterface::enable_compression() {
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2272,7 +2271,7 @@ int slsReceiverTCPIPInterface::set_detector_hostname() {
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2364,7 +2363,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2427,7 +2426,7 @@ int slsReceiverTCPIPInterface::enable_overwrite() {
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2492,7 +2491,7 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
cout << "Force update" << endl; FILE_LOG(logDEBUG) << "Force update";
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }