in between

This commit is contained in:
Dhanya Maliakal 2016-08-15 15:11:46 +02:00
parent b64af8dc8d
commit 3fbcbd5153
2 changed files with 43 additions and 29 deletions

View File

@ -550,10 +550,10 @@ private:
/** Previous Frame number from buffer to calculate loss */ /** Previous Frame number from buffer to calculate loss */
int64_t previousFrameNumber; int64_t previousFrameNumber[MAX_NUMBER_OF_WRITER_THREADS];
/** Last Frame Index Listened To */ /** Last Frame Index Listened To */
int32_t lastFrameIndex; int32_t lastFrameIndex[MAX_NUMBER_OF_WRITER_THREADS];
/* Acquisition started */ /* Acquisition started */
@ -625,7 +625,7 @@ private:
char* guiData[MAX_NUMBER_OF_WRITER_THREADS]; char* guiData[MAX_NUMBER_OF_WRITER_THREADS];
/** Pointer to file name to be sent to GUI */ /** Pointer to file name to be sent to GUI */
char guiFileName[MAX_STR_LENGTH]; char guiFileName[MAX_NUMBER_OF_WRITER_THREADS][MAX_STR_LENGTH];
/** Semaphore to synchronize Writer and GuiReader threads*/ /** Semaphore to synchronize Writer and GuiReader threads*/
sem_t writerGuiSemaphore[MAX_NUMBER_OF_WRITER_THREADS]; sem_t writerGuiSemaphore[MAX_NUMBER_OF_WRITER_THREADS];

View File

@ -147,21 +147,24 @@ void UDPStandardImplementation::initializeMembers(){
fileCreateSuccess = false; fileCreateSuccess = false;
//***acquisition indices parameters*** //***acquisition indices parameters***
startAcquisitionIndex = 0;
startFrameIndex = 0;
frameIndex = 0;
currentFrameNumber = 0;
previousFrameNumber = -1;
lastFrameIndex = 0;
acqStarted = false;
measurementStarted = false;
for(int i = 0; i < MAX_NUMBER_OF_LISTENING_THREADS; ++i){ for(int i = 0; i < MAX_NUMBER_OF_LISTENING_THREADS; ++i){
startAcquisitionIndex[i] = 0;
startFrameIndex[i] = 0;
acqStarted[i] = false;
measurementStarted[i] = false;
totalListeningFrameCount[i] = 0; totalListeningFrameCount[i] = 0;
} }
packetsInFile = 0; for(int i=0; i<MAX_NUMBER_OF_WRITER_THREADS; i++){
numMissingPackets = 0; frameIndex[i] = 0;
numTotMissingPackets = 0; currentFrameNumber[i] = 0;
numTotMissingPacketsInFile = 0; previousFrameNumber[i] = -1;
lastFrameIndex[i] = 0;
packetsInFile[i] = 0;
numMissingPackets[i] = 0;
numTotMissingPackets[i] = 0;
numTotMissingPacketsInFile[i] = 0;
}
//***receiver parameters*** //***receiver parameters***
@ -172,16 +175,20 @@ void UDPStandardImplementation::initializeMembers(){
fifoFree[i] = NULL; fifoFree[i] = NULL;
udpSocket[i] = NULL; udpSocket[i] = NULL;
} }
sfilefd = NULL; for(int i=0; i<MAX_NUMBER_OF_WRITER_THREADS; i++){
sfilefd[i] = NULL;
}
numberofJobsPerBuffer = -1; numberofJobsPerBuffer = -1;
fifoSize = 0; fifoSize = 0;
//***receiver to GUI parameters*** //***receiver to GUI parameters***
latestData = NULL; for(int i=0; i<MAX_NUMBER_OF_WRITER_THREADS; i++){
guiDataReady = false; latestData[i] = NULL;
guiData = NULL; guiDataReady[i] = false;
strcpy(guiFileName,""); guiData[i] = NULL;
frametoGuiCounter = 0; strcpy(guiFileName[i],"");
frametoGuiCounter[i] = 0;
}
//***general and listening thread parameters*** //***general and listening thread parameters***
threadStarted = false; threadStarted = false;
@ -552,9 +559,10 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i){
if(oldDynamicRange != dynamicRange){ if(oldDynamicRange != dynamicRange){
//gui buffer //gui buffer
if(latestData){delete[] latestData; latestData = NULL;} for(int i=0;i<numberofWriterThreads;i++){
latestData = new char[frameSize]; if(latestData[i]){delete[] latestData[i]; latestData[i] = NULL;}
latestData[i] = new char[frameSize];
}
//restructure fifo //restructure fifo
numberofJobsPerBuffer = -1; numberofJobsPerBuffer = -1;
if(setupFifoStructure() == FAIL) if(setupFifoStructure() == FAIL)
@ -609,8 +617,10 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b){
if(oldTenGigaEnable != tengigaEnable){ if(oldTenGigaEnable != tengigaEnable){
//gui buffer //gui buffer
if(latestData){delete[] latestData; latestData = NULL;} for(int i=0;i<numberofWriterThreads;i++){
latestData = new char[frameSize]; if(latestData[i]){delete[] latestData[i]; latestData[i] = NULL;}
latestData[i] = new char[frameSize];
}
//restructure fifo //restructure fifo
if(setupFifoStructure() == FAIL) if(setupFifoStructure() == FAIL)
@ -767,10 +777,14 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
if(myDetectorType == EIGER){ if(myDetectorType == EIGER){
pthread_mutex_lock(&statusMutex); pthread_mutex_lock(&statusMutex);
listeningThreadsMask = 0x0; listeningThreadsMask = 0x0;
writerThreadsMask = 0x0;
pthread_mutex_unlock(&(statusMutex)); pthread_mutex_unlock(&(statusMutex));
if(threadStarted) if(threadStarted){
createListeningThreads(true); createListeningThreads(true);
createWriterThreads(true);
}
numberofListeningThreads = MAX_NUMBER_OF_LISTENING_THREADS; numberofListeningThreads = MAX_NUMBER_OF_LISTENING_THREADS;
numberofWriterThreads = MAX_NUMBER_OF_WRITER_THREADS;
} }
//set up fifo structure -1 for numberofJobsPerBuffer ensure it is done //set up fifo structure -1 for numberofJobsPerBuffer ensure it is done