added the print temp losses

This commit is contained in:
Dhanya Maliakal 2016-11-08 16:03:44 +01:00
parent 7b2be5b009
commit 9b9876e287
2 changed files with 48 additions and 14 deletions

View File

@ -624,7 +624,10 @@ private:
/** Previous Frame number from buffer to calculate loss */
int64_t frameNumberInPreviousFile[MAX_NUMBER_OF_WRITER_THREADS];
/** Previous Frame number from last check to calculate loss */
int64_t frameNumberInPreviousCheck[MAX_NUMBER_OF_WRITER_THREADS];
/** total packet count from last check */
int64_t totalWritingPacketCountFromLastCheck[MAX_NUMBER_OF_WRITER_THREADS];
/* Acquisition started */

View File

@ -167,9 +167,11 @@ void UDPStandardImplementation::initializeMembers(){
frameIndex[i] = 0;
currentFrameNumber[i] = 0;
frameNumberInPreviousFile[i] = 0;
frameNumberInPreviousCheck[i] = 0;
lastFrameNumberInFile[i] = -1;
totalPacketsInFile[i] = 0;
totalWritingPacketCount[i] = 0;
totalWritingPacketCountFromLastCheck[i] = 0;
}
@ -947,6 +949,7 @@ int UDPStandardImplementation::startReceiver(char *c){
lastFrameNumberInFile[i] = -1;
totalPacketsInFile[i] = 0;
totalWritingPacketCount[i] = 0;
totalWritingPacketCountFromLastCheck[i] = 0;
if(sfilefd[i]){
fclose(sfilefd[i]);
sfilefd[i] = 0;
@ -1582,11 +1585,7 @@ int UDPStandardImplementation::createNewFile(int ithread){
setvbuf(sfilefd[ithread],NULL,_IOFBF,BUF_SIZE);
//Print packet loss and filenames
if(!totalWritingPacketCount[ithread]){
frameNumberInPreviousFile[ithread] = -1;
//printf("Thread:%d File:%s\n",ithread,completeFileName[ithread]);
}else{
if(totalWritingPacketCount[ithread]){
printf("\nThread:%d File:%s\n"
"Packets Lost:%d"
"\t\tPacketsInFile:%lld\tCurrentFrameNumber:%lld\tPreviousFrameNumber:%lld\n",
@ -1610,6 +1609,7 @@ int UDPStandardImplementation::createNewFile(int ithread){
return OK;
}
@ -2738,15 +2738,21 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer){
fwrite((void*)fileHeader[ithread], 1, FILE_HEADER_SIZE, sfilefd[ithread]);
}
if(totalWritingPacketCount[ithread]){
printf("\nThread:%d File:%s\n"
"Packets Lost:%d"
"\t\tPacketsInFile:%lld\tCurrentFrameNumber:%lld\tPreviousFrameNumber:%lld\n",
ithread,completeFileName[ithread],
( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousFile[ithread])*packetsPerFrame) - totalPacketsInFile[ithread]),
totalPacketsInFile[ithread],currentFrameNumber[ithread],frameNumberInPreviousFile[ithread]
);
//Print packet loss
if(totalWritingPacketCountFromLastCheck[ithread]){
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]
);
}
closeFile(ithread);
pthread_mutex_lock(&statusMutex);
writerThreadsMask^=(1<<ithread);
@ -2918,6 +2924,31 @@ 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;
}
#ifdef DEBUG4
cprintf(GREEN,"Writing_Thread: Writing done\nGoing to copy frame\n");