From 5f4a38416a4eceba86e7c418ef64f9625b88aedf Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Tue, 8 Nov 2016 16:31:05 +0100 Subject: [PATCH] added the print temp losses --- .../src/UDPStandardImplementation.cpp | 57 +++++++++---------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/slsReceiverSoftware/src/UDPStandardImplementation.cpp b/slsReceiverSoftware/src/UDPStandardImplementation.cpp index 3e5f4c33a..354811d4b 100644 --- a/slsReceiverSoftware/src/UDPStandardImplementation.cpp +++ b/slsReceiverSoftware/src/UDPStandardImplementation.cpp @@ -1604,9 +1604,10 @@ int UDPStandardImplementation::createNewFile(int ithread){ if(totalWritingPacketCount[ithread]){ frameNumberInPreviousFile[ithread] = currentFrameNumber[ithread]; totalPacketsInFile[ithread] = 0; - }else + }else{ frameNumberInPreviousFile[ithread] = -1; - + frameNumberInPreviousCheck[ithread] = -1; + } @@ -2905,6 +2906,30 @@ void UDPStandardImplementation::handleWithoutMissingPackets(int ithread, char* w fwrite(wbuffer + HEADER_SIZE_NUM_TOT_PACKETS, 1, oneDataSize*packetsPerFrame+fifoBufferHeaderSize-HEADER_SIZE_NUM_TOT_PACKETS, sfilefd[ithread]); } + + + //Print packet loss and filenames + if( (currentFrameNumber[ithread]%(maxFramesPerFile/10)) == 0){ + printf("\nThread:%d" + "\t\tPackets Lost:%d" + "\tPacketsFromLastCheck:%lld" + "\tCurrentFrameNumber:%lld" + "\tPreviousFrameNumber:%lld\n", + ithread, + ( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousCheck[ithread])*packetsPerFrame) - totalWritingPacketCountFromLastCheck[ithread]), + totalWritingPacketCountFromLastCheck[ithread], + currentFrameNumber[ithread], + frameNumberInPreviousCheck[ithread] + ); + + //reset counters for each new file + frameNumberInPreviousCheck[ithread] = currentFrameNumber[ithread]; + totalWritingPacketCountFromLastCheck[ithread] = 0; + } + + + if(npackets!=128) exit(-1);/******************/ + totalWritingPacketCountFromLastCheck[ithread]+= npackets; totalPacketsInFile[ithread] += npackets; totalWritingPacketCount[ithread] += npackets; lastFrameNumberInFile[ithread] = tempframenumber; @@ -2923,34 +2948,6 @@ void UDPStandardImplementation::handleWithoutMissingPackets(int ithread, char* w if(numberofWriterThreads > 1) pthread_mutex_unlock(&writeMutex); - - //Print packet loss and filenames - if(totalWritingPacketCountFromLastCheck[ithread] && (currentFrameNumber[ithread]%(maxFramesPerFile/10)) == 0){ - printf("\nThread:%d" - "\t\tPackets Lost:%d" - "\tPacketsFromLastCheck:%lld" - "\tCurrentFrameNumber:%lld" - "\tPreviousFrameNumber:%lld\n", - ithread, - ( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousCheck[ithread])*packetsPerFrame) - totalWritingPacketCountFromLastCheck[ithread]), - totalWritingPacketCountFromLastCheck[ithread], - currentFrameNumber[ithread], - frameNumberInPreviousCheck[ithread] - ); - - //reset counters for each new file - if(totalWritingPacketCountFromLastCheck[ithread]){ - frameNumberInPreviousCheck[ithread] = currentFrameNumber[ithread]; - totalWritingPacketCountFromLastCheck[ithread] = 0; - }else - frameNumberInPreviousCheck[ithread] = -1; - } - - if(npackets!=128) exit(-1);/******************/ - totalWritingPacketCountFromLastCheck[ithread]+= npackets; - - - } #ifdef DEBUG4 cprintf(GREEN,"Writing_Thread: Writing done\nGoing to copy frame\n");