mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
added the print temp losses
This commit is contained in:
@ -624,7 +624,10 @@ private:
|
|||||||
/** Previous Frame number from buffer to calculate loss */
|
/** Previous Frame number from buffer to calculate loss */
|
||||||
int64_t frameNumberInPreviousFile[MAX_NUMBER_OF_WRITER_THREADS];
|
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 */
|
/* Acquisition started */
|
||||||
|
@ -167,9 +167,11 @@ void UDPStandardImplementation::initializeMembers(){
|
|||||||
frameIndex[i] = 0;
|
frameIndex[i] = 0;
|
||||||
currentFrameNumber[i] = 0;
|
currentFrameNumber[i] = 0;
|
||||||
frameNumberInPreviousFile[i] = 0;
|
frameNumberInPreviousFile[i] = 0;
|
||||||
|
frameNumberInPreviousCheck[i] = 0;
|
||||||
lastFrameNumberInFile[i] = -1;
|
lastFrameNumberInFile[i] = -1;
|
||||||
totalPacketsInFile[i] = 0;
|
totalPacketsInFile[i] = 0;
|
||||||
totalWritingPacketCount[i] = 0;
|
totalWritingPacketCount[i] = 0;
|
||||||
|
totalWritingPacketCountFromLastCheck[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -947,6 +949,7 @@ int UDPStandardImplementation::startReceiver(char *c){
|
|||||||
lastFrameNumberInFile[i] = -1;
|
lastFrameNumberInFile[i] = -1;
|
||||||
totalPacketsInFile[i] = 0;
|
totalPacketsInFile[i] = 0;
|
||||||
totalWritingPacketCount[i] = 0;
|
totalWritingPacketCount[i] = 0;
|
||||||
|
totalWritingPacketCountFromLastCheck[i] = 0;
|
||||||
if(sfilefd[i]){
|
if(sfilefd[i]){
|
||||||
fclose(sfilefd[i]);
|
fclose(sfilefd[i]);
|
||||||
sfilefd[i] = 0;
|
sfilefd[i] = 0;
|
||||||
@ -1582,11 +1585,7 @@ int UDPStandardImplementation::createNewFile(int ithread){
|
|||||||
setvbuf(sfilefd[ithread],NULL,_IOFBF,BUF_SIZE);
|
setvbuf(sfilefd[ithread],NULL,_IOFBF,BUF_SIZE);
|
||||||
|
|
||||||
//Print packet loss and filenames
|
//Print packet loss and filenames
|
||||||
if(!totalWritingPacketCount[ithread]){
|
if(totalWritingPacketCount[ithread]){
|
||||||
frameNumberInPreviousFile[ithread] = -1;
|
|
||||||
//printf("Thread:%d File:%s\n",ithread,completeFileName[ithread]);
|
|
||||||
}else{
|
|
||||||
|
|
||||||
printf("\nThread:%d File:%s\n"
|
printf("\nThread:%d File:%s\n"
|
||||||
"Packets Lost:%d"
|
"Packets Lost:%d"
|
||||||
"\t\tPacketsInFile:%lld\tCurrentFrameNumber:%lld\tPreviousFrameNumber:%lld\n",
|
"\t\tPacketsInFile:%lld\tCurrentFrameNumber:%lld\tPreviousFrameNumber:%lld\n",
|
||||||
@ -1610,6 +1609,7 @@ int UDPStandardImplementation::createNewFile(int ithread){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2738,15 +2738,21 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer){
|
|||||||
fwrite((void*)fileHeader[ithread], 1, FILE_HEADER_SIZE, sfilefd[ithread]);
|
fwrite((void*)fileHeader[ithread], 1, FILE_HEADER_SIZE, sfilefd[ithread]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(totalWritingPacketCount[ithread]){
|
//Print packet loss
|
||||||
printf("\nThread:%d File:%s\n"
|
if(totalWritingPacketCountFromLastCheck[ithread]){
|
||||||
"Packets Lost:%d"
|
printf("\nThread:%d"
|
||||||
"\t\tPacketsInFile:%lld\tCurrentFrameNumber:%lld\tPreviousFrameNumber:%lld\n",
|
"\t\tPackets Lost:%d"
|
||||||
ithread,completeFileName[ithread],
|
"\tPacketsFromLastCheck:%lld"
|
||||||
( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousFile[ithread])*packetsPerFrame) - totalPacketsInFile[ithread]),
|
"\tCurrentFrameNumber:%lld"
|
||||||
totalPacketsInFile[ithread],currentFrameNumber[ithread],frameNumberInPreviousFile[ithread]
|
"\tPreviousFrameNumber:%lld\n",
|
||||||
);
|
ithread,
|
||||||
|
( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousCheck[ithread])*packetsPerFrame) - totalWritingPacketCountFromLastCheck[ithread]),
|
||||||
|
totalWritingPacketCountFromLastCheck[ithread],
|
||||||
|
currentFrameNumber[ithread],
|
||||||
|
frameNumberInPreviousCheck[ithread]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
closeFile(ithread);
|
closeFile(ithread);
|
||||||
pthread_mutex_lock(&statusMutex);
|
pthread_mutex_lock(&statusMutex);
|
||||||
writerThreadsMask^=(1<<ithread);
|
writerThreadsMask^=(1<<ithread);
|
||||||
@ -2918,6 +2924,31 @@ void UDPStandardImplementation::handleWithoutMissingPackets(int ithread, char* w
|
|||||||
if(numberofWriterThreads > 1)
|
if(numberofWriterThreads > 1)
|
||||||
pthread_mutex_unlock(&writeMutex);
|
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
|
#ifdef DEBUG4
|
||||||
cprintf(GREEN,"Writing_Thread: Writing done\nGoing to copy frame\n");
|
cprintf(GREEN,"Writing_Thread: Writing done\nGoing to copy frame\n");
|
||||||
|
Reference in New Issue
Block a user