debugging

This commit is contained in:
Dhanya Maliakal 2016-11-09 09:16:36 +01:00
parent 1a64fc30ca
commit b8ffe24c5f

View File

@ -1139,7 +1139,7 @@ void UDPStandardImplementation::startReadout(){
#endif #endif
usleep(5*1000);/* Need to find optimal time (exposure time and acquisition period) **/ usleep(5*1000*1000);/* Need to find optimal time (exposure time and acquisition period) **/
prev = totalP; prev = totalP;
totalP = 0; totalP = 0;
for(i=0; i<numberofListeningThreads; ++i) for(i=0; i<numberofListeningThreads; ++i)
@ -2124,7 +2124,7 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
return receivedSize; return receivedSize;
} }
if(status != TRANSMITTING){
if(myDetectorType == JUNGFRAU){ if(myDetectorType == JUNGFRAU){
jfrau_packet_header_t* header; jfrau_packet_header_t* header;
@ -2134,6 +2134,8 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
int currentfnum=-1; int currentfnum=-1;
//read first packet //read first packet
receivedSize=0;
if(status != TRANSMITTING)
receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + offset); receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + offset);
if(!receivedSize) return 0; if(!receivedSize) return 0;
header = (jfrau_packet_header_t*)(buffer[ithread] + offset); header = (jfrau_packet_header_t*)(buffer[ithread] + offset);
@ -2159,6 +2161,8 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
break; break;
pnum --; pnum --;
receivedSize=0;
if(status != TRANSMITTING)
receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + offset); receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + offset);
if(!receivedSize){ if(!receivedSize){
totalIgnoredPacketCount[ithread] += (packetsPerFrame - pnum); totalIgnoredPacketCount[ithread] += (packetsPerFrame - pnum);
@ -2181,6 +2185,9 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
//find the start of next image //find the start of next image
while(currentpnum != pnum){ while(currentpnum != pnum){
totalIgnoredPacketCount[ithread]++; totalIgnoredPacketCount[ithread]++;
receivedSize=0;
if(status != TRANSMITTING)
receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + offset); receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + offset);
if(!receivedSize) return 0; if(!receivedSize) return 0;
totalListeningPacketCount[ithread]++; totalListeningPacketCount[ithread]++;
@ -2198,13 +2205,13 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
//other detectors //other detectors
else{ if(status != TRANSMITTING){
receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + fifoBufferHeaderSize + cSize, (bufferSize * numberofJobsPerBuffer) - cSize); receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + fifoBufferHeaderSize + cSize, (bufferSize * numberofJobsPerBuffer) - cSize);
//eiger returns 0 when header packet caught //eiger returns 0 when header packet caught
while(receivedSize < onePacketSize && status != TRANSMITTING) while(receivedSize < onePacketSize && status != TRANSMITTING)
receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + fifoBufferHeaderSize + cSize, (bufferSize * numberofJobsPerBuffer) - cSize); receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + fifoBufferHeaderSize + cSize, (bufferSize * numberofJobsPerBuffer) - cSize);
}
} }
totalListeningPacketCount[ithread] += (receivedSize/onePacketSize); totalListeningPacketCount[ithread] += (receivedSize/onePacketSize);
@ -2741,12 +2748,11 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer){
//Print packet loss //Print packet loss
if(totalWritingPacketCountFromLastCheck[ithread]){ if(totalWritingPacketCountFromLastCheck[ithread]){
printf("\nThread:%d" thread/****/
"\t\tPackets Lost:%d" printf("\nPackets Lost:%d"
"\tPacketsFromLastCheck:%lld" "\tPacketsFromLastCheck:%lld"
"\tCurrentFrameNumber:%lld" "\tCurrentFrameNumber:%lld"
"\tPreviousFrameNumber:%lld\n", "\tPreviousFrameNumber:%lld\n",
ithread,
( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousCheck[ithread])*packetsPerFrame) - totalWritingPacketCountFromLastCheck[ithread]), ( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousCheck[ithread])*packetsPerFrame) - totalWritingPacketCountFromLastCheck[ithread]),
totalWritingPacketCountFromLastCheck[ithread], totalWritingPacketCountFromLastCheck[ithread],
currentFrameNumber[ithread], currentFrameNumber[ithread],
@ -2910,7 +2916,7 @@ void UDPStandardImplementation::handleWithoutMissingPackets(int ithread, char* w
//Print packet loss and filenames //Print packet loss and filenames
if(tempframenumber && (tempframenumber%(maxFramesPerFile/10)) == 0){ if(tempframenumber && (tempframenumber%(maxFramesPerFile/10)) == 0){
printf("\nTThread:%d" cprintf(BLUE,"\nThread:%d"
"\t\tPackets Lost:%d" "\t\tPackets Lost:%d"
"\tPacketsFromLastCheck:%lld" "\tPacketsFromLastCheck:%lld"
"\tCurrentFrameNumber:%lld" "\tCurrentFrameNumber:%lld"