mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
minor cosmetics
This commit is contained in:
parent
e9343a5bd0
commit
a06f29f473
@ -67,7 +67,7 @@ DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool fwenable, bool* d
|
|||||||
}
|
}
|
||||||
|
|
||||||
NumberofDataProcessors++;
|
NumberofDataProcessors++;
|
||||||
FILE_LOG (logDEBUG) << "Number of DataProcessors: " << NumberofDataProcessors;
|
FILE_LOG(logDEBUG) << "Number of DataProcessors: " << NumberofDataProcessors;
|
||||||
|
|
||||||
memset((void*)&timerBegin, 0, sizeof(timespec));
|
memset((void*)&timerBegin, 0, sizeof(timespec));
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ DataStreamer::DataStreamer(Fifo*& f, uint32_t* dr, int* sEnable, uint64_t* fi) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
NumberofDataStreamers++;
|
NumberofDataStreamers++;
|
||||||
FILE_LOG (logDEBUG) << "Number of DataStreamers: " << NumberofDataStreamers;
|
FILE_LOG(logDEBUG) << "Number of DataStreamers: " << NumberofDataStreamers;
|
||||||
|
|
||||||
strcpy(fileNametoStream, "");
|
strcpy(fileNametoStream, "");
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ Fifo::Fifo(uint32_t fifoItemSize, uint32_t depth, bool &success):
|
|||||||
fifoDepth(depth),
|
fifoDepth(depth),
|
||||||
status_fifoBound(0),
|
status_fifoBound(0),
|
||||||
status_fifoFree(depth){
|
status_fifoFree(depth){
|
||||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
NumberofFifoClassObjects++;
|
NumberofFifoClassObjects++;
|
||||||
if(CreateFifos(fifoItemSize) == FAIL)
|
if(CreateFifos(fifoItemSize) == FAIL)
|
||||||
success = false;
|
success = false;
|
||||||
@ -31,7 +31,7 @@ Fifo::Fifo(uint32_t fifoItemSize, uint32_t depth, bool &success):
|
|||||||
|
|
||||||
|
|
||||||
Fifo::~Fifo() {
|
Fifo::~Fifo() {
|
||||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
//cprintf(BLUE,"Fifo Object %d: Goodbye\n", index);
|
//cprintf(BLUE,"Fifo Object %d: Goodbye\n", index);
|
||||||
DestroyFifos();
|
DestroyFifos();
|
||||||
NumberofFifoClassObjects--;
|
NumberofFifoClassObjects--;
|
||||||
@ -40,7 +40,7 @@ Fifo::~Fifo() {
|
|||||||
|
|
||||||
|
|
||||||
int Fifo::CreateFifos(uint32_t fifoItemSize) {
|
int Fifo::CreateFifos(uint32_t fifoItemSize) {
|
||||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
//destroy if not already
|
//destroy if not already
|
||||||
DestroyFifos();
|
DestroyFifos();
|
||||||
@ -53,11 +53,11 @@ int Fifo::CreateFifos(uint32_t fifoItemSize) {
|
|||||||
memory = (char*) calloc (fifoItemSize * fifoDepth, sizeof(char));
|
memory = (char*) calloc (fifoItemSize * fifoDepth, sizeof(char));
|
||||||
memset(memory,0,fifoItemSize * fifoDepth* sizeof(char));
|
memset(memory,0,fifoItemSize * fifoDepth* sizeof(char));
|
||||||
if (memory == NULL){
|
if (memory == NULL){
|
||||||
FILE_LOG (logERROR) << "Could not allocate memory for fifos";
|
FILE_LOG(logERROR) << "Could not allocate memory for fifos";
|
||||||
memory = 0;
|
memory = 0;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
FILE_LOG (logDEBUG) << "Memory Allocated " << index << ": " << (fifoItemSize * fifoDepth) << " bytes";
|
FILE_LOG(logDEBUG) << "Memory Allocated " << index << ": " << (fifoItemSize * fifoDepth) << " bytes";
|
||||||
|
|
||||||
{ //push free addresses into fifoFree fifo
|
{ //push free addresses into fifoFree fifo
|
||||||
char* buffer = memory;
|
char* buffer = memory;
|
||||||
@ -71,13 +71,13 @@ int Fifo::CreateFifos(uint32_t fifoItemSize) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_LOG (logDEBUG) << "Fifo Reconstructed Depth " << index << ": " << fifoDepth;
|
FILE_LOG(logDEBUG) << "Fifo Reconstructed Depth " << index << ": " << fifoDepth;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Fifo::DestroyFifos(){
|
void Fifo::DestroyFifos(){
|
||||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
|
|
||||||
if(memory) {
|
if(memory) {
|
||||||
|
@ -59,7 +59,7 @@ Listener::Listener(detectorType dtype, Fifo*& f, runStatus* s, uint32_t* portno,
|
|||||||
pthread_mutex_unlock(&Mutex);
|
pthread_mutex_unlock(&Mutex);
|
||||||
}
|
}
|
||||||
NumberofListeners++;
|
NumberofListeners++;
|
||||||
FILE_LOG (logDEBUG) << "Number of Listeners: " << NumberofListeners;
|
FILE_LOG(logDEBUG) << "Number of Listeners: " << NumberofListeners;
|
||||||
|
|
||||||
switch(myDetectorType){
|
switch(myDetectorType){
|
||||||
case JUNGFRAU:
|
case JUNGFRAU:
|
||||||
|
@ -29,7 +29,7 @@ ThreadObject::~ThreadObject() {
|
|||||||
|
|
||||||
|
|
||||||
void ThreadObject::PrintMembers() {
|
void ThreadObject::PrintMembers() {
|
||||||
FILE_LOG (logDEBUG) << "Index : " << index
|
FILE_LOG(logDEBUG) << "Index : " << index
|
||||||
<< "\nalive: " << alive
|
<< "\nalive: " << alive
|
||||||
<< "\nkillThread: " << killThread
|
<< "\nkillThread: " << killThread
|
||||||
<< "\npthread: " << thread;
|
<< "\npthread: " << thread;
|
||||||
@ -44,25 +44,25 @@ void ThreadObject::DestroyThread() {
|
|||||||
sem_destroy(&semaphore);
|
sem_destroy(&semaphore);
|
||||||
killThread = false;
|
killThread = false;
|
||||||
alive = false;
|
alive = false;
|
||||||
FILE_LOG (logDEBUG) << GetType() << " thread with index " << index << " destroyed successfully.";
|
FILE_LOG(logDEBUG) << GetType() << " thread with index " << index << " destroyed successfully.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ThreadObject::CreateThread() {
|
int ThreadObject::CreateThread() {
|
||||||
if(alive){
|
if(alive){
|
||||||
FILE_LOG (logERROR) << "Cannot create thread " << index << ". Already alive";
|
FILE_LOG(logERROR) << "Cannot create thread " << index << ". Already alive";
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
sem_init(&semaphore,1,0);
|
sem_init(&semaphore,1,0);
|
||||||
killThread = false;
|
killThread = false;
|
||||||
|
|
||||||
if(pthread_create(&thread, NULL,StartThread, (void*) this)){
|
if(pthread_create(&thread, NULL,StartThread, (void*) this)){
|
||||||
FILE_LOG (logERROR) << "Could not create " << GetType() << " thread with index " << index;
|
FILE_LOG(logERROR) << "Could not create " << GetType() << " thread with index " << index;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
alive = true;
|
alive = true;
|
||||||
FILE_LOG (logDEBUG) << GetType() << " thread " << index << " created successfully.";
|
FILE_LOG(logDEBUG) << GetType() << " thread " << index << " created successfully.";
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ int UDPStandardImplementation::setShortFrameEnable(const int i) {
|
|||||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||||
(*it)->SetGeneralData(generalData);
|
(*it)->SetGeneralData(generalData);
|
||||||
}
|
}
|
||||||
FILE_LOG (logINFO) << "Short Frame Enable: " << shortFrameEnable;
|
FILE_LOG(logINFO) << "Short Frame Enable: " << shortFrameEnable;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ int UDPStandardImplementation::setFrameToGuiFrequency(const uint32_t freq) {
|
|||||||
break;
|
break;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
FILE_LOG (logINFO) << "Frame to Gui Frequency: " << frameToGuiFrequency;
|
FILE_LOG(logINFO) << "Frame to Gui Frequency: " << frameToGuiFrequency;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
|||||||
SetThreadPriorities();
|
SetThreadPriorities();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FILE_LOG (logINFO) << "Data Send to Gui: " << dataStreamEnable;
|
FILE_LOG(logINFO) << "Data Send to Gui: " << dataStreamEnable;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i) {
|
|||||||
if (SetupFifoStructure() == FAIL)
|
if (SetupFifoStructure() == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
FILE_LOG (logINFO) << "Dynamic Range: " << dynamicRange;
|
FILE_LOG(logINFO) << "Dynamic Range: " << dynamicRange;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b) {
|
|||||||
if (SetupFifoStructure() == FAIL)
|
if (SetupFifoStructure() == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
FILE_LOG (logINFO) << "Ten Giga: " << stringEnable(tengigaEnable);
|
FILE_LOG(logINFO) << "Ten Giga: " << stringEnable(tengigaEnable);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ int UDPStandardImplementation::setFifoDepth(const uint32_t i) {
|
|||||||
if (SetupFifoStructure() == FAIL)
|
if (SetupFifoStructure() == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
FILE_LOG (logINFO) << "Fifo Depth: " << i;
|
FILE_LOG(logINFO) << "Fifo Depth: " << i;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ void UDPStandardImplementation::setSilentMode(const uint32_t i){
|
|||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||||
FILE_LOG (logDEBUG) << "Setting receiver type";
|
FILE_LOG(logDEBUG) << "Setting receiver type";
|
||||||
DeleteMembers();
|
DeleteMembers();
|
||||||
InitializeMembers();
|
InitializeMembers();
|
||||||
myDetectorType = d;
|
myDetectorType = d;
|
||||||
@ -302,10 +302,10 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
|||||||
case EIGER:
|
case EIGER:
|
||||||
case JUNGFRAUCTB:
|
case JUNGFRAUCTB:
|
||||||
case JUNGFRAU:
|
case JUNGFRAU:
|
||||||
FILE_LOG (logINFO) << " ***** " << getDetectorType(d) << " Receiver *****";
|
FILE_LOG(logINFO) << " ***** " << getDetectorType(d) << " Receiver *****";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FILE_LOG (logERROR) << "This is an unknown receiver type " << (int)d;
|
FILE_LOG(logERROR) << "This is an unknown receiver type " << (int)d;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
|||||||
//create fifo structure
|
//create fifo structure
|
||||||
numberofJobs = -1;
|
numberofJobs = -1;
|
||||||
if (SetupFifoStructure() == FAIL) {
|
if (SetupFifoStructure() == FAIL) {
|
||||||
FILE_LOG (logERROR) << "Error: Could not allocate memory for fifo structure";
|
FILE_LOG(logERROR) << "Error: Could not allocate memory for fifo structure";
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
|||||||
fileWriteEnable, &dataStreamEnable, &frameToGuiFrequency, &frameToGuiTimerinMS,
|
fileWriteEnable, &dataStreamEnable, &frameToGuiFrequency, &frameToGuiTimerinMS,
|
||||||
rawDataReadyCallBack,pRawDataReady));
|
rawDataReadyCallBack,pRawDataReady));
|
||||||
if (Listener::GetErrorMask() || DataProcessor::GetErrorMask()) {
|
if (Listener::GetErrorMask() || DataProcessor::GetErrorMask()) {
|
||||||
FILE_LOG (logERROR) << "Error: Could not creates listener/dataprocessor threads (index:" << i << ")";
|
FILE_LOG(logERROR) << "Error: Could not creates listener/dataprocessor threads (index:" << i << ")";
|
||||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||||
delete(*it);
|
delete(*it);
|
||||||
listener.clear();
|
listener.clear();
|
||||||
@ -359,7 +359,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
|||||||
|
|
||||||
SetThreadPriorities();
|
SetThreadPriorities();
|
||||||
|
|
||||||
FILE_LOG (logDEBUG) << " Detector type set to " << getDetectorType(d);
|
FILE_LOG(logDEBUG) << " Detector type set to " << getDetectorType(d);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ void UDPStandardImplementation::resetAcquisitionCount() {
|
|||||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||||
(*it)->ResetParametersforNewAcquisition();
|
(*it)->ResetParametersforNewAcquisition();
|
||||||
|
|
||||||
FILE_LOG (logINFO) << "Acquisition Count has been reset";
|
FILE_LOG(logINFO) << "Acquisition Count has been reset";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -597,19 +597,19 @@ void UDPStandardImplementation::SetLocalNetworkParameters() {
|
|||||||
//to increase Socket Receiver Buffer size
|
//to increase Socket Receiver Buffer size
|
||||||
sprintf(command,"echo $((%d)) > /proc/sys/net/core/rmem_max",RECEIVE_SOCKET_BUFFER_SIZE);
|
sprintf(command,"echo $((%d)) > /proc/sys/net/core/rmem_max",RECEIVE_SOCKET_BUFFER_SIZE);
|
||||||
if (system(command)) {
|
if (system(command)) {
|
||||||
FILE_LOG (logWARNING) << "No root privileges to change Socket Receiver Buffer size (net.core.rmem_max)";
|
FILE_LOG(logWARNING) << "No root privileges to change Socket Receiver Buffer size (net.core.rmem_max)";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FILE_LOG (logINFO) << "Socket Receiver Buffer size (/proc/sys/net/core/rmem_max) modified to " << RECEIVE_SOCKET_BUFFER_SIZE ;
|
FILE_LOG(logINFO) << "Socket Receiver Buffer size (/proc/sys/net/core/rmem_max) modified to " << RECEIVE_SOCKET_BUFFER_SIZE ;
|
||||||
|
|
||||||
|
|
||||||
// to increase Max length of input packet queue
|
// to increase Max length of input packet queue
|
||||||
sprintf(command,"echo %d > /proc/sys/net/core/netdev_max_backlog",MAX_SOCKET_INPUT_PACKET_QUEUE);
|
sprintf(command,"echo %d > /proc/sys/net/core/netdev_max_backlog",MAX_SOCKET_INPUT_PACKET_QUEUE);
|
||||||
if (system(command)) {
|
if (system(command)) {
|
||||||
FILE_LOG (logWARNING) << "No root privileges to change Max length of input packet queue (net.core.rmem_max)";
|
FILE_LOG(logWARNING) << "No root privileges to change Max length of input packet queue (net.core.rmem_max)";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FILE_LOG (logINFO) << "Max length of input packet queue (/proc/sys/net/core/netdev_max_backlog) modified to " << MAX_SOCKET_INPUT_PACKET_QUEUE ;
|
FILE_LOG(logINFO) << "Max length of input packet queue (/proc/sys/net/core/netdev_max_backlog) modified to " << MAX_SOCKET_INPUT_PACKET_QUEUE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -656,8 +656,8 @@ int UDPStandardImplementation::SetupFifoStructure() {
|
|||||||
if(dataStreamer.size())dataStreamer[i]->SetFifo(fifo[i]);
|
if(dataStreamer.size())dataStreamer[i]->SetFifo(fifo[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_LOG (logINFO) << "Memory Allocated Per Fifo: " << ( ((generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize)) * fifoDepth) << " bytes" ;
|
FILE_LOG(logINFO) << "Memory Allocated Per Fifo: " << ( ((generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize)) * fifoDepth) << " bytes" ;
|
||||||
FILE_LOG (logINFO) << " Fifo structure(s) reconstructed: " << numThreads;
|
FILE_LOG(logINFO) << " Fifo structure(s) reconstructed: " << numThreads;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user