This commit is contained in:
Dhanya Maliakal 2015-10-29 17:34:19 +01:00
parent 963717215f
commit 4c85a27f10
2 changed files with 23 additions and 21 deletions

View File

@ -299,7 +299,7 @@ void UDPBaseImplementation::setEthernetInterface(const char* c){
FILE_LOG(logDEBUG) << __AT__ << " starting"; FILE_LOG(logDEBUG) << __AT__ << " starting";
strcpy(eth, c); strcpy(eth, c);
FILE_LOG(logINFO) << "Ethernet Interface:" << eth; FILE_LOG(logINFO) << "Ethernet Interface: " << eth;
} }

View File

@ -763,7 +763,7 @@ void UDPStandardImplementation::resetAcquisitionCount(){
int UDPStandardImplementation::startReceiver(char *c){ int UDPStandardImplementation::startReceiver(char *c){
FILE_LOG(logDEBUG1) << __AT__ << " called"; FILE_LOG(logDEBUG1) << __AT__ << " called";
FILE_LOG(logINFO) << "Starting Receiver"; cout << "Starting Receiver" << endl;
//RESET //RESET
@ -849,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);
FILE_LOG(logINFO) << "Receiver Started"; cout << "Receiver Started" << endl;
FILE_LOG(logINFO) << "Status:" << runStatusType(status); cout << "Status:" << runStatusType(status) << endl;
return OK; return OK;
} }
@ -863,7 +863,7 @@ int UDPStandardImplementation::startReceiver(char *c){
void UDPStandardImplementation::stopReceiver(){ void UDPStandardImplementation::stopReceiver(){
FILE_LOG(logDEBUG1) << __AT__ << " called"; FILE_LOG(logDEBUG1) << __AT__ << " called";
FILE_LOG(logINFO) << "Stopping Receiver"; cout << "Stopping Receiver" << endl;
//set status to transmitting //set status to transmitting
startReadout(); startReadout();
@ -882,8 +882,8 @@ void UDPStandardImplementation::stopReceiver(){
status = IDLE; status = IDLE;
pthread_mutex_unlock(&(statusMutex)); pthread_mutex_unlock(&(statusMutex));
FILE_LOG(logINFO) << "Receiver Stopped"; cout << "Receiver Stopped" << endl;
FILE_LOG(logINFO) << "Status:" << runStatusType(status); cout << "Status:" << runStatusType(status) << endl;
cout << endl; cout << endl;
} }
@ -931,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);
FILE_LOG(logINFO) << "Status: Transmitting"; cout << "Status: Transmitting" << endl;
} }
//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
@ -1025,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);
FILE_LOG(logINFO) << "Thread " << i <<": wrote frames to file"; cout << "Thread " << i <<": wrote frames to file" << endl;
else else
FILE_LOG(logINFO) << "Thread " << i << ": could not write frames to file"; cout << "Thread " << i << ": could not write frames to file" << endl;
}else }else
FILE_LOG(logINFO) << "Thread " << i << ": could not write frames to file: No file or No Tree"; cout << "Thread " << i << ": could not write frames to file: No file or No Tree" << endl;
//close file //close file
if(myTree[i] && myFile[i]) if(myTree[i] && myFile[i])
myFile[i] = myTree[i]->GetCurrentFile(); myFile[i] = myTree[i]->GetCurrentFile();
@ -1145,8 +1145,8 @@ int UDPStandardImplementation::createWriterThreads(bool destroy){
while(!threadStarted); while(!threadStarted);
FILE_LOG(logDEBUG) << "." << flush; FILE_LOG(logDEBUG) << "." << flush;
} }
#ifdef VERBOSE #ifdef DEBUG
FILE_LOG(logINFO) << "\nWriter thread(s) created successfully."; cout << "\nWriter thread(s) created successfully" << endl;
#endif #endif
} }
@ -1219,7 +1219,7 @@ int UDPStandardImplementation::createUDPSockets(){
} }
//normal socket //normal socket
else{ else{
FILE_LOG(logINFO) << "eth:" << eth << endl; FILE_LOG(logINFO) << "Ethernet Interface:" << eth;
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);
@ -1229,7 +1229,7 @@ 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){
FILE_LOG(logINFO) << "UDP port opened at port " << port[i]; cout << "UDP port opened at port " << port[i] << endl;
}else{ }else{
FILE_LOG(logERROR) << "Could not create UDP socket on port " << port[i] << " error: " << iret; FILE_LOG(logERROR) << "Could not create UDP socket on port " << port[i] << " error: " << iret;
shutDownUDPSockets(); shutDownUDPSockets();
@ -1238,7 +1238,7 @@ int UDPStandardImplementation::createUDPSockets(){
} }
FILE_LOG(logDEBUG) << "UDP socket(s) created successfully."; FILE_LOG(logDEBUG) << "UDP socket(s) created successfully.";
FILE_LOG(logINFO) << "Listener Ready ..."; cout << "Listener Ready ..." << endl;
return OK; return OK;
} }
@ -1287,7 +1287,7 @@ int UDPStandardImplementation::setupWriter(){
} }
FILE_LOG(logDEBUG) << "Successfully created file(s)"; FILE_LOG(logDEBUG) << "Successfully created file(s)";
FILE_LOG(logINFO) << "Writer Ready ..."; cout << "Writer Ready ..." << endl;
return fileCreateSuccess; return fileCreateSuccess;
} }
@ -1338,9 +1338,9 @@ int UDPStandardImplementation::createNewFile(){
//Print packet loss and filenames //Print packet loss and filenames
if(!packetsCaught){ if(!packetsCaught){
previousFrameNumber = -1; previousFrameNumber = -1;
FILE_LOG(logINFO) << "File: " << completeFileName; cout << "File: " << completeFileName << endl;
}else{ }else{
FILE_LOG(logINFO) << completeFileName cout << 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)
@ -1348,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)); ((packetsInFile-numTotMissingPacketsInFile)/packetsPerFrame)) << endl;
} }
@ -1578,7 +1578,9 @@ 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";
cprintf(BLUE,"Listening_Thread %d: Stop Listening.\nStatus:%s\n", ithread, runStatusType(status).c_str()); #ifdef DEBUG4
cprintf(BLUE,"Listening_Thread %d: Stop Listening\nStatus:%s\n", ithread, runStatusType(status).c_str());
#endif
//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)